This provides the SOLNP optimizaiton Algorithm.
Project description
See full documentation on http://solnp.readthedocs.io.
pysolnp - Nonlinear optimization with the augmented Lagrange method
Description
SOLNP solves the general nonlinear optimization problem on the form:
minimize f(x)
subject to
g(x) = e_x
l_h <= h(x) <= u_h
l_x < x < u_X
where f(x), g(x) and h(x) are smooth functions.
Compatibility
Precompiled Wheels are available for CPython:
- Windows: Python 3.6+
- Linux: Python 3.6+
- Mac OS: Python 3.6+
For other systems, or to have BLAS and LAPACK support, please build the wheels manually. Note: For best results, building it from source is recommended, as BLAS and LAPACK will make a difference.
Installation
Simply install the package through PyPi with:
pip install pysolnp
When compiling from source code you will need CMake.
See the README for the C++ code for details.
Usage
Below is the Box example, for the complete example see /python_examples/example_box.py.
import pysolnp
def f_objective_function(x):
return -1 * x[0] * x[1] * x[2]
def g_equality_constraint_function(x):
return [4 * x[0] * x[1] + 2 * x[1] * x[2] + 2 * x[2] * x[0]]
x_starting_point = [1.1, 1.1, 9.0]
x_l = [1.0, 1.0, 1.0]
x_u = [10.0, 10.0, 10.0]
e_x = [100]
result = pysolnp.solve(
obj_func=f_objective_function,
par_start_value=x_starting_point,
par_lower_limit=x_l,
par_upper_limit=x_u,
eq_func=g_equality_constraint_function,
eq_values=e_x)
result.solve_value
result.optimum
result.callbacks
result.converged
Output:
>>> result.solve_value
-48.11252206814995
>>> result.optimum
[2.8867750707815447, 2.8867750713194273, 5.773407748939196]
>>> result.callbacks
118
>>> result.converged
True
Parameters
The basic signature is:
solve(obj_func: function, par_start_value: List, par_lower_limit: object = None, par_upper_limit: object = None, eq_func: object = None, eq_values: object = None, ineq_func: object = None, ineq_lower_bounds: object = None, ineq_upper_bounds: object = None, rho: float = 1.0, max_major_iter: int = 10, max_minor_iter: int = 10, delta: float = 1e-05, tolerance: float = 0.0001, debug: bool = False) -> pysolnp.Result
Inputs:
Parameter | Type | Default value* | Description |
---|---|---|---|
obj_func | Callable[List, float] | - | The objective function f(x) to minimize. |
par_start_value | List | - | The starting parameter x_0. |
par_lower_limit | List | None | The parameter lower limit x_l. |
par_upper_limit | List | None | The parameter upper limit x_u. |
eq_func | Callable[List, float] | None | The equality constraint function h(x). |
eq_values | List | None | The equality constraint values e_x. |
ineq_func | Callable[List, float] | None | The inequality constraint function g(x). |
ineq_lower_bounds | List | None | The inequality constraint lower limit g_l. |
ineq_upper_bounds | List | None | The inequality constraint upper limit g_l. |
rho | float | 1.0 | Penalty weighting scalar for infeasability in the augmented objective function.** |
max_major_iter | int | 400 | Maximum number of outer iterations. |
max_minor_iter | int | 800 | Maximum number of inner iterations. |
delta | float | 1e-07 | Step-size for forward differentiation. |
tolerance | float | 1e-08 | Relative tolerance on optimality. |
debug | bool | False | If set to true some debug output will be printed. |
*Defaults for configuration parameters are based on the defaults for Rsolnp.
**Higher values means the solution will bring the solution into the feasible region with higher weight. Very high values might lead to numerical ill conditioning or slow down convergence.
Output:
The function returns the pysolnp.Result
with the below properties.
Property | Type | Description |
---|---|---|
solve_value | float | The value of the objective function at optimum f(x*). |
optimum | List[float] | A list of parameters for the optimum x*. |
callbacks | int | Number of callbacks done to find this optimum. |
converged | boolean | Indicates if the algorithm converged or not. |
hessian_matrix | List[List[float]] | The final Hessian Matrix used by pysolnp. |
Use-cases and Applications
- NMPC - Nonlinear model predictive controls-case studies using Matlab, REXYGEN and pysolnp NLP solver under Python environment by Štěpán Ožana. [NMPC Overhead Crane (PDF)] [GitHub Source Code] [Štěpán's Homepage]
Authors
- Krister S Jakobsson - Implementation - krister.s.jakobsson@gmail.com
License
This project is licensed under the Boost License - see the license file for details.
Acknowledgments
- Yinyu Ye - Publisher and mastermind behind the original SOLNP algorithm, Original Sources
- Alexios Ghalanos and Stefan Theussl - The people behind RSOLNP, Github repository
- Davis King - The mastermind behind Dlib, check out his blog! Blog
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pysolnp-2022.3.13-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18c970ec3ed41c1992b37cc48cd33493682216e8bc8c3d0d8217d2e67fb95a4b |
|
MD5 | 48e06532b634f222f1a103a78497c051 |
|
BLAKE2b-256 | b2a7df21be7f1d2f3ae3db47e5e72f13dccafaf8896d18918f4da264ee066f6a |
Hashes for pysolnp-2022.3.13-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e455ede1d415ce461a8b07d246b657bcef212b39d667f39e3f7676d99df3b56f |
|
MD5 | 5eb7571a7f50bf3e732baf6036db88c6 |
|
BLAKE2b-256 | b6692cb5ca292bfc4ebcb8c4414edf9baf3943cc107919f71dc875b4460539cb |
Hashes for pysolnp-2022.3.13-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a33b0c68b82f2f475538119dcaf4a64d48765b3f377a54c74d51e60a79106f77 |
|
MD5 | b3e01b8df238ccc0c12ded6e4ba24910 |
|
BLAKE2b-256 | 18ad1a54b6d1ae113e934f9ff3d8e16fda58aee0ae3f513d36fa7e2aedce955e |
Hashes for pysolnp-2022.3.13-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb6b25f8694e7f6dde2f222d7c35d67431227a214bea7559d2d376cb72dc8b94 |
|
MD5 | d672839fd26389e14dce98425b9d1e9d |
|
BLAKE2b-256 | 6f6d368cf573808f3270b95dfedf6f8a6611e933dac1455ca6b9a3e6a369692b |
Hashes for pysolnp-2022.3.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d5fd878b1806fd50f600b9e6e24d729cf14e87607acf7adf45c6dc9f8561789 |
|
MD5 | d0a1452d17005e6c614a88e647413ac4 |
|
BLAKE2b-256 | ef848c58fcbc899648de95f452698ba0acc3b7fc7e7998dae78ff7bc21746d69 |
Hashes for pysolnp-2022.3.13-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9721db4ea6f92209461bc62e78ec0cc27b42b011878370e94adf2ced3cf015fd |
|
MD5 | fd106d70851b53d2a9f33d5cfa8bc5c8 |
|
BLAKE2b-256 | 524e708e49e8e7395631f404b8c7cdc0b919150b2666301ec2b5be8396ace2bf |
Hashes for pysolnp-2022.3.13-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e460bf4a740fb71333ca7afea6593d79be4addb143566eaafe95920185c36225 |
|
MD5 | a349846382dae37903ac1486f73074c6 |
|
BLAKE2b-256 | 270bc75136905d8dd284e663d4e66fd0f65e650c1dd5897fe8c1b8a3500aca57 |
Hashes for pysolnp-2022.3.13-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62435f6e2e8779618364512e4221642c7abbae7186a194855cc8b36def82e132 |
|
MD5 | 056174142236b9c4b6e1523f91758128 |
|
BLAKE2b-256 | 772e24ba1e42767bd33307b1f8446ba6a13c5ca8e3f905f947733209dc6ac8a3 |
Hashes for pysolnp-2022.3.13-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 517f4edd94dc699bd04e19422b50eff2ba6e15ffb3d68fa3d24fe853b1f86aeb |
|
MD5 | 619ff89f6ae8e730f607c7cf3a81fda3 |
|
BLAKE2b-256 | 6a068d44e4ad72e5f92cdc31a5a476787db063ec53f68a4052f5c49d99b7a7d5 |
Hashes for pysolnp-2022.3.13-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2981feac1e76bb78099d005b258f0534ef862fac2bf818f734c4aa2a6cdf1ac0 |
|
MD5 | 820c0f67cefe31eaad73506958414247 |
|
BLAKE2b-256 | 6addc735e87cca510af59f40c90003a5a3402e43bba403ab3ad290a765f8b46d |
Hashes for pysolnp-2022.3.13-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 472c922a60f9d954ec460455ed7084b6b9de7bfcac7d8de818a4be0ae1c60289 |
|
MD5 | f83b053405f5e90ba9aa24f210222d3c |
|
BLAKE2b-256 | c1cb1e532eb7446b62e07ee8c92680235c49bc8b3f09e78c7ac3d55c46624e5d |
Hashes for pysolnp-2022.3.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f3a8d64735ed1d6624a365bb50000994f1e5ac3cc3f695a55e187e35274e42f |
|
MD5 | 40320bc803bd3e7aa81b4f2773841c03 |
|
BLAKE2b-256 | 31d0281c419c31ad7579b10450af536be5aee6512b564e8df613f46138f5e728 |
Hashes for pysolnp-2022.3.13-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2e6cc3c068ff39866bb8f2e92a5a8c1b4c6bec205f36782dbd97b5b59c1adf8 |
|
MD5 | 8d72cb00d1022d7327db7df2edd80814 |
|
BLAKE2b-256 | bdc5f995c6d590c2dddbaab2001fb228a231d3c02482ec756cef2746a1b0759f |
Hashes for pysolnp-2022.3.13-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 413905accf65fbcd6b17dd3ac04e29acb626b07d3cbd2cd29d6fdde22e1eb10b |
|
MD5 | 4588cb1a31a330ce0499882e29d7f090 |
|
BLAKE2b-256 | 8c71b6c6cd8af568a1499fa8f431c9ae30da285c0decaa68be7eb606cd102c37 |
Hashes for pysolnp-2022.3.13-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b685d619b2812479a0e055112bb794e82a17e9661bab8e3fd028081a86e34350 |
|
MD5 | 23d26d3e3aa6479343ea1f6079b68fe0 |
|
BLAKE2b-256 | 37e6e85c728b64931a193fdaa769592838a0f4c94c529876875f1ddc0f45119c |
Hashes for pysolnp-2022.3.13-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e0f25156ca92d29b988cff82d0d300cc90666f07d3c9489ad39d6e796848eac |
|
MD5 | c2dfe86b43858ac0c132d8148d2bb572 |
|
BLAKE2b-256 | 45b516a06e9ece24117401e2c03011e2ef35a9ff689e3fd430ccef5327212855 |
Hashes for pysolnp-2022.3.13-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e98276be357094a114dc4c22d7a420ac117e692fdf4f2795ec36cb268e8dca52 |
|
MD5 | b76f5ed4c78ab86c201bc1357762b58b |
|
BLAKE2b-256 | d5012f1d6091128b229b3eae7ac5d4155a7735800348230c85f52fc811b37c21 |
Hashes for pysolnp-2022.3.13-cp38-cp38-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1b04277f76bd77cc18bad317c9351b10e3867897e957bb021cf0952f29b6ec6 |
|
MD5 | 16b58bcbd490bdda4147de6adb1655c2 |
|
BLAKE2b-256 | 68657bc4ffaa4b7b7be55505dfa2ca5b93cf7258b962d2512d630ad847d569a2 |
Hashes for pysolnp-2022.3.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62b400020f4feac390ed9466cf82296a4ef827e58a1dd2bdad3f3b46d646cf7a |
|
MD5 | 0379c2cfc8b4c00ddc92339a9b2b2482 |
|
BLAKE2b-256 | e3051aa6a3f2b29bb9d1a3937fdd9eb92a93b645bf5748a6060cc77371b8a6cd |
Hashes for pysolnp-2022.3.13-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dc2a4e144c6685a1b266926506059106e30f193ca3704d7be7bc2f105d66118 |
|
MD5 | d88f7b2ae6d2873290fd477b007fbdd3 |
|
BLAKE2b-256 | c5c2006516a321f7737fd2b4e540181b5f256b729529041d63696eec52305c23 |
Hashes for pysolnp-2022.3.13-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ff164f373605c441e6ef832c6296fbc0ccc6799a5352181b7312b336c7ba324 |
|
MD5 | e3e14f25a3904cba009ab18ee3e83686 |
|
BLAKE2b-256 | d79609366089ce8f87bfebca8c64baf13cea3e075fbe3d7d6ac31d0b7e0fb045 |
Hashes for pysolnp-2022.3.13-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f338c9b7587691b415f5c1501df373ab092c1b43059bea9835823746955fbc |
|
MD5 | 354312becf6e389dbcc550382a0fcc5a |
|
BLAKE2b-256 | a7c9e36348294dc9eb2c357b18c5bd44ab8ffbb2a05e4d16c3db432d624a6a7b |
Hashes for pysolnp-2022.3.13-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5f7406dbc86d3019a1c99b2c49c0cb8a48ba58366b7704378f91c2e8848a25e |
|
MD5 | 1a406da1445b24b483b34f2e6e480b4a |
|
BLAKE2b-256 | 9aa241b68cc319b4a83d3569932658be00b8f426ebf30367b50cc569e4569eaa |
Hashes for pysolnp-2022.3.13-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb83d26faf8a7f591dfe6002adc1a9db437018c3b74ef3582be2300c384aeb8c |
|
MD5 | 5a825df8572e8edaf702d2521ba18c29 |
|
BLAKE2b-256 | a765fd8e10f92da68a26ca4ed31414bea7f46f35090e069b74bb1d2b22ef0b3f |
Hashes for pysolnp-2022.3.13-cp37-cp37m-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8501a571f1f401fbf53ba5757f2696719ca450857166840d189a6787c076543c |
|
MD5 | 7daa00f7d1cb9678343f2f6572d6d874 |
|
BLAKE2b-256 | 1f57b601819eb07a25050a24dbeb5264f627a2f8acdcdcc8d64557633e2361c5 |
Hashes for pysolnp-2022.3.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d260ff29bace6c5eb871240d673b4a2f46e6da909fa5224b9c2519aef681c2b |
|
MD5 | 85191412749028692c323326bfe1b4c0 |
|
BLAKE2b-256 | df9fc8fb343a04cb1165d27be115877345305ad696f306a20e58417ba71c1ee2 |
Hashes for pysolnp-2022.3.13-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04853dfe9f8dafdc826795de7f5ab48684ed87e528e68092d5c88552443b8b8a |
|
MD5 | 24e671c136d81c2ff72e1d53c7cd2734 |
|
BLAKE2b-256 | 5678a8638c2053732ba8f82929d26a9f63508d09472bb5cbf3528ff627aa0aa9 |
Hashes for pysolnp-2022.3.13-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8592b76276a24457a9cd08ace63095998fc8178da8cca56eca21c83d58347cb2 |
|
MD5 | ef0548b2495ab80237a876944ba4bba3 |
|
BLAKE2b-256 | 3434b4b4ad07c4bc209f7664bb35a053abbb75e15e5d430ba80986686317adbd |
Hashes for pysolnp-2022.3.13-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 434f4a628f59591d0cea7547e9e43d65ad161e97f357c9acc78a096b2a734c49 |
|
MD5 | d0a87511fe0340df6b986a9376f8cbe3 |
|
BLAKE2b-256 | 01ca5fbcf5773e2224e09c1e689b5c547362d63d15bbd1a180227b39549a794a |
Hashes for pysolnp-2022.3.13-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b29e0b2e607a78be41e05f91734de43575a4f687e73daed889807bbdb9022fe7 |
|
MD5 | 3c93dd68c3a49cd34ff87ca23a611441 |
|
BLAKE2b-256 | e6b2b3953f15357ed7e09f0d7cce516bb702e10c600bf74bc4bc5e5cf2552cc6 |
Hashes for pysolnp-2022.3.13-cp36-cp36m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb6c1d16e2a5788dbdba73cc9692d2e0f3814f13fb2357d4fdf5740387bb9341 |
|
MD5 | 98f97fe5198898aa53359744b18939b0 |
|
BLAKE2b-256 | 1f78152cb4b8c4fd5ec5f61a506bef176f527fd3ca6f72a2f76ff3a6fc161a9e |
Hashes for pysolnp-2022.3.13-cp36-cp36m-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b72a9d5d7ec98b3b0e864cf4e2727efe0de89cd3758d3c3dd4d8a2ebd686d20 |
|
MD5 | 6ec588470644c57224233fc50f1fd59c |
|
BLAKE2b-256 | 8709fbebd7a6a1fba972a8555cec1f896b8cc6e92a819c338835180e0ee81d43 |
Hashes for pysolnp-2022.3.13-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4537090f3da62be8c66bf8384eed5715a9a22f5544892c7852a6294b97d1a553 |
|
MD5 | 4735b730e768dcdf08ef4d88123352c3 |
|
BLAKE2b-256 | 203ea256d78edbf243ff52d0e71440f276602b97adf8aef31439a2f7dffb4b8a |
Hashes for pysolnp-2022.3.13-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 670c9000fb0babef2400e2487bd19e5c3cee26a62078beee84d48009a35ca710 |
|
MD5 | 3ddf5dbf787395dde22b5013e30cae7b |
|
BLAKE2b-256 | 2b24e81e9f0379328ad8abc64d50da583f8beb94526adc900ae7a115ace9adf4 |
Hashes for pysolnp-2022.3.13-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb390db6582de70bf0928c6ca8549527eb4e689fa8df4b4c0fd396cbdf085f4e |
|
MD5 | 51a09a57ecbd1022a18d4148a8d8fa98 |
|
BLAKE2b-256 | 3744849f04c3c5500e79ecf6cce96008c0b7a082ec617224cafef43c6394b3d3 |