xipopt 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. xipopt-0.1.0/.github/workflows/benchmark.yml +45 -0
  2. xipopt-0.1.0/.github/workflows/ci.yml +207 -0
  3. xipopt-0.1.0/.github/workflows/docs.yml +55 -0
  4. xipopt-0.1.0/.gitignore +28 -0
  5. xipopt-0.1.0/.python-version +1 -0
  6. xipopt-0.1.0/AGENTS.md +8 -0
  7. xipopt-0.1.0/LICENSE.md +135 -0
  8. xipopt-0.1.0/PKG-INFO +95 -0
  9. xipopt-0.1.0/README.md +65 -0
  10. xipopt-0.1.0/benchmarks/compare.py +228 -0
  11. xipopt-0.1.0/build_backend/xipopt_build.py +77 -0
  12. xipopt-0.1.0/docs/api/options.md +13 -0
  13. xipopt-0.1.0/docs/api/problems.md +15 -0
  14. xipopt-0.1.0/docs/api/results.md +15 -0
  15. xipopt-0.1.0/docs/api/solving.md +19 -0
  16. xipopt-0.1.0/docs/design.md +67 -0
  17. xipopt-0.1.0/docs/development.md +68 -0
  18. xipopt-0.1.0/docs/guide/basic.md +120 -0
  19. xipopt-0.1.0/docs/guide/derivatives.md +143 -0
  20. xipopt-0.1.0/docs/guide/options.md +126 -0
  21. xipopt-0.1.0/docs/guide/parameters.md +109 -0
  22. xipopt-0.1.0/docs/guide/performance.md +70 -0
  23. xipopt-0.1.0/docs/guide/saving.md +93 -0
  24. xipopt-0.1.0/docs/index.md +82 -0
  25. xipopt-0.1.0/docs/installation.md +55 -0
  26. xipopt-0.1.0/docs/references.md +20 -0
  27. xipopt-0.1.0/licenses/ASL-LICENSE.txt +17 -0
  28. xipopt-0.1.0/licenses/CompilerSupportLibraries-GPL-3.0+ +674 -0
  29. xipopt-0.1.0/licenses/Hwloc-COPYING +46 -0
  30. xipopt-0.1.0/licenses/Ipopt-LICENSE +277 -0
  31. xipopt-0.1.0/licenses/Libiconv-COPYING +674 -0
  32. xipopt-0.1.0/licenses/METIS-LICENSE-2.0.txt +202 -0
  33. xipopt-0.1.0/licenses/MUMPS_seq-LICENSE +50 -0
  34. xipopt-0.1.0/licenses/OpenBLAS32-LICENSE +29 -0
  35. xipopt-0.1.0/licenses/README.md +26 -0
  36. xipopt-0.1.0/licenses/SPRAL-LICENCE +24 -0
  37. xipopt-0.1.0/licenses/XML2-Copyright +24 -0
  38. xipopt-0.1.0/licenses/Xorg_libpciaccess-COPYING +97 -0
  39. xipopt-0.1.0/licenses/Zlib-README +115 -0
  40. xipopt-0.1.0/licenses/libblastrampoline-LICENSE.md +21 -0
  41. xipopt-0.1.0/meson.build +33 -0
  42. xipopt-0.1.0/meson.options +2 -0
  43. xipopt-0.1.0/pyproject.toml +126 -0
  44. xipopt-0.1.0/scripts/smoke_test.py +28 -0
  45. xipopt-0.1.0/src/xipopt/__init__.py +67 -0
  46. xipopt-0.1.0/src/xipopt/_blas.pxd +12 -0
  47. xipopt-0.1.0/src/xipopt/_cache.py +124 -0
  48. xipopt-0.1.0/src/xipopt/_compile.py +297 -0
  49. xipopt-0.1.0/src/xipopt/_environment.py +62 -0
  50. xipopt-0.1.0/src/xipopt/_ipopt.pxd +114 -0
  51. xipopt-0.1.0/src/xipopt/_layout.py +198 -0
  52. xipopt-0.1.0/src/xipopt/_options.py +89 -0
  53. xipopt-0.1.0/src/xipopt/_patterns.py +105 -0
  54. xipopt-0.1.0/src/xipopt/_platform.h +28 -0
  55. xipopt-0.1.0/src/xipopt/_platform.pxd +5 -0
  56. xipopt-0.1.0/src/xipopt/_problem_types.py +78 -0
  57. xipopt-0.1.0/src/xipopt/_programs.py +365 -0
  58. xipopt-0.1.0/src/xipopt/_serialize.py +191 -0
  59. xipopt-0.1.0/src/xipopt/_solve.py +205 -0
  60. xipopt-0.1.0/src/xipopt/_solver.pxd +45 -0
  61. xipopt-0.1.0/src/xipopt/_solver.py +718 -0
  62. xipopt-0.1.0/src/xipopt/_solver.pyi +70 -0
  63. xipopt-0.1.0/src/xipopt/_types.py +119 -0
  64. xipopt-0.1.0/src/xipopt/meson.build +75 -0
  65. xipopt-0.1.0/src/xipopt/py.typed +0 -0
  66. xipopt-0.1.0/subprojects/meson-jll.lock.wrap +63 -0
  67. xipopt-0.1.0/tests/conftest.py +33 -0
  68. xipopt-0.1.0/tests/integration/test_hock_schittkowski.py +58 -0
  69. xipopt-0.1.0/tests/integration/test_loading_process.py +46 -0
  70. xipopt-0.1.0/tests/integration/test_random.py +110 -0
  71. xipopt-0.1.0/tests/problems.py +174 -0
  72. xipopt-0.1.0/tests/unit/test_bratu.py +114 -0
  73. xipopt-0.1.0/tests/unit/test_native.py +211 -0
  74. xipopt-0.1.0/tests/unit/test_problems.py +193 -0
  75. xipopt-0.1.0/tests/unit/test_saving.py +185 -0
  76. xipopt-0.1.0/tests/unit/test_solving.py +237 -0
  77. xipopt-0.1.0/uv.lock +1671 -0
  78. xipopt-0.1.0/zensical.toml +53 -0
@@ -0,0 +1,45 @@
1
+ name: Benchmark
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ compare:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Install uv
16
+ uses: astral-sh/setup-uv@v5
17
+ with:
18
+ enable-cache: true
19
+
20
+ # The comparison needs a build without line tracing, which would slow the callbacks.
21
+ - name: Sync dependencies
22
+ run: |
23
+ uv sync --locked
24
+ uv pip install --no-config --no-deps --no-build-isolation --reinstall -e . \
25
+ -C setup-args=-Dcoverage=false
26
+
27
+ # cyipopt compiles against the Ipopt that Meson extracted for the wheel, so both
28
+ # sides of the comparison use one library.
29
+ - name: Build cyipopt
30
+ run: |
31
+ ipopt=$(ls -d subprojects/Ipopt-x86_64-linux-gnu-*/ | head -1)
32
+ uv pip install setuptools
33
+ PKG_CONFIG_PATH="$PWD/$ipopt/lib/pkgconfig" \
34
+ uv pip install --no-build-isolation --no-binary cyipopt cyipopt
35
+
36
+ - name: Compare
37
+ env:
38
+ OPENBLAS_NUM_THREADS: "1"
39
+ run: uv run --no-sync python benchmarks/compare.py 15 | tee comparison.md
40
+
41
+ - name: Upload the table
42
+ uses: actions/upload-artifact@v4
43
+ with:
44
+ name: comparison
45
+ path: comparison.md
@@ -0,0 +1,207 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ["v*"]
7
+ pull_request:
8
+ workflow_dispatch:
9
+ inputs:
10
+ release:
11
+ description: Publish the version of pyproject.toml from main, which also tags the commit
12
+ type: boolean
13
+ default: false
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ defaults:
19
+ run:
20
+ shell: bash
21
+
22
+ jobs:
23
+ test:
24
+ runs-on: ${{ matrix.os }}
25
+ strategy:
26
+ fail-fast: false
27
+ matrix:
28
+ os: [ubuntu-latest, macos-latest, windows-latest]
29
+ python-version: ["3.11", "3.13"]
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+
33
+ - name: Install uv
34
+ uses: astral-sh/setup-uv@v5
35
+ with:
36
+ enable-cache: true
37
+
38
+ - name: Install Python
39
+ run: uv python install ${{ matrix.python-version }}
40
+
41
+ # Meson downloads the JLL tarballs into this directory on configure. The lock file pins
42
+ # their versions, so its hash identifies the contents.
43
+ - name: Cache JLL tarballs
44
+ uses: actions/cache@v4
45
+ with:
46
+ path: subprojects/packagecache
47
+ key: jll-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('subprojects/meson-jll.lock.wrap') }}
48
+
49
+ - name: Sync dependencies
50
+ run: uv sync --locked --python ${{ matrix.python-version }}
51
+
52
+ # The unit tests cover all the code, so only they record coverage.
53
+ - name: Run unit tests
54
+ env:
55
+ COVERAGE_FILE: .coverage.${{ matrix.os }}.${{ matrix.python-version }}
56
+ run: uv run --no-sync pytest -m unit --cov --cov-fail-under=0
57
+
58
+ - name: Run integration tests
59
+ run: uv run --no-sync pytest -m integration
60
+
61
+ - name: Upload coverage data
62
+ uses: actions/upload-artifact@v4
63
+ with:
64
+ name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
65
+ path: .coverage.*
66
+ include-hidden-files: true
67
+
68
+ coverage:
69
+ runs-on: ubuntu-latest
70
+ needs: test
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+
74
+ - name: Install uv
75
+ uses: astral-sh/setup-uv@v5
76
+ with:
77
+ enable-cache: true
78
+
79
+ # Syncing builds the Cython module, and the coverage report reads its C file.
80
+ - name: Sync dependencies
81
+ run: uv sync --locked
82
+
83
+ - name: Download coverage data
84
+ uses: actions/download-artifact@v4
85
+ with:
86
+ pattern: coverage-*
87
+ merge-multiple: true
88
+
89
+ - name: Combine coverage data
90
+ run: uv run --no-sync coverage combine
91
+
92
+ - name: Coverage report
93
+ run: uv run --no-sync coverage report
94
+
95
+ lint:
96
+ runs-on: ubuntu-latest
97
+ steps:
98
+ - uses: actions/checkout@v4
99
+
100
+ - name: Install uv
101
+ uses: astral-sh/setup-uv@v5
102
+ with:
103
+ enable-cache: true
104
+
105
+ - name: Sync dependencies
106
+ run: uv sync --locked
107
+
108
+ - name: Lint
109
+ run: uv run --no-sync ruff check
110
+
111
+ - name: Check formatting
112
+ run: uv run --no-sync ruff format --check
113
+
114
+ - name: Type check
115
+ run: uv run --no-sync ty check
116
+
117
+ wheels:
118
+ runs-on: ${{ matrix.os }}
119
+ strategy:
120
+ fail-fast: false
121
+ matrix:
122
+ os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
123
+ steps:
124
+ - uses: actions/checkout@v4
125
+
126
+ - name: Build wheels
127
+ uses: pypa/cibuildwheel@v3.1.4
128
+ with:
129
+ output-dir: wheelhouse
130
+
131
+ - name: Upload wheels
132
+ uses: actions/upload-artifact@v4
133
+ with:
134
+ name: wheels-${{ matrix.os }}
135
+ path: wheelhouse/*.whl
136
+
137
+ sdist:
138
+ runs-on: ubuntu-latest
139
+ steps:
140
+ - uses: actions/checkout@v4
141
+
142
+ - name: Install uv
143
+ uses: astral-sh/setup-uv@v5
144
+ with:
145
+ enable-cache: true
146
+
147
+ - name: Build sdist
148
+ run: uv build --no-config --sdist -o dist
149
+
150
+ - name: Upload sdist
151
+ uses: actions/upload-artifact@v4
152
+ with:
153
+ name: sdist
154
+ path: dist/*.tar.gz
155
+
156
+ publish:
157
+ needs: [test, lint, wheels, sdist]
158
+ if: >-
159
+ startsWith(github.ref, 'refs/tags/v') ||
160
+ (github.event_name == 'workflow_dispatch' && inputs.release && github.ref == 'refs/heads/main')
161
+ runs-on: ubuntu-latest
162
+ environment: pypi
163
+ permissions:
164
+ contents: write
165
+ id-token: write
166
+ steps:
167
+ - uses: actions/checkout@v4
168
+
169
+ # The version in `pyproject.toml` names the release. A pushed tag has to match it, so a
170
+ # mistyped tag cannot publish another version.
171
+ - name: Name the tag
172
+ id: tag
173
+ run: |
174
+ version=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
175
+ tag="v$version"
176
+ if [ "$GITHUB_REF_TYPE" = tag ] && [ "$GITHUB_REF_NAME" != "$tag" ]; then
177
+ echo "The tag $GITHUB_REF_NAME does not match version $version of pyproject.toml." >&2
178
+ exit 1
179
+ fi
180
+ echo "name=$tag" >> "$GITHUB_OUTPUT"
181
+
182
+ - name: Download wheels
183
+ uses: actions/download-artifact@v4
184
+ with:
185
+ pattern: wheels-*
186
+ path: dist
187
+ merge-multiple: true
188
+
189
+ - name: Download sdist
190
+ uses: actions/download-artifact@v4
191
+ with:
192
+ name: sdist
193
+ path: dist
194
+
195
+ - name: Publish to PyPI
196
+ uses: pypa/gh-action-pypi-publish@release/v1
197
+ with:
198
+ packages-dir: dist
199
+
200
+ # A release made by hand from main gets its tag here, once PyPI has the version.
201
+ - name: Create the release
202
+ env:
203
+ GH_TOKEN: ${{ github.token }}
204
+ TAG: ${{ steps.tag.outputs.name }}
205
+ run: |
206
+ gh release create "$TAG" --target "$GITHUB_SHA" --title "$TAG" \
207
+ --notes "xipopt ${TAG#v}."
@@ -0,0 +1,55 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "docs/**"
8
+ - "src/**"
9
+ - "zensical.toml"
10
+ - "pyproject.toml"
11
+ - ".github/workflows/docs.yml"
12
+ workflow_dispatch:
13
+
14
+ # Only one deployment runs at a time, and a newer push replaces a pending one.
15
+ concurrency:
16
+ group: pages
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ build:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v5
27
+ with:
28
+ enable-cache: true
29
+
30
+ # The API reference reads the source files, so the package itself is not installed.
31
+ - name: Sync dependencies
32
+ run: uv sync --only-group docs
33
+
34
+ - name: Build the documentation site
35
+ run: uv run --no-sync zensical build --strict
36
+
37
+ - name: Upload the site
38
+ uses: actions/upload-pages-artifact@v3
39
+ with:
40
+ path: site
41
+
42
+ deploy:
43
+ needs: build
44
+ runs-on: ubuntu-latest
45
+ permissions:
46
+ # Deploying to Pages needs write access to Pages and an OIDC token.
47
+ pages: write
48
+ id-token: write
49
+ environment:
50
+ name: github-pages
51
+ url: ${{ steps.deployment.outputs.page_url }}
52
+ steps:
53
+ - name: Deploy to GitHub Pages
54
+ id: deployment
55
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,28 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ wheelhouse/
8
+ *.egg-info
9
+
10
+ # Virtual environments
11
+ .venv*
12
+
13
+ # Documentation build output
14
+ site/
15
+
16
+ # Test and benchmark output
17
+ .benchmarks/
18
+ .coverage
19
+ .coverage.*
20
+ coverage.xml
21
+ .hypothesis/
22
+
23
+ # Meson extracts the subprojects from the lock file on configure, so only the lock is tracked.
24
+ /subprojects/*
25
+ !/subprojects/meson-jll.lock.wrap
26
+
27
+ # Coverage builds copy the generated C files next to the Cython sources.
28
+ /src/xipopt/*.c
@@ -0,0 +1 @@
1
+ 3.12
xipopt-0.1.0/AGENTS.md ADDED
@@ -0,0 +1,8 @@
1
+ Use match statements with unpacking where it makes sense (instead of if-else chains).
2
+ Try to avoid inheritance where possible, prefer defining Protocols and separate implementations (structural typing). You can reuse behaviors by defining functions.
3
+ Make sure all code is properly typed and typechecks with ty.
4
+ For Cython code, use the pure Python interface, and add accurate type stubs for exported functions.
5
+ Callbacks that Ipopt calls run without the GIL, so they must not allocate Python objects or raise. The only exception is the iteration observer, which takes the GIL.
6
+ The programs run in 64-bit floats. Lower and trace inside `jax.enable_x64(True)` and never rely on the global setting of the caller.
7
+ Bump the pin on `cyxla` in `pyproject.toml` whenever `ABI_VERSION` in `cyxla` changes.
8
+ Keep the runtime portable to Linux, macOS and Windows. Operating system calls go through `src/xipopt/_platform.h`.
@@ -0,0 +1,135 @@
1
+ **HIPPOCRATIC LICENSE**
2
+
3
+ **Version 3.0, October 2021**
4
+
5
+ <https://firstdonoharm.dev/version/3/0/bds-eco-ffd-law-mil-sv.md>
6
+
7
+ **TERMS AND CONDITIONS**
8
+
9
+ TERMS AND CONDITIONS FOR USE, COPY, MODIFICATION, PREPARATION OF DERIVATIVE WORK, REPRODUCTION, AND DISTRIBUTION:
10
+
11
+ **[1.](#1) DEFINITIONS:**
12
+
13
+ _This section defines certain terms used throughout this license agreement._
14
+
15
+ [1.1.](#1.1) “License” means the terms and conditions, as stated herein, for use, copy, modification, preparation of derivative work, reproduction, and distribution of Software (as defined below).
16
+
17
+ [1.2.](#1.2) “Licensor” means the copyright and/or patent owner or entity authorized by the copyright and/or patent owner that is granting the License.
18
+
19
+ [1.3.](#1.3) “Licensee” means the individual or entity exercising permissions granted by this License, including the use, copy, modification, preparation of derivative work, reproduction, and distribution of Software (as defined below).
20
+
21
+ [1.4.](#1.4) “Software” means any copyrighted work, including but not limited to software code, authored by Licensor and made available under this License.
22
+
23
+ [1.5.](#1.5) “Supply Chain” means the sequence of processes involved in the production and/or distribution of a commodity, good, or service offered by the Licensee.
24
+
25
+ [1.6.](#1.6) “Supply Chain Impacted Party” or “Supply Chain Impacted Parties” means any person(s) directly impacted by any of Licensee’s Supply Chain, including the practices of all persons or entities within the Supply Chain prior to a good or service reaching the Licensee.
26
+
27
+ [1.7.](#1.7) “Duty of Care” is defined by its use in tort law, delict law, and/or similar bodies of law closely related to tort and/or delict law, including without limitation, a requirement to act with the watchfulness, attention, caution, and prudence that a reasonable person in the same or similar circumstances would use towards any Supply Chain Impacted Party.
28
+
29
+ [1.8.](#1.8) “Worker” is defined to include any and all permanent, temporary, and agency workers, as well as piece-rate, salaried, hourly paid, legal young (minors), part-time, night, and migrant workers.
30
+
31
+ **[2.](#2) INTELLECTUAL PROPERTY GRANTS:**
32
+
33
+ _This section identifies intellectual property rights granted to a Licensee_.
34
+
35
+ [2.1.](#2.1) _Grant of Copyright License_: Subject to the terms and conditions of this License, Licensor hereby grants to Licensee a worldwide, non-exclusive, no-charge, royalty-free copyright license to use, copy, modify, prepare derivative work, reproduce, or distribute the Software, Licensor authored modified software, or other work derived from the Software.
36
+
37
+ [2.2.](#2.2) _Grant of Patent License_: Subject to the terms and conditions of this License, Licensor hereby grants Licensee a worldwide, non-exclusive, no-charge, royalty-free patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer Software.
38
+
39
+ **[3.](#3) ETHICAL STANDARDS:**
40
+
41
+ _This section lists conditions the Licensee must comply with in order to have rights under this License._
42
+
43
+ The rights granted to the Licensee by this License are expressly made subject to the Licensee’s ongoing compliance with the following conditions:
44
+
45
+ * [3.1.](#3.1) The Licensee SHALL NOT, whether directly or indirectly, through agents or assigns:
46
+
47
+ * [3.1.1.](#3.1.1) Infringe upon any person’s right to life or security of person, engage in extrajudicial killings, or commit murder, without lawful cause (See Article 3, _United Nations Universal Declaration of Human Rights_; Article 6, _International Covenant on Civil and Political Rights_)
48
+ * [3.1.2.](#3.1.2) Hold any person in slavery, servitude, or forced labor (See Article 4, _United Nations Universal Declaration of Human Rights_; Article 8, _International Covenant on Civil and Political Rights_);
49
+ * [3.1.3.](#3.1.3) Contribute to the institution of slavery, slave trading, forced labor, or unlawful child labor (See Article 4, _United Nations Universal Declaration of Human Rights_; Article 8, _International Covenant on Civil and Political Rights_);
50
+ * [3.1.4.](#3.1.4) Torture or subject any person to cruel, inhumane, or degrading treatment or punishment (See Article 5, _United Nations Universal Declaration of Human Rights_; Article 7, _International Covenant on Civil and Political Rights_);
51
+ * [3.1.5.](#3.1.5) Discriminate on the basis of sex, gender, sexual orientation, race, ethnicity, nationality, religion, caste, age, medical disability or impairment, and/or any other like circumstances (See Article 7, _United Nations Universal Declaration of Human Rights_; Article 2, _International Covenant on Economic, Social and Cultural Rights_; Article 26, _International Covenant on Civil and Political Rights_);
52
+ * [3.1.6.](#3.1.6) Prevent any person from exercising his/her/their right to seek an effective remedy by a competent court or national tribunal (including domestic judicial systems, international courts, arbitration bodies, and other adjudicating bodies) for actions violating the fundamental rights granted to him/her/them by applicable constitutions, applicable laws, or by this License (See Article 8, _United Nations Universal Declaration of Human Rights_; Articles 9 and 14, _International Covenant on Civil and Political Rights_);
53
+ * [3.1.7.](#3.1.7) Subject any person to arbitrary arrest, detention, or exile (See Article 9, _United Nations Universal Declaration of Human Rights_; Article 9, _International Covenant on Civil and Political Rights_);
54
+ * [3.1.8.](#3.1.8) Subject any person to arbitrary interference with a person’s privacy, family, home, or correspondence without the express written consent of the person (See Article 12, _United Nations Universal Declaration of Human Rights_; Article 17, _International Covenant on Civil and Political Rights_);
55
+ * [3.1.9.](#3.1.9) Arbitrarily deprive any person of his/her/their property (See Article 17, _United Nations Universal Declaration of Human Rights_);
56
+ * [3.1.10.](#3.1.10) Forcibly remove indigenous peoples from their lands or territories or take any action with the aim or effect of dispossessing indigenous peoples from their lands, territories, or resources, including without limitation the intellectual property or traditional knowledge of indigenous peoples, without the free, prior, and informed consent of indigenous peoples concerned (See Articles 8 and 10, _United Nations Declaration on the Rights of Indigenous Peoples_);
57
+ * [3.1.11.](#3.1.11) _Fossil Fuel Divestment_: Be an individual or entity, or a representative, agent, affiliate, successor, attorney, or assign of an individual or entity, on the [FFI Solutions Carbon Underground 200 list](https://www.ffisolutions.com/research-analytics-index-solutions/research-screening/the-carbon-underground-200/?cn-reloaded=1);
58
+ * [3.1.12.](#3.1.12) _Ecocide_: Commit ecocide:
59
+
60
+ * [3.1.12.1.](#3.1.12.1) For the purpose of this section, “ecocide” means unlawful or wanton acts committed with knowledge that there is a substantial likelihood of severe and either widespread or long-term damage to the environment being caused by those acts;
61
+ * [3.1.12.2.](#3.1.12.2) For the purpose of further defining ecocide and the terms contained in the previous paragraph:
62
+
63
+ * [3.1.12.2.1.](#3.1.12.2.1) “Wanton” means with reckless disregard for damage which would be clearly excessive in relation to the social and economic benefits anticipated;
64
+ * [3.1.12.2.2.](#3.1.12.2.2) “Severe” means damage which involves very serious adverse changes, disruption, or harm to any element of the environment, including grave impacts on human life or natural, cultural, or economic resources;
65
+ * [3.1.12.2.3.](#3.1.12.2.3) “Widespread” means damage which extends beyond a limited geographic area, crosses state boundaries, or is suffered by an entire ecosystem or species or a large number of human beings;
66
+ * [3.1.12.2.4.](#3.1.12.2.4) “Long-term” means damage which is irreversible or which cannot be redressed through natural recovery within a reasonable period of time; and
67
+ * [3.1.12.2.5.](#3.1.12.2.5) “Environment” means the earth, its biosphere, cryosphere, lithosphere, hydrosphere, and atmosphere, as well as outer space
68
+ (See Section II, _Independent Expert Panel for the Legal Definition of Ecocide_, Stop Ecocide Foundation and the Promise Institute for Human Rights at UCLA School of Law, June 2021);
69
+ * [3.1.13.](#3.1.13) _Boycott / Divestment / Sanctions_: Be an individual or entity, or a representative, agent, affiliate, successor, attorney, or assign of an individual or entity, identified by the Boycott, Divestment, Sanctions (“BDS”) movement on its website (<https://bdsmovement.net/> and <https://bdsmovement.net/get-involved/what-to-boycott>) as a target for boycott;
70
+ * [3.1.14.](#3.1.14) _Mass Surveillance_: Be a government agency or multinational corporation, or a representative, agent, affiliate, successor, attorney, or assign of a government or multinational corporation, which participates in mass surveillance programs;
71
+ * [3.1.15.](#3.1.15) _Military Activities_: Be an entity or a representative, agent, affiliate, successor, attorney, or assign of an entity which conducts military activities;
72
+ * [3.1.16.](#3.1.16) _Law Enforcement_: Be an individual or entity, or a representative, agent, affiliate, successor, attorney, or assign of an individual or entity, that provides good or services to, or otherwise enters into any commercial contracts with, any local, state, or federal law enforcement agency;
73
+ * [3.1.17.](#3.1.17) Interfere with Workers’ free exercise of the right to organize and associate (See Article 20, United Nations Universal Declaration of Human Rights; C087 - Freedom of Association and Protection of the Right to Organise Convention, 1948 (No. 87), International Labour Organization; Article 8, International Covenant on Economic, Social and Cultural Rights); and
74
+ * [3.1.18.](#3.1.18) Harm the environment in a manner inconsistent with local, state, national, or international law.
75
+ * [3.2.](#3.2) The Licensee SHALL:
76
+
77
+ * [3.2.1.](#3.2.1) Provide equal pay for equal work where the performance of such work requires equal skill, effort, and responsibility, and which are performed under similar working conditions, except where such payment is made pursuant to:
78
+
79
+ * [3.2.1.1.](#3.2.1.1) A seniority system;
80
+ * [3.2.1.2.](#3.2.1.2) A merit system;
81
+ * [3.2.1.3.](#3.2.1.3) A system which measures earnings by quantity or quality of production; or
82
+ * [3.2.1.4.](#3.2.1.4) A differential based on any other factor other than sex, gender, sexual orientation, race, ethnicity, nationality, religion, caste, age, medical disability or impairment, and/or any other like circumstances (See 29 U.S.C.A. § 206(d)(1); Article 23, _United Nations Universal Declaration of Human Rights_; Article 7, _International Covenant on Economic, Social and Cultural Rights_; Article 26, _International Covenant on Civil and Political Rights_); and
83
+ * [3.2.2.](#3.2.2) Allow for reasonable limitation of working hours and periodic holidays with pay (See Article 24, _United Nations Universal Declaration of Human Rights_; Article 7, _International Covenant on Economic, Social and Cultural Rights_).
84
+
85
+ **[4.](#4) SUPPLY CHAIN IMPACTED PARTIES:**
86
+
87
+ _This section identifies additional individuals or entities that a Licensee could harm as a result of violating the Ethical Standards section, the condition that the Licensee must voluntarily accept a Duty of Care for those individuals or entities, and the right to a private right of action that those individuals or entities possess as a result of violations of the Ethical Standards section._
88
+
89
+ [4.1.](#4.1) In addition to the above Ethical Standards, Licensee voluntarily accepts a Duty of Care for Supply Chain Impacted Parties of this License, including individuals and communities impacted by violations of the Ethical Standards. The Duty of Care is breached when a provision within the Ethical Standards section is violated by a Licensee, one of its successors or assigns, or by an individual or entity that exists within the Supply Chain prior to a good or service reaching the Licensee.
90
+
91
+ [4.2.](#4.2) Breaches of the Duty of Care, as stated within this section, shall create a private right of action, allowing any Supply Chain Impacted Party harmed by the Licensee to take legal action against the Licensee in accordance with applicable negligence laws, whether they be in tort law, delict law, and/or similar bodies of law closely related to tort and/or delict law, regardless if Licensee is directly responsible for the harms suffered by a Supply Chain Impacted Party. Nothing in this section shall be interpreted to include acts committed by individuals outside of the scope of his/her/their employment.
92
+
93
+ [5.](#5) **NOTICE:** _This section explains when a Licensee must notify others of the License._
94
+
95
+ [5.1.](#5.1) _Distribution of Notice_: Licensee must ensure that everyone who receives a copy of or uses any part of Software from Licensee, with or without changes, also receives the License and the copyright notice included with Software (and if included by the Licensor, patent, trademark, and attribution notice). Licensee must ensure that License is prominently displayed so that any individual or entity seeking to download, copy, use, or otherwise receive any part of Software from Licensee is notified of this License and its terms and conditions. Licensee must cause any modified versions of the Software to carry prominent notices stating that Licensee changed the Software.
96
+
97
+ [5.2.](#5.2) _Modified Software_: Licensee is free to create modifications of the Software and distribute only the modified portion created by Licensee, however, any derivative work stemming from the Software or its code must be distributed pursuant to this License, including this Notice provision.
98
+
99
+ [5.3.](#5.3) _Recipients as Licensees_: Any individual or entity that uses, copies, modifies, reproduces, distributes, or prepares derivative work based upon the Software, all or part of the Software’s code, or a derivative work developed by using the Software, including a portion of its code, is a Licensee as defined above and is subject to the terms and conditions of this License.
100
+
101
+ **[6.](#6) REPRESENTATIONS AND WARRANTIES:**
102
+
103
+ [6.1.](#6.1) _Disclaimer of Warranty_: TO THE FULL EXTENT ALLOWED BY LAW, THIS SOFTWARE COMES “AS IS,” WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, AND LICENSOR SHALL NOT BE LIABLE TO ANY PERSON OR ENTITY FOR ANY DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THIS LICENSE, UNDER ANY LEGAL CLAIM.
104
+
105
+ [6.2.](#6.2) _Limitation of Liability_: LICENSEE SHALL HOLD LICENSOR HARMLESS AGAINST ANY AND ALL CLAIMS, DEBTS, DUES, LIABILITIES, LIENS, CAUSES OF ACTION, DEMANDS, OBLIGATIONS, DISPUTES, DAMAGES, LOSSES, EXPENSES, ATTORNEYS’ FEES, COSTS, LIABILITIES, AND ALL OTHER CLAIMS OF EVERY KIND AND NATURE WHATSOEVER, WHETHER KNOWN OR UNKNOWN, ANTICIPATED OR UNANTICIPATED, FORESEEN OR UNFORESEEN, ACCRUED OR UNACCRUED, DISCLOSED OR UNDISCLOSED, ARISING OUT OF OR RELATING TO LICENSEE’S USE OF THE SOFTWARE. NOTHING IN THIS SECTION SHOULD BE INTERPRETED TO REQUIRE LICENSEE TO INDEMNIFY LICENSOR, NOR REQUIRE LICENSOR TO INDEMNIFY LICENSEE.
106
+
107
+ **[7.](#7) TERMINATION**
108
+
109
+ [7.1.](#7.1) _Violations of Ethical Standards or Breaching Duty of Care_: If Licensee violates the Ethical Standards section or Licensee, or any other person or entity within the Supply Chain prior to a good or service reaching the Licensee, breaches its Duty of Care to Supply Chain Impacted Parties, Licensee must remedy the violation or harm caused by Licensee within 30 days of being notified of the violation or harm. If Licensee fails to remedy the violation or harm within 30 days, all rights in the Software granted to Licensee by License will be null and void as between Licensor and Licensee.
110
+
111
+ [7.2.](#7.2) _Failure of Notice_: If any person or entity notifies Licensee in writing that Licensee has not complied with the Notice section of this License, Licensee can keep this License by taking all practical steps to comply within 30 days after the notice of noncompliance. If Licensee does not do so, Licensee’s License (and all rights licensed hereunder) will end immediately.
112
+
113
+ [7.3.](#7.3) _Judicial Findings_: In the event Licensee is found by a civil, criminal, administrative, or other court of competent jurisdiction, or some other adjudicating body with legal authority, to have committed actions which are in violation of the Ethical Standards or Supply Chain Impacted Party sections of this License, all rights granted to Licensee by this License will terminate immediately.
114
+
115
+ [7.4.](#7.4) _Patent Litigation_: If Licensee institutes patent litigation against any entity (including a cross-claim or counterclaim in a suit) alleging that the Software, all or part of the Software’s code, or a derivative work developed using the Software, including a portion of its code, constitutes direct or contributory patent infringement, then any patent license, along with all other rights, granted to Licensee under this License will terminate as of the date such litigation is filed.
116
+
117
+ [7.5.](#7.5) _Additional Remedies_: Termination of the License by failing to remedy harms in no way prevents Licensor or Supply Chain Impacted Party from seeking appropriate remedies at law or in equity.
118
+
119
+ **[8.](#8) MISCELLANEOUS:**
120
+
121
+ [8.1.](#8.1) _Conditions_: Sections 3, 4.1, 5.1, 5.2, 7.1, 7.2, 7.3, and 7.4 are conditions of the rights granted to Licensee in the License.
122
+
123
+ [8.2.](#8.2) _Equitable Relief_: Licensor and any Supply Chain Impacted Party shall be entitled to equitable relief, including injunctive relief or specific performance of the terms hereof, in addition to any other remedy to which they are entitled at law or in equity.
124
+
125
+ [8.3.](#8.3) _Severability_: If any term or provision of this License is determined to be invalid, illegal, or unenforceable by a court of competent jurisdiction, any such determination of invalidity, illegality, or unenforceability shall not affect any other term or provision of this License or invalidate or render unenforceable such term or provision in any other jurisdiction. If the determination of invalidity, illegality, or unenforceability by a court of competent jurisdiction pertains to the terms or provisions contained in the Ethical Standards section of this License, all rights in the Software granted to Licensee shall be deemed null and void as between Licensor and Licensee.
126
+
127
+ [8.4.](#8.4) _Section Titles_: Section titles are solely written for organizational purposes and should not be used to interpret the language within each section.
128
+
129
+ [8.5.](#8.5) _Citations_: Citations are solely written to provide context for the source of the provisions in the Ethical Standards.
130
+
131
+ [8.6.](#8.6) _Section Summaries_: Some sections have a brief _italicized description_ which is provided for the sole purpose of briefly describing the section and should not be used to interpret the terms of the License.
132
+
133
+ [8.7.](#8.7) _Entire License_: This is the entire License between the Licensor and Licensee with respect to the claims released herein and that the consideration stated herein is the only consideration or compensation to be paid or exchanged between them for this License. This License cannot be modified or amended except in a writing signed by Licensor and Licensee.
134
+
135
+ [8.8.](#8.8) _Successors and Assigns_: This License shall be binding upon and inure to the benefit of the Licensor’s and Licensee’s respective heirs, successors, and assigns.
xipopt-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: xipopt
3
+ Version: 0.1.0
4
+ Summary: Ipopt for JAX functions, called through the PJRT C API
5
+ Author-Email: Nardi Lam <mail@nardilam.nl>
6
+ License-File: LICENSE.md
7
+ License-File: licenses/ASL-LICENSE.txt
8
+ License-File: licenses/CompilerSupportLibraries-GPL-3.0+
9
+ License-File: licenses/Hwloc-COPYING
10
+ License-File: licenses/Ipopt-LICENSE
11
+ License-File: licenses/Libiconv-COPYING
12
+ License-File: licenses/METIS-LICENSE-2.0.txt
13
+ License-File: licenses/MUMPS_seq-LICENSE
14
+ License-File: licenses/OpenBLAS32-LICENSE
15
+ License-File: licenses/README.md
16
+ License-File: licenses/SPRAL-LICENCE
17
+ License-File: licenses/XML2-Copyright
18
+ License-File: licenses/Xorg_libpciaccess-COPYING
19
+ License-File: licenses/Zlib-README
20
+ License-File: licenses/libblastrampoline-LICENSE.md
21
+ Project-URL: Source, https://github.com/nardi/xipopt
22
+ Project-URL: Documentation, https://nardi.github.io/xipopt/
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: asdex>=0.5.1
25
+ Requires-Dist: cyxla[cpu]<0.2,>=0.1.1
26
+ Requires-Dist: jax<0.12,>=0.10
27
+ Requires-Dist: jaxtyping>=0.2
28
+ Requires-Dist: numpy>=1.26
29
+ Description-Content-Type: text/markdown
30
+
31
+ # xipopt
32
+
33
+ xipopt solves nonlinear optimization problems written as JAX functions with
34
+ [Ipopt](https://coin-or.github.io/Ipopt/).
35
+
36
+ A problem is a pytree of variables, an objective and constraints, all plain JAX
37
+ functions. xipopt compiles the function values and their derivatives into programs for
38
+ the [PJRT C API](https://openxla.org/xla/pjrt/pjrt_integration) through
39
+ [cyxla](https://nardi.github.io/cyxla/). Ipopt's callbacks execute those programs
40
+ directly from Cython, so a solve never enters the Python interpreter. The API follows
41
+ [JAX-CIP](https://nardi.github.io/jax-cip/).
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install xipopt
47
+ ```
48
+
49
+ The wheels contain Ipopt with the MUMPS and SPRAL linear solvers, so nothing else needs
50
+ installing. They exist for Linux, macOS on Apple silicon and Windows, on Python 3.11 and
51
+ later.
52
+
53
+ ## Example
54
+
55
+ This is problem 71 of Hock and Schittkowski, which the Ipopt documentation uses as its
56
+ example.
57
+
58
+ <!-- name: test_readme -->
59
+ ```python
60
+ import jax.numpy as jnp
61
+
62
+ import xipopt as xip
63
+
64
+
65
+ def objective(x, params):
66
+ return x[0] * x[3] * (x[0] + x[1] + x[2]) + x[2]
67
+
68
+
69
+ problem = xip.Problem(
70
+ variables=xip.Variable(lower=1.0, upper=5.0, shape=(4,)),
71
+ objective=objective,
72
+ constraints=(
73
+ xip.Constraint(lambda x, params: jnp.prod(x), lower=25.0),
74
+ xip.Constraint(lambda x, params: jnp.sum(x**2), lower=40.0, upper=40.0),
75
+ ),
76
+ )
77
+ solution = xip.solve(problem, jnp.array([1.0, 5.0, 5.0, 1.0]))
78
+ print(solution.status, solution.objective, solution.x)
79
+ ```
80
+
81
+ <!-- name: test_readme -->
82
+ ```python
83
+ assert solution.status is xip.Status.SOLVE_SUCCEEDED
84
+ assert abs(solution.objective - 17.0140173) < 1e-6
85
+ ```
86
+
87
+ ## Documentation
88
+
89
+ The [documentation](https://nardi.github.io/xipopt/) has a user guide, an explanation of
90
+ the design and the API reference.
91
+
92
+ ## License
93
+
94
+ [Hippocratic License 3.0](LICENSE.md). The wheels bundle libraries under their own
95
+ licenses, which [licenses](licenses) lists.
xipopt-0.1.0/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # xipopt
2
+
3
+ xipopt solves nonlinear optimization problems written as JAX functions with
4
+ [Ipopt](https://coin-or.github.io/Ipopt/).
5
+
6
+ A problem is a pytree of variables, an objective and constraints, all plain JAX
7
+ functions. xipopt compiles the function values and their derivatives into programs for
8
+ the [PJRT C API](https://openxla.org/xla/pjrt/pjrt_integration) through
9
+ [cyxla](https://nardi.github.io/cyxla/). Ipopt's callbacks execute those programs
10
+ directly from Cython, so a solve never enters the Python interpreter. The API follows
11
+ [JAX-CIP](https://nardi.github.io/jax-cip/).
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install xipopt
17
+ ```
18
+
19
+ The wheels contain Ipopt with the MUMPS and SPRAL linear solvers, so nothing else needs
20
+ installing. They exist for Linux, macOS on Apple silicon and Windows, on Python 3.11 and
21
+ later.
22
+
23
+ ## Example
24
+
25
+ This is problem 71 of Hock and Schittkowski, which the Ipopt documentation uses as its
26
+ example.
27
+
28
+ <!-- name: test_readme -->
29
+ ```python
30
+ import jax.numpy as jnp
31
+
32
+ import xipopt as xip
33
+
34
+
35
+ def objective(x, params):
36
+ return x[0] * x[3] * (x[0] + x[1] + x[2]) + x[2]
37
+
38
+
39
+ problem = xip.Problem(
40
+ variables=xip.Variable(lower=1.0, upper=5.0, shape=(4,)),
41
+ objective=objective,
42
+ constraints=(
43
+ xip.Constraint(lambda x, params: jnp.prod(x), lower=25.0),
44
+ xip.Constraint(lambda x, params: jnp.sum(x**2), lower=40.0, upper=40.0),
45
+ ),
46
+ )
47
+ solution = xip.solve(problem, jnp.array([1.0, 5.0, 5.0, 1.0]))
48
+ print(solution.status, solution.objective, solution.x)
49
+ ```
50
+
51
+ <!-- name: test_readme -->
52
+ ```python
53
+ assert solution.status is xip.Status.SOLVE_SUCCEEDED
54
+ assert abs(solution.objective - 17.0140173) < 1e-6
55
+ ```
56
+
57
+ ## Documentation
58
+
59
+ The [documentation](https://nardi.github.io/xipopt/) has a user guide, an explanation of
60
+ the design and the API reference.
61
+
62
+ ## License
63
+
64
+ [Hippocratic License 3.0](LICENSE.md). The wheels bundle libraries under their own
65
+ licenses, which [licenses](licenses) lists.