From 45aebf2aa6d4ac70acacd01b6af510784e535f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 14:00:20 +0100 Subject: [PATCH 01/22] WIP: Update pycddlib dependency version to 3.0.0 --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e7ab56..419b50a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Changed + +- Update pycddlib to version 3.0.0 + ## [1.1.1] - 2024-12-20 ### Changed diff --git a/pyproject.toml b/pyproject.toml index 4be6cbf..aec72df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ "cvxopt >=1.2.6", "matplotlib >=3.3.4", "numpy >=1.15.4", - "pycddlib >=2.1.4,<3", + "pycddlib >=3.0.0", "scipy >=1.7.0", ] keywords = ["convex, polyhedron, polyhedra, polytope, projection, duality"] From 040d84cdb5fb07b4a0677d997dd6b9a2bddad939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 14:01:44 +0100 Subject: [PATCH 02/22] Update pycddlib API See https://pycddlib.readthedocs.io/en/latest/changes.html#version-3-0-0-4-october-2024 --- pypoman/duality.py | 6 +++--- pypoman/projection.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pypoman/duality.py b/pypoman/duality.py index 16bdb66..83bf6d7 100644 --- a/pypoman/duality.py +++ b/pypoman/duality.py @@ -36,7 +36,7 @@ def compute_cone_face_matrix(S: np.ndarray) -> np.ndarray: ] ) # V-representation: first column is 0 for rays - mat = cdd.Matrix(V, number_type="float") + mat = cdd.matrix_from_array(V) mat.rep_type = cdd.RepType.GENERATOR P = cdd.Polyhedron(mat) ineq = P.get_inequalities() @@ -82,7 +82,7 @@ def compute_polytope_halfspaces( V = np.vstack(vertices) t = np.ones((V.shape[0], 1)) # first column is 1 for vertices tV = np.hstack([t, V]) - mat = cdd.Matrix(tV, number_type="float") + mat = cdd.matrix_from_array(tV) mat.rep_type = cdd.RepType.GENERATOR P = cdd.Polyhedron(mat) bA = np.array(P.get_inequalities()) @@ -121,7 +121,7 @@ def compute_polytope_vertices( `_. """ b = b.reshape((b.shape[0], 1)) - mat = cdd.Matrix(np.hstack([b, -A]), number_type="float") + mat = cdd.matrix_from_array(np.hstack([b, -A])) mat.rep_type = cdd.RepType.INEQUALITY P = cdd.Polyhedron(mat) g = P.get_generators() diff --git a/pypoman/projection.py b/pypoman/projection.py index 83ab48c..28ed0f3 100644 --- a/pypoman/projection.py +++ b/pypoman/projection.py @@ -69,7 +69,7 @@ def project_polyhedron( # see ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlibman/node3.html (A, b) = ineq b = b.reshape((b.shape[0], 1)) - linsys = cdd.Matrix(np.hstack([b, -A]), number_type="float") + linsys = cdd.matrix_from_array(np.hstack([b, -A])) linsys.rep_type = cdd.RepType.INEQUALITY # the input [d, -C] to cdd.Matrix.extend represents (d - C * x == 0) From f2e561e7c17c7c8b494a51f46f3b826e2d4ad1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 14:06:27 +0100 Subject: [PATCH 03/22] Bump minimum supported Python version to 3.9 --- .github/workflows/ci.yml | 6 +++--- CHANGELOG.md | 1 + pyproject.toml | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 616c6d0..53cfbf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,10 @@ jobs: - name: "Checkout sources" uses: actions/checkout@v3 - - name: "Set up Python 3.8" + - name: "Set up Python 3.9" uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.9" - name: "Install Debian dependencies" run: | @@ -75,7 +75,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: "Checkout sources" diff --git a/CHANGELOG.md b/CHANGELOG.md index 419b50a..c43082e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ### Changed +- Bump minimum supported Python version to 3.9 - Update pycddlib to version 3.0.0 ## [1.1.1] - 2024-12-20 diff --git a/pyproject.toml b/pyproject.toml index aec72df..4ae94ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,17 +12,17 @@ maintainers = [ {name = "Stéphane Caron", email = "stephane.caron@normalesup.org"}, ] dynamic = ['version', 'description'] -requires-python = ">=3.7" +requires-python = ">=3.9" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Mathematics", "Intended Audience :: Developers", "Intended Audience :: Science/Research", From f6f6a7c478d9aa0dacf0d38273c293fc14f56c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 14:13:26 +0100 Subject: [PATCH 04/22] Update to new pycddlib API --- pypoman/projection.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pypoman/projection.py b/pypoman/projection.py index 28ed0f3..379fe2a 100644 --- a/pypoman/projection.py +++ b/pypoman/projection.py @@ -72,14 +72,16 @@ def project_polyhedron( linsys = cdd.matrix_from_array(np.hstack([b, -A])) linsys.rep_type = cdd.RepType.INEQUALITY - # the input [d, -C] to cdd.Matrix.extend represents (d - C * x == 0) + # the input [d, -C] to the cdd function represents (d - C * x == 0) # see ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlibman/node3.html if eq is not None: (C, d) = eq d = d.reshape((d.shape[0], 1)) - linsys.extend(np.hstack([d, -C]), linear=True) + new_matrix = cdd.matrix_from_array(np.hstack([d, -C])) + cdd.matrix_append_to(linsys, new_matrix) + linsys.rep_type = cdd.RepType.INEQUALITY if canonicalize: - linsys.canonicalize() + cdd.matrix_canonicalize(linsys) # Convert from H- to V-representation P = cdd.Polyhedron(linsys) From e7b59b984094417d36fa43698886b46bd3412025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 15:02:27 +0100 Subject: [PATCH 05/22] CICD: Run unit tests in conda environment --- .github/workflows/ci.yml | 47 ++++++++++++++++++++-------------------- tox.ini | 7 ------ 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53cfbf2..da1f786 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,30 +77,15 @@ jobs: os: [ubuntu-latest, windows-latest] python-version: ["3.9", "3.10", "3.11", "3.12"] + defaults: + run: + # See https://github.com/mamba-org/setup-micromamba?tab=readme-ov-file#about-login-shells + shell: bash -leo pipefail {0} + steps: - name: "Checkout sources" uses: actions/checkout@v3 - - name: "Set up Python ${{ matrix.python-version }}" - uses: actions/setup-python@v4 - with: - python-version: "${{ matrix.python-version }}" - - - name: "Install Debian dependencies" - if: matrix.os == 'ubuntu-latest' - run: | - sudo apt install libgmp-dev - - - name: "Install macOS dependencies" - if: matrix.os == 'macos-latest' - run: | - brew install gmp - - - name: "Install PyPI dependencies" - run: | - python -m pip install --upgrade pip - python -m pip install tox tox-gh-actions - - name: "Install GMP (Ubuntu)" if: matrix.os == 'ubuntu-latest' run: | @@ -111,11 +96,25 @@ jobs: run: | brew install gmp - - name: "Test with tox for ${{ matrix.os }}" - env: - PLATFORM: ${{ matrix.os }} + - name: "Install Conda environment with Micromamba" + uses: mamba-org/setup-micromamba@v1 + with: + micromamba-version: '1.5.8-0' + environment-name: upkie_test_env + create-args: >- + python=${{ matrix.python-version }} + cvxopt >=1.2.6 + matplotlib >=3.3.4 + numpy >=1.15.4 + pyclipper >=1.3.0 + qpsolvers >=3.3.1 + scipy >=1.7.0 + cache-environment: true + post-cleanup: 'all' + + - name: "Run unit tests" run: | - tox + python -m unittest discover ci_success: name: "CI success" diff --git a/tox.ini b/tox.ini index 3365dd7..b3b8fb9 100644 --- a/tox.ini +++ b/tox.ini @@ -13,13 +13,6 @@ PLATFORM = ubuntu-latest: linux windows-latest: windows -[testenv] -deps = - pyclipper >=1.3.0 - qpsolvers >=3.3.1 -commands = - python -m unittest discover - [testenv:coverage] deps = coverage >=5.5 From ade0219e772c86cbf1627a1e034014435577d0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 15:06:08 +0100 Subject: [PATCH 06/22] CICD: Fix workflow syntax --- .github/workflows/ci.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da1f786..9bd4052 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,18 +100,22 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: micromamba-version: '1.5.8-0' - environment-name: upkie_test_env + environment-name: pypoman_test_env create-args: >- python=${{ matrix.python-version }} - cvxopt >=1.2.6 - matplotlib >=3.3.4 - numpy >=1.15.4 - pyclipper >=1.3.0 - qpsolvers >=3.3.1 - scipy >=1.7.0 + cvxopt>=1.2.6 + matplotlib>=3.3.4 + numpy>=1.15.4 + pyclipper>=1.3.0 + qpsolvers>=3.3.1 + scipy>=1.7.0 cache-environment: true post-cleanup: 'all' + - name: "Install pycddlib using pip" + run: | + pip install pycddlib + - name: "Run unit tests" run: | python -m unittest discover From ac5ef7c17ae51958014811285d6fe7ad423ae557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 17:54:34 +0100 Subject: [PATCH 07/22] CICD: Install cddlib in conda environment --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bd4052..509d367 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,7 @@ jobs: environment-name: pypoman_test_env create-args: >- python=${{ matrix.python-version }} + cddlib cvxopt>=1.2.6 matplotlib>=3.3.4 numpy>=1.15.4 From ed9e517f3f952cb1ca5c030143bb2671c3033ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 18:17:23 +0100 Subject: [PATCH 08/22] CICD: Don't install pycddlib on windows --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 509d367..ec38ed5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,6 @@ jobs: environment-name: pypoman_test_env create-args: >- python=${{ matrix.python-version }} - cddlib cvxopt>=1.2.6 matplotlib>=3.3.4 numpy>=1.15.4 @@ -113,8 +112,10 @@ jobs: cache-environment: true post-cleanup: 'all' - - name: "Install pycddlib using pip" + - name: "Install cdd and pycddlib" + if: ${{ matrix.os != 'windows-latest' }} run: | + conda install cddlib pip install pycddlib - name: "Run unit tests" From 0289093637eeccb3e04671801863e5475d0ce2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 18:28:06 +0100 Subject: [PATCH 09/22] No need to install cddlib when wheels exist --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec38ed5..5ac9cec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,7 +115,7 @@ jobs: - name: "Install cdd and pycddlib" if: ${{ matrix.os != 'windows-latest' }} run: | - conda install cddlib + # conda install cddlib pip install pycddlib - name: "Run unit tests" From 36134ee8bb480cb72470f81a9db02f4097b18975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 19:05:20 +0100 Subject: [PATCH 10/22] Update pycddlib polyhedron API Change `cdd.Polyhedron` to `cdd.polyhedron_from_matrix`. --- pypoman/duality.py | 16 ++++++++-------- pypoman/projection.py | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pypoman/duality.py b/pypoman/duality.py index 83bf6d7..f47df03 100644 --- a/pypoman/duality.py +++ b/pypoman/duality.py @@ -38,9 +38,9 @@ def compute_cone_face_matrix(S: np.ndarray) -> np.ndarray: # V-representation: first column is 0 for rays mat = cdd.matrix_from_array(V) mat.rep_type = cdd.RepType.GENERATOR - P = cdd.Polyhedron(mat) - ineq = P.get_inequalities() - H = np.array(ineq) + P = cdd.polyhedron_from_matrix(mat) + ineq = cdd.copy_inequalities(P) + H = np.array(ineq.array) if H.shape == (0,): # H == [] return H A = [] @@ -84,8 +84,8 @@ def compute_polytope_halfspaces( tV = np.hstack([t, V]) mat = cdd.matrix_from_array(tV) mat.rep_type = cdd.RepType.GENERATOR - P = cdd.Polyhedron(mat) - bA = np.array(P.get_inequalities()) + P = cdd.polyhedron_from_matrix(mat) + bA = np.array(cdd.copy_inequalities(P).array) if bA.shape == (0,): # bA == [] return bA # the polyhedron is given by b + A x >= 0 where bA = [b|A] @@ -123,9 +123,9 @@ def compute_polytope_vertices( b = b.reshape((b.shape[0], 1)) mat = cdd.matrix_from_array(np.hstack([b, -A])) mat.rep_type = cdd.RepType.INEQUALITY - P = cdd.Polyhedron(mat) - g = P.get_generators() - V = np.array(g) + P = cdd.polyhedron_from_matrix(mat) + g = cdd.copy_generators(P) + V = np.array(g.array) vertices = [] for i in range(V.shape[0]): if V[i, 0] != 1: # 1 = vertex, 0 = ray diff --git a/pypoman/projection.py b/pypoman/projection.py index 379fe2a..6071f8a 100644 --- a/pypoman/projection.py +++ b/pypoman/projection.py @@ -84,11 +84,11 @@ def project_polyhedron( cdd.matrix_canonicalize(linsys) # Convert from H- to V-representation - P = cdd.Polyhedron(linsys) - generators = P.get_generators() + P = cdd.polyhedron_from_matrix(linsys) + generators = cdd.copy_generators(P) if generators.lin_set: print("Generators have linear set: {}".format(generators.lin_set)) - V = np.array(generators) + V = np.array(generators.array) # Project output wrenches to 2D set (E, f) = proj From c5acb3f93138d3df33d91abb5ac27cedaef3d47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 20 Dec 2024 19:09:12 +0100 Subject: [PATCH 11/22] Fix NumPy 2.0 deprecation warning DeprecationWarning: Arrays of 2-dimensional vectors are deprecated. Use arrays of 3-dimensional vectors instead. --- pypoman/bretl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pypoman/bretl.py b/pypoman/bretl.py index 0ed07a9..6d0bd64 100644 --- a/pypoman/bretl.py +++ b/pypoman/bretl.py @@ -69,8 +69,9 @@ def expand( if ( abs( np.cross( - [xopt - v1.x, yopt - v1.y], [v1.x - v2.x, v1.y - v2.y] - ) + [xopt - v1.x, yopt - v1.y, 0], + [v1.x - v2.x, v1.y - v2.y, 0], + )[2] ) < 1e-4 ): From 2d936a7de18c01f8270e9855296aae5e947bed7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 09:11:37 +0100 Subject: [PATCH 12/22] CICD: Install cddlib in conda environment --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ac9cec..60f83fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,7 @@ jobs: environment-name: pypoman_test_env create-args: >- python=${{ matrix.python-version }} + cddlib cvxopt>=1.2.6 matplotlib>=3.3.4 numpy>=1.15.4 @@ -115,7 +116,6 @@ jobs: - name: "Install cdd and pycddlib" if: ${{ matrix.os != 'windows-latest' }} run: | - # conda install cddlib pip install pycddlib - name: "Run unit tests" From be635e264197f55dec9454113d8bdda782920b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 09:13:44 +0100 Subject: [PATCH 13/22] CICD: Install libcdd-dev in Ubuntu runners --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60f83fc..c27b2ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - name: "Install Debian dependencies" run: | - sudo apt install libgmp3-dev + sudo apt-get install -y libcdd-dev libgmp3-dev - name: "Install PyPI dependencies" run: | @@ -55,7 +55,7 @@ jobs: - name: "Install Debian dependencies" run: | - sudo apt install libgmp3-dev + sudo apt-get install -y libcdd-dev libgmp3-dev - name: "Install PyPI dependencies" run: | @@ -89,7 +89,7 @@ jobs: - name: "Install GMP (Ubuntu)" if: matrix.os == 'ubuntu-latest' run: | - sudo apt-get install -y libgmp-dev + sudo apt-get install -y libcdd-dev libgmp3-dev - name: "Install GMP (macOS)" if: ${{ matrix.os == 'macos-latest' }} From e3360a2970d75fe272c9d765f5fe98829b9e940c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 13:26:44 +0100 Subject: [PATCH 14/22] CICD: Update windows-latest workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c27b2ba..813e81e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,6 @@ jobs: environment-name: pypoman_test_env create-args: >- python=${{ matrix.python-version }} - cddlib cvxopt>=1.2.6 matplotlib>=3.3.4 numpy>=1.15.4 @@ -116,6 +115,7 @@ jobs: - name: "Install cdd and pycddlib" if: ${{ matrix.os != 'windows-latest' }} run: | + conda install cddlib pip install pycddlib - name: "Run unit tests" From dd60474b7c7d673ada5b53596ff641e0b8f38c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 13:32:54 +0100 Subject: [PATCH 15/22] CICD: Drop Windows support --- .github/workflows/ci.yml | 7 +++---- CHANGELOG.md | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 813e81e..3aff5cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] python-version: ["3.9", "3.10", "3.11", "3.12"] defaults: @@ -89,7 +89,7 @@ jobs: - name: "Install GMP (Ubuntu)" if: matrix.os == 'ubuntu-latest' run: | - sudo apt-get install -y libcdd-dev libgmp3-dev + sudo apt-get install -y libgmp3-dev - name: "Install GMP (macOS)" if: ${{ matrix.os == 'macos-latest' }} @@ -103,6 +103,7 @@ jobs: environment-name: pypoman_test_env create-args: >- python=${{ matrix.python-version }} + cddlib cvxopt>=1.2.6 matplotlib>=3.3.4 numpy>=1.15.4 @@ -113,9 +114,7 @@ jobs: post-cleanup: 'all' - name: "Install cdd and pycddlib" - if: ${{ matrix.os != 'windows-latest' }} run: | - conda install cddlib pip install pycddlib - name: "Run unit tests" diff --git a/CHANGELOG.md b/CHANGELOG.md index c43082e..7c07b97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file. - Bump minimum supported Python version to 3.9 - Update pycddlib to version 3.0.0 +### Removed + +- CICD: Dropped Windows support + ## [1.1.1] - 2024-12-20 ### Changed From 6d0831d61423aeabf6408f5611a546da2ced0e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 13:36:20 +0100 Subject: [PATCH 16/22] Remove cdd reference from polyhedron submodule --- CHANGELOG.md | 1 + pypoman/polyhedron.py | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c07b97..e3a3ce2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. ### Removed - CICD: Dropped Windows support +- Remove cdd reference from polyhedron submodule ## [1.1.1] - 2024-12-20 diff --git a/pypoman/polyhedron.py b/pypoman/polyhedron.py index a3ceb3d..561bf65 100644 --- a/pypoman/polyhedron.py +++ b/pypoman/polyhedron.py @@ -15,13 +15,6 @@ from .lp import solve_lp from .misc import norm -try: - import cdd -except ImportError: - warn("Could not import cdd, some functions will not be available") - cdd = None - - try: import cvxopt except ImportError: @@ -61,7 +54,6 @@ def compute_chebyshev_center(A: np.ndarray, b: np.ndarray) -> np.ndarray: __all__ = [ - "cdd", "compute_chebyshev_center", "cvxopt", ] From 0ef2bcfaed56f754166a6bf5dc7bff330cfb7a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 13:39:46 +0100 Subject: [PATCH 17/22] Ignore types when calling cdd.matrix_from_array --- pypoman/duality.py | 6 +++--- pypoman/projection.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pypoman/duality.py b/pypoman/duality.py index f47df03..324e16a 100644 --- a/pypoman/duality.py +++ b/pypoman/duality.py @@ -36,7 +36,7 @@ def compute_cone_face_matrix(S: np.ndarray) -> np.ndarray: ] ) # V-representation: first column is 0 for rays - mat = cdd.matrix_from_array(V) + mat = cdd.matrix_from_array(V) # type: ignore mat.rep_type = cdd.RepType.GENERATOR P = cdd.polyhedron_from_matrix(mat) ineq = cdd.copy_inequalities(P) @@ -82,7 +82,7 @@ def compute_polytope_halfspaces( V = np.vstack(vertices) t = np.ones((V.shape[0], 1)) # first column is 1 for vertices tV = np.hstack([t, V]) - mat = cdd.matrix_from_array(tV) + mat = cdd.matrix_from_array(tV) # type: ignore mat.rep_type = cdd.RepType.GENERATOR P = cdd.polyhedron_from_matrix(mat) bA = np.array(cdd.copy_inequalities(P).array) @@ -121,7 +121,7 @@ def compute_polytope_vertices( `_. """ b = b.reshape((b.shape[0], 1)) - mat = cdd.matrix_from_array(np.hstack([b, -A])) + mat = cdd.matrix_from_array(np.hstack([b, -A])) # type: ignore mat.rep_type = cdd.RepType.INEQUALITY P = cdd.polyhedron_from_matrix(mat) g = cdd.copy_generators(P) diff --git a/pypoman/projection.py b/pypoman/projection.py index 6071f8a..1a70086 100644 --- a/pypoman/projection.py +++ b/pypoman/projection.py @@ -69,7 +69,7 @@ def project_polyhedron( # see ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlibman/node3.html (A, b) = ineq b = b.reshape((b.shape[0], 1)) - linsys = cdd.matrix_from_array(np.hstack([b, -A])) + linsys = cdd.matrix_from_array(np.hstack([b, -A])) # type: ignore linsys.rep_type = cdd.RepType.INEQUALITY # the input [d, -C] to the cdd function represents (d - C * x == 0) @@ -77,7 +77,7 @@ def project_polyhedron( if eq is not None: (C, d) = eq d = d.reshape((d.shape[0], 1)) - new_matrix = cdd.matrix_from_array(np.hstack([d, -C])) + new_matrix = cdd.matrix_from_array(np.hstack([d, -C])) # type: ignore cdd.matrix_append_to(linsys, new_matrix) linsys.rep_type = cdd.RepType.INEQUALITY if canonicalize: From 5fc9127ed8792f89af34df2f1e19cbb60e885187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 13:42:29 +0100 Subject: [PATCH 18/22] CICD: Re-enable macOS testing --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aff5cc..37cf555 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] python-version: ["3.9", "3.10", "3.11", "3.12"] defaults: diff --git a/CHANGELOG.md b/CHANGELOG.md index e3a3ce2..0aa6bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file. - Bump minimum supported Python version to 3.9 - Update pycddlib to version 3.0.0 +### Fixed + +- CICD: Re-enable macOS testing + ### Removed - CICD: Dropped Windows support From 9146335ae5d273f75b84ce3f3e1cb32de18a5d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 14:05:22 +0100 Subject: [PATCH 19/22] CICD: Use macos-13 rather than macos-latest for now See https://github.com/conda-forge/qpoases-feedstock/issues/8 --- .github/workflows/ci.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37cf555..094cf76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-13] python-version: ["3.9", "3.10", "3.11", "3.12"] defaults: @@ -92,7 +92,7 @@ jobs: sudo apt-get install -y libgmp3-dev - name: "Install GMP (macOS)" - if: ${{ matrix.os == 'macos-latest' }} + if: ${{ matrix.os == 'macos-13' }} run: | brew install gmp @@ -113,6 +113,13 @@ jobs: cache-environment: true post-cleanup: 'all' + - name: "List Conda packages" + run: | + conda list + + - name: "Additional Conda information" + conda info + - name: "Install cdd and pycddlib" run: | pip install pycddlib From 05fab8688de8a04329bbd2010e77233503fc40b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 15:01:23 +0100 Subject: [PATCH 20/22] Update docs to re-trigger CI --- doc/src/chebyshev-center.rst | 5 ++++ doc/src/duality.rst | 7 +++++ doc/src/index.rst | 53 ++++++---------------------------- doc/src/intersection.rst | 6 ++++ doc/src/linear-programming.rst | 5 ++++ doc/src/polygon.rst | 7 +++++ doc/src/projection.rst | 6 ++++ doc/src/references.rst | 11 +++++++ 8 files changed, 56 insertions(+), 44 deletions(-) create mode 100644 doc/src/chebyshev-center.rst create mode 100644 doc/src/duality.rst create mode 100644 doc/src/intersection.rst create mode 100644 doc/src/linear-programming.rst create mode 100644 doc/src/polygon.rst create mode 100644 doc/src/projection.rst create mode 100644 doc/src/references.rst diff --git a/doc/src/chebyshev-center.rst b/doc/src/chebyshev-center.rst new file mode 100644 index 0000000..7e2a32b --- /dev/null +++ b/doc/src/chebyshev-center.rst @@ -0,0 +1,5 @@ +**************** +Chebyshev center +**************** + +.. autofunction:: pypoman.polyhedron.compute_chebyshev_center diff --git a/doc/src/duality.rst b/doc/src/duality.rst new file mode 100644 index 0000000..4795a03 --- /dev/null +++ b/doc/src/duality.rst @@ -0,0 +1,7 @@ +******* +Duality +******* + +.. automodule:: pypoman.duality + :members: + diff --git a/doc/src/index.rst b/doc/src/index.rst index a2d959e..8a2cbe8 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -3,47 +3,12 @@ Welcome to the documentation of **pypoman**, a PYthon module for POlyhedral MANipulations. -Chebyshev center -================ - -.. autofunction:: pypoman.polyhedron.compute_chebyshev_center - -Duality -======= - -.. automodule:: pypoman.duality - :members: - -Intersection -============ - -.. automodule:: pypoman.intersection - :members: - -Linear programming -================== - -.. autofunction:: pypoman.lp.solve_lp - -Polygon manipulation -==================== - -.. automodule:: pypoman.polygon - :members: - -Projection -========== - -.. automodule:: pypoman.projection - :members: - -References -========== - -.. [Boyd04] `Convex Optimization - `_, Stephen Boyd and - Lieven Vandenberghe, Cambridge University Press, 2004. - -.. [Bretl08] *Testing Static Equilibrium for Legged Robots*, T. Bretl and S. - Lall, IEEE Transactions on Robotics, vol. 24, no. 4, pp. 794-807, August - 2008. +.. toctree:: + :maxdepth: 1 + + chebyshev-center.rst + duality.rst + intersection.rst + polygon.rst + projection.rst + references.rst diff --git a/doc/src/intersection.rst b/doc/src/intersection.rst new file mode 100644 index 0000000..a2f5a26 --- /dev/null +++ b/doc/src/intersection.rst @@ -0,0 +1,6 @@ +************ +Intersection +************ + +.. automodule:: pypoman.intersection + :members: diff --git a/doc/src/linear-programming.rst b/doc/src/linear-programming.rst new file mode 100644 index 0000000..5885ddd --- /dev/null +++ b/doc/src/linear-programming.rst @@ -0,0 +1,5 @@ +****************** +Linear programming +****************** + +.. autofunction:: pypoman.lp.solve_lp diff --git a/doc/src/polygon.rst b/doc/src/polygon.rst new file mode 100644 index 0000000..f54c439 --- /dev/null +++ b/doc/src/polygon.rst @@ -0,0 +1,7 @@ +******************** +Polygon manipulation +******************** + +.. automodule:: pypoman.polygon + :members: + diff --git a/doc/src/projection.rst b/doc/src/projection.rst new file mode 100644 index 0000000..7575ec7 --- /dev/null +++ b/doc/src/projection.rst @@ -0,0 +1,6 @@ +********** +Projection +********** + +.. automodule:: pypoman.projection + :members: diff --git a/doc/src/references.rst b/doc/src/references.rst new file mode 100644 index 0000000..028366d --- /dev/null +++ b/doc/src/references.rst @@ -0,0 +1,11 @@ +********** +References +********** + +.. [Boyd04] `Convex Optimization + `_, Stephen Boyd and + Lieven Vandenberghe, Cambridge University Press, 2004. + +.. [Bretl08] *Testing Static Equilibrium for Legged Robots*, T. Bretl and S. + Lall, IEEE Transactions on Robotics, vol. 24, no. 4, pp. 794-807, August + 2008. From f8fe69b00f4fe2d51ddec909af892f50e969bb2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 15:02:13 +0100 Subject: [PATCH 21/22] CICD: Fix CI YAML --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 094cf76..aaf295c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,6 +118,7 @@ jobs: conda list - name: "Additional Conda information" + run: | conda info - name: "Install cdd and pycddlib" From 8f22dda16fd538787a40554440903e36271ac3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Mon, 6 Jan 2025 15:04:33 +0100 Subject: [PATCH 22/22] CICD: Remove extra conda steps --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aaf295c..72393af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,14 +113,6 @@ jobs: cache-environment: true post-cleanup: 'all' - - name: "List Conda packages" - run: | - conda list - - - name: "Additional Conda information" - run: | - conda info - - name: "Install cdd and pycddlib" run: | pip install pycddlib