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.
Compatability
Precompiled Wheels are available for CPython:
- Windows: Python 2.7, 3.6+
- Linux: Python 2.7, 3.5+
- Mac OS: Python 2.7, 3.5+
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-2021.4.30-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 283bc8ac6fee9b92c931da1a65b3fa5baad0fc7e7020473afe69f9557240df7b |
|
MD5 | 9f4615529435691ca4cd3b079280f24b |
|
BLAKE2b-256 | af3d52f23f4e3d3ae42a9f20e9fdff6fdd0cd36ba7b92fb193c5433c4906edd7 |
Hashes for pysolnp-2021.4.30-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c102f9f380ffff1bf8cbcba9c682ca4070c7d7019ae9832bc5367d70dc1c8c03 |
|
MD5 | 461e38023562db84c3ee37d16977354f |
|
BLAKE2b-256 | 6b031149ecb071d8b0b9be8595115c32d1c81e4c903ed3aa907a3863a8af1ca8 |
Hashes for pysolnp-2021.4.30-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8ce37811555664a0a68f3e71d3f25ad73c36c75790ee22e982458697ad65279 |
|
MD5 | 292172dffa7e420de7204fbc4f1a554f |
|
BLAKE2b-256 | bac877b67fc9a0cbb9d7530ec8cb2bd1c936d4cef9e9945c8cf45d4efdf9430b |
Hashes for pysolnp-2021.4.30-cp39-cp39-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda7cb53e49f6b560237da53755d3d3e743a1b86ff9d22fea8bedbdb42033955 |
|
MD5 | bfc9891d717c2e4b6396c537bff4e33d |
|
BLAKE2b-256 | ae50b3fda7a6bede228ca64043249d1fe8299395aab61a8df37ceaf59ed09abd |
Hashes for pysolnp-2021.4.30-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7df7a766a709156184511a7e3b8e8f5b58fab507d640a211249b156dd3ef1d6f |
|
MD5 | 5d14e97bf59c4ea4e9805b0629fc9e76 |
|
BLAKE2b-256 | 09d1823a218ea5b542158763d4d2e84efaf869dc4f32e3f5ee27f4373365ca3b |
Hashes for pysolnp-2021.4.30-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 510f3c8e7aefdb649996f8bf210a1316cc4d69a3adcd9dd323352ccdd2e41ce8 |
|
MD5 | 0124f77a26fbdf4aabfac60ca3311356 |
|
BLAKE2b-256 | e20e5db44985f94f6c43cbe154a0c8cf27d1cc35606265d5ad4019c6a54359c5 |
Hashes for pysolnp-2021.4.30-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 653136711db547eeb8747c435052740d14538c959b90c7c8c4b030d401a65513 |
|
MD5 | 6e7a418f19c7a603c47425f9ef3174c8 |
|
BLAKE2b-256 | 8158924fbf6200955f3c664043017d4650dbb76d1f72ac17f8eb33fffa97db9f |
Hashes for pysolnp-2021.4.30-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 057becf973ecb36ba82ac146570989ab12c7434587a441b4aefbf32ed56cfd8a |
|
MD5 | 592035c7a18725f17abab0eb0516ce30 |
|
BLAKE2b-256 | b6aa2fea88c15d5bb81c7a60ef82b8f84f53eb17c38a1fe50fd4fecf69ea60cf |
Hashes for pysolnp-2021.4.30-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f037b36d9ec76cb8e0ff1a9420be11ae809e375efd3ffb1665cd8364bd305e31 |
|
MD5 | dc9eeef1c8f335229d008d0e2cd58064 |
|
BLAKE2b-256 | fd597fc7eb181140a957b25f9fdfc6e3d9ffcf651e486547d50084bb45ac2d0e |
Hashes for pysolnp-2021.4.30-cp38-cp38-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6c973b8ec614249ccac22a8296a81c8deda79a963ddbfa178a3180bef644d5d |
|
MD5 | 6e3dcd3af6cb4106f386c63049eb93bf |
|
BLAKE2b-256 | 17aed2cb90fd174152cad17d9543f30c99e3f22d921160ebf60f368811dbe295 |
Hashes for pysolnp-2021.4.30-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acd9e2ec804aea305a7b5b09cec0191987525ef894733e9915899103836c2055 |
|
MD5 | 0161a7104559f826b3cfac54a4373d4a |
|
BLAKE2b-256 | 265dc4df3a6a7b948b07dd41e62c61c947604ec53797bcfcd14dd1f06f635b5a |
Hashes for pysolnp-2021.4.30-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccd2515b92e68292f3ea7f16e0c8d843b53c2366509ca5b738d13d8df56d038e |
|
MD5 | b6fff12c290d496915bfa5f6dc542db8 |
|
BLAKE2b-256 | e9dbdc10e4b5e971017d425978de4b1d1c45891f42d1474fac292d31d51a0ea8 |
Hashes for pysolnp-2021.4.30-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8528adbb4bafc9d8141eb30d7164c83b36e6e41b9384848962d26a67c55a9467 |
|
MD5 | 02ddfde911dbcb34fcc7d5758661e905 |
|
BLAKE2b-256 | be7211e3ec6cbfee821a4f92c0fb0172d99655afb54efdd55d7444f2c5ee64c6 |
Hashes for pysolnp-2021.4.30-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20d2be7dbf65560dd24a63b238dfaab3cc68f412f9dfcaa8e7ef16c8e4fdf415 |
|
MD5 | 374b81b72246520842a9539a7ee1a226 |
|
BLAKE2b-256 | e4c33ef27a430bbc1df8990941213d8d48777df90cb2f1df4a2ee439a354fdf8 |
Hashes for pysolnp-2021.4.30-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 641ca1f4a1d8535975446871e04964c5566b014462ec98c726adc54d4bcbd4ee |
|
MD5 | 624d86c9fbdba0c99d0c17e1700e38fc |
|
BLAKE2b-256 | a8c77fb9c743099c189fccd2af8a041f29b02ce917d02ee5fea46ab0f70cc890 |
Hashes for pysolnp-2021.4.30-cp37-cp37m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 245ec410bdaeb1b80e487ba3dc13489563c52f44686a567774e87b49d3ad407f |
|
MD5 | 702fb9ceb266d1ece761935c4e90b872 |
|
BLAKE2b-256 | ec6e6499ff29613681053dde21fb1a5392e1bfa896f54ff48d9c1bb4d3e253d9 |
Hashes for pysolnp-2021.4.30-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2130c741243150ea2c58dfa1a97d4c0480ad068021591a7bcf025e294ed5227c |
|
MD5 | 66df0547b69d7afc58426be2241c76a5 |
|
BLAKE2b-256 | 0eb2da5b2df9efdd3d5e9810fbebb5effdfea41dcda9a2ef93955e02433e3554 |
Hashes for pysolnp-2021.4.30-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3b4b1c565f63a5ba1fd90e0e4d3095f3588a0cc3f7f24cbb6e058a5f5566de3 |
|
MD5 | b41f5c0a2906d2536a4a8b32afc2e950 |
|
BLAKE2b-256 | 4c4c8349a884d44f89fccbb7eb8cce5a9ad93247565a89dbdab4a6714a51d762 |
Hashes for pysolnp-2021.4.30-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b91d59d62a0585f775dcd8cc2cfa035a5c423710d8e0692afbf4dd79c81a85c |
|
MD5 | d43d72509b1a23d8def6e4a7d56bc346 |
|
BLAKE2b-256 | bce3dfebf483817cfcb9f8800aad6d2294f94dc03471b7e2f68464715dfdd88b |
Hashes for pysolnp-2021.4.30-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb037112c898fac4bc87bde81ea38dafcdda0450f7dc0e485053bf1b9b5aff40 |
|
MD5 | 471e1754dfcf44ce9f0ee3dbda7453fd |
|
BLAKE2b-256 | 280016f418c5adbafff0791cb686c081a12b0caef93f4509ddb86d326e3e505b |
Hashes for pysolnp-2021.4.30-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5018a9321162be4658f585136ec28d61b3e78e43635e3fecc35954097919dff7 |
|
MD5 | 7f6cfffc1f7488ecd6c992d57a5cdfbc |
|
BLAKE2b-256 | 447557f0850911f9548f9e0db33366b1d5f3bd67d9f339f74e0810660b66e092 |
Hashes for pysolnp-2021.4.30-cp36-cp36m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d84e87f4735735a9924b6a87d591808c8c170bfd05c7bd2b762dc995cbbf9e9d |
|
MD5 | 0f4de59598d8bc9aadf0fd91fd941464 |
|
BLAKE2b-256 | 866255884586514a5d7ccb5e2bd10d13679b73d1507fcb44850de9d67562d7af |
Hashes for pysolnp-2021.4.30-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 199af8c973d39c49c4e2faf7a54bec7ccf9315ce6a699c1359689f21a705810f |
|
MD5 | e838c6ecce5dd81221789baf9a96b0a5 |
|
BLAKE2b-256 | 92ebcb1689566df624bda7c04f21ed1aca9fcb71718a8ac2196b94e7c97c86e2 |
Hashes for pysolnp-2021.4.30-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18f78592e14985f4da709b5802ead7678fce132da4ab4a77140e557740c0a25 |
|
MD5 | 82c22449257bd6bb1ac62d2260b01ad0 |
|
BLAKE2b-256 | e253ecb5904ba452b969b5a044abd033ce524377405e86a8a96b304ba4ff2c01 |
Hashes for pysolnp-2021.4.30-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72de4bc83b80525c2b1ab65e027e56e79f7eb68ff06b6010c4e342fc231a55f8 |
|
MD5 | b1f3a5b117240630dba7e308abf318b1 |
|
BLAKE2b-256 | 64947e95901a1c29d2ff766e509bfac47fb3e4e5db394740503661667d13f18a |
Hashes for pysolnp-2021.4.30-cp35-cp35m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f391d2e939a00c09b51f096b0d823a459302eb13a0ed6d7042eaf6dad6337ea |
|
MD5 | fb665bf000f25ee7b91bc9c494fe27bd |
|
BLAKE2b-256 | d052efbee54213cf3bfedc0e5bdfdc7e87964ffc4c762603068f7b3b8dc3d9d2 |
Hashes for pysolnp-2021.4.30-cp35-cp35m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 830e3a2c73987526ff932684af7b9e2f9da33d0019990d757a8ee76d0ebf6db6 |
|
MD5 | bc028250433cbc8d942977418c009741 |
|
BLAKE2b-256 | 088da8f5ac22f9dfe06d43ce15f2b76349d1136596b8555a485b51660206831b |
Hashes for pysolnp-2021.4.30-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0ab41085279e9f9aae4ab18f02bd5ff611607f0d053769e0dfcefe161d78781 |
|
MD5 | d758e282e0aa2908f149138c074306f8 |
|
BLAKE2b-256 | 3cdfde8cb702e40f123dbea6333880e4d1e6a87133ec356ebb49e62d6caf93e1 |
Hashes for pysolnp-2021.4.30-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e259c9532db5d9488104653ba92128c51902c66084d7900a99444541e199522f |
|
MD5 | 14ed0b6c9bfe93b9a9ad7cea4f97851b |
|
BLAKE2b-256 | f64fcfc8d8c3a6d37b0efe9970eea155f505f2f23c99ba03780ea0a105401440 |
Hashes for pysolnp-2021.4.30-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee56020ce183d4721c1047cb5277388a4b04000a324c59f814bfce67b4c1a081 |
|
MD5 | acdecdbb80a1b745e1e30a83aefff0b2 |
|
BLAKE2b-256 | 168bbfa05408e1cca6dd4fec2d5b8bce9cc05ab1381193831ad4363bfa891eb8 |
Hashes for pysolnp-2021.4.30-cp27-cp27m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b03720418678f8ea72d8342295d02cf3c305a86657d8ec3a8e7163c64ba9dc12 |
|
MD5 | 623c79d2e35fe0dc020104f3725aef7f |
|
BLAKE2b-256 | f52be526a6de67f39242cd1d04ec711149d1cc91db9d4bd7ab72c32d7f948a3b |
Hashes for pysolnp-2021.4.30-cp27-cp27m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93d3694bdb64a5055f65b4cf6baa0b38b39dc2df8f8a3c31f910576cd6fae7bd |
|
MD5 | 013d87481884d66ace85de976c86cb14 |
|
BLAKE2b-256 | c4eaaeeddfbeafb992c4a42cd2b208c245879ac0cdf5cf9f31eaf5ecfc2a5d22 |