pyomo-ripopt 0.7.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.
- pyomo_ripopt-0.7.0/PKG-INFO +70 -0
- pyomo_ripopt-0.7.0/README.md +52 -0
- pyomo_ripopt-0.7.0/pyomo_ripopt/__init__.py +10 -0
- pyomo_ripopt-0.7.0/pyomo_ripopt/ripopt_solver.py +43 -0
- pyomo_ripopt-0.7.0/pyomo_ripopt.egg-info/PKG-INFO +70 -0
- pyomo_ripopt-0.7.0/pyomo_ripopt.egg-info/SOURCES.txt +11 -0
- pyomo_ripopt-0.7.0/pyomo_ripopt.egg-info/dependency_links.txt +1 -0
- pyomo_ripopt-0.7.0/pyomo_ripopt.egg-info/entry_points.txt +2 -0
- pyomo_ripopt-0.7.0/pyomo_ripopt.egg-info/requires.txt +1 -0
- pyomo_ripopt-0.7.0/pyomo_ripopt.egg-info/top_level.txt +1 -0
- pyomo_ripopt-0.7.0/pyproject.toml +34 -0
- pyomo_ripopt-0.7.0/setup.cfg +4 -0
- pyomo_ripopt-0.7.0/setup.py +17 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyomo-ripopt
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: Pyomo solver plugin for the ripopt NLP solver
|
|
5
|
+
Author-email: John Kitchin <jkitchin@cmu.edu>
|
|
6
|
+
License: EPL-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/jkitchin/ripopt
|
|
8
|
+
Project-URL: Repository, https://github.com/jkitchin/ripopt
|
|
9
|
+
Project-URL: Issues, https://github.com/jkitchin/ripopt/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: pyomo>=6.0
|
|
18
|
+
|
|
19
|
+
# pyomo-ripopt
|
|
20
|
+
|
|
21
|
+
Pyomo solver plugin for [ripopt](https://github.com/jkitchin/ripopt), a fast interior-point NLP solver written in Rust.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install pyomo-ripopt
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This installs the solver plugin and a bundled `ripopt` binary. No Rust toolchain needed.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import pyomo_ripopt # registers the solver
|
|
35
|
+
from pyomo.environ import *
|
|
36
|
+
|
|
37
|
+
model = ConcreteModel()
|
|
38
|
+
model.x = Var(initialize=0.5)
|
|
39
|
+
model.obj = Objective(expr=(model.x - 2)**2)
|
|
40
|
+
|
|
41
|
+
solver = SolverFactory('ripopt')
|
|
42
|
+
result = solver.solve(model, tee=True)
|
|
43
|
+
print(f"x* = {value(model.x)}") # 2.0
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Solver Options
|
|
47
|
+
|
|
48
|
+
Pass options the same way as Ipopt:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
solver = SolverFactory('ripopt')
|
|
52
|
+
solver.options['max_iter'] = 1000
|
|
53
|
+
solver.options['tol'] = 1e-10
|
|
54
|
+
solver.options['print_level'] = 5
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Building from Source
|
|
58
|
+
|
|
59
|
+
If a pre-built wheel is not available for your platform:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cargo install ripopt # installs the ripopt binary
|
|
63
|
+
pip install pyomo-ripopt --no-binary :all:
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The solver will find the `ripopt` binary on your PATH.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
EPL-2.0, same as ripopt.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# pyomo-ripopt
|
|
2
|
+
|
|
3
|
+
Pyomo solver plugin for [ripopt](https://github.com/jkitchin/ripopt), a fast interior-point NLP solver written in Rust.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install pyomo-ripopt
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This installs the solver plugin and a bundled `ripopt` binary. No Rust toolchain needed.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
import pyomo_ripopt # registers the solver
|
|
17
|
+
from pyomo.environ import *
|
|
18
|
+
|
|
19
|
+
model = ConcreteModel()
|
|
20
|
+
model.x = Var(initialize=0.5)
|
|
21
|
+
model.obj = Objective(expr=(model.x - 2)**2)
|
|
22
|
+
|
|
23
|
+
solver = SolverFactory('ripopt')
|
|
24
|
+
result = solver.solve(model, tee=True)
|
|
25
|
+
print(f"x* = {value(model.x)}") # 2.0
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Solver Options
|
|
29
|
+
|
|
30
|
+
Pass options the same way as Ipopt:
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
solver = SolverFactory('ripopt')
|
|
34
|
+
solver.options['max_iter'] = 1000
|
|
35
|
+
solver.options['tol'] = 1e-10
|
|
36
|
+
solver.options['print_level'] = 5
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Building from Source
|
|
40
|
+
|
|
41
|
+
If a pre-built wheel is not available for your platform:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cargo install ripopt # installs the ripopt binary
|
|
45
|
+
pip install pyomo-ripopt --no-binary :all:
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The solver will find the `ripopt` binary on your PATH.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
EPL-2.0, same as ripopt.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Pyomo solver plugin for the ripopt NLP solver.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
import pyomo_ripopt # registers 'ripopt' with SolverFactory
|
|
5
|
+
from pyomo.environ import *
|
|
6
|
+
solver = SolverFactory('ripopt')
|
|
7
|
+
"""
|
|
8
|
+
from pyomo_ripopt.ripopt_solver import RIPOPT
|
|
9
|
+
|
|
10
|
+
__all__ = ["RIPOPT"]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Ripopt solver plugin for Pyomo.
|
|
2
|
+
|
|
3
|
+
Registers 'ripopt' with Pyomo's SolverFactory. Uses the AMPL NL/SOL interface,
|
|
4
|
+
identical to how Pyomo integrates with IPOPT.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
import pyomo_ripopt
|
|
8
|
+
from pyomo.environ import *
|
|
9
|
+
solver = SolverFactory('ripopt')
|
|
10
|
+
result = solver.solve(model)
|
|
11
|
+
"""
|
|
12
|
+
import os
|
|
13
|
+
import platform
|
|
14
|
+
import shutil
|
|
15
|
+
import sys
|
|
16
|
+
|
|
17
|
+
from pyomo.opt import SolverFactory
|
|
18
|
+
from pyomo.solvers.plugins.solvers.ASL import ASL
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _bundled_binary():
|
|
22
|
+
"""Find the ripopt binary bundled inside this wheel (if any)."""
|
|
23
|
+
name = "ripopt.exe" if platform.system() == "Windows" else "ripopt"
|
|
24
|
+
bin_dir = os.path.join(os.path.dirname(__file__), "bin")
|
|
25
|
+
path = os.path.join(bin_dir, name)
|
|
26
|
+
if os.path.isfile(path) and os.access(path, os.X_OK):
|
|
27
|
+
return path
|
|
28
|
+
return None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@SolverFactory.register("ripopt", doc="The ripopt NLP solver")
|
|
32
|
+
class RIPOPT(ASL):
|
|
33
|
+
"""Pyomo solver interface for ripopt via AMPL Solver Library protocol."""
|
|
34
|
+
|
|
35
|
+
def __init__(self, **kwds):
|
|
36
|
+
kwds["type"] = "ripopt"
|
|
37
|
+
super().__init__(**kwds)
|
|
38
|
+
self._metasolver = False
|
|
39
|
+
self.options.solver = "ripopt"
|
|
40
|
+
|
|
41
|
+
def _default_executable(self):
|
|
42
|
+
# Prefer the binary bundled in the wheel, fall back to PATH
|
|
43
|
+
return _bundled_binary() or shutil.which("ripopt")
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyomo-ripopt
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: Pyomo solver plugin for the ripopt NLP solver
|
|
5
|
+
Author-email: John Kitchin <jkitchin@cmu.edu>
|
|
6
|
+
License: EPL-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/jkitchin/ripopt
|
|
8
|
+
Project-URL: Repository, https://github.com/jkitchin/ripopt
|
|
9
|
+
Project-URL: Issues, https://github.com/jkitchin/ripopt/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: pyomo>=6.0
|
|
18
|
+
|
|
19
|
+
# pyomo-ripopt
|
|
20
|
+
|
|
21
|
+
Pyomo solver plugin for [ripopt](https://github.com/jkitchin/ripopt), a fast interior-point NLP solver written in Rust.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install pyomo-ripopt
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This installs the solver plugin and a bundled `ripopt` binary. No Rust toolchain needed.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import pyomo_ripopt # registers the solver
|
|
35
|
+
from pyomo.environ import *
|
|
36
|
+
|
|
37
|
+
model = ConcreteModel()
|
|
38
|
+
model.x = Var(initialize=0.5)
|
|
39
|
+
model.obj = Objective(expr=(model.x - 2)**2)
|
|
40
|
+
|
|
41
|
+
solver = SolverFactory('ripopt')
|
|
42
|
+
result = solver.solve(model, tee=True)
|
|
43
|
+
print(f"x* = {value(model.x)}") # 2.0
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Solver Options
|
|
47
|
+
|
|
48
|
+
Pass options the same way as Ipopt:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
solver = SolverFactory('ripopt')
|
|
52
|
+
solver.options['max_iter'] = 1000
|
|
53
|
+
solver.options['tol'] = 1e-10
|
|
54
|
+
solver.options['print_level'] = 5
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Building from Source
|
|
58
|
+
|
|
59
|
+
If a pre-built wheel is not available for your platform:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cargo install ripopt # installs the ripopt binary
|
|
63
|
+
pip install pyomo-ripopt --no-binary :all:
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The solver will find the `ripopt` binary on your PATH.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
EPL-2.0, same as ripopt.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
setup.py
|
|
4
|
+
pyomo_ripopt/__init__.py
|
|
5
|
+
pyomo_ripopt/ripopt_solver.py
|
|
6
|
+
pyomo_ripopt.egg-info/PKG-INFO
|
|
7
|
+
pyomo_ripopt.egg-info/SOURCES.txt
|
|
8
|
+
pyomo_ripopt.egg-info/dependency_links.txt
|
|
9
|
+
pyomo_ripopt.egg-info/entry_points.txt
|
|
10
|
+
pyomo_ripopt.egg-info/requires.txt
|
|
11
|
+
pyomo_ripopt.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyomo>=6.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyomo_ripopt
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyomo-ripopt"
|
|
7
|
+
version = "0.7.0"
|
|
8
|
+
description = "Pyomo solver plugin for the ripopt NLP solver"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "EPL-2.0"}
|
|
12
|
+
authors = [{name = "John Kitchin", email = "jkitchin@cmu.edu"}]
|
|
13
|
+
dependencies = ["pyomo>=6.0"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/jkitchin/ripopt"
|
|
24
|
+
Repository = "https://github.com/jkitchin/ripopt"
|
|
25
|
+
Issues = "https://github.com/jkitchin/ripopt/issues"
|
|
26
|
+
|
|
27
|
+
[project.entry-points."pyomo.solvers"]
|
|
28
|
+
ripopt = "pyomo_ripopt.ripopt_solver"
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.packages.find]
|
|
31
|
+
include = ["pyomo_ripopt*"]
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.package-data]
|
|
34
|
+
pyomo_ripopt = ["bin/*"]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Setup script that forces platform-specific wheels.
|
|
2
|
+
|
|
3
|
+
The ripopt binary bundled in pyomo_ripopt/bin/ is platform-specific,
|
|
4
|
+
so wheels must be tagged per-platform. The empty Extension trick
|
|
5
|
+
tells setuptools this is not a pure-Python package.
|
|
6
|
+
"""
|
|
7
|
+
from setuptools import setup
|
|
8
|
+
from setuptools.dist import Distribution
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class BinaryDistribution(Distribution):
|
|
12
|
+
"""Force platform-specific wheel (not pure Python)."""
|
|
13
|
+
def has_ext_modules(self):
|
|
14
|
+
return True
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
setup(distclass=BinaryDistribution)
|