This provides the SOLNP optimizaiton Algorithm.
Reason this release was yanked:
Returns incorrect optimum
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 Distributions
Built Distributions
Hashes for pysolnp-2021.3.8-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc57951b137fe9016c7e8130dacd8f65fe0d3f53ff7eefd4d780e6c0ab1bfe26 |
|
MD5 | 5f715940c711b893e8d39d98031d51a3 |
|
BLAKE2b-256 | 3969c15d89a12176e5a8c30dd070659a72c6804f9392a317be82d1ec7da528ea |
Hashes for pysolnp-2021.3.8-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d36f449558184f47502b9d3350baea6b8058be224dd33964c3e375b2ceecc37 |
|
MD5 | eebde3d883c923684434713ad333c0d0 |
|
BLAKE2b-256 | efcc4719548c4983b9732a3432c2b5aedad1eb1c67ad9bc1bf2a42320461b6f8 |
Hashes for pysolnp-2021.3.8-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b722efd5cdda3da558369b3cf4b88d151ccf2473dd14b9e6bbedcce4e19f4b96 |
|
MD5 | 586172b0b1d9abe7cdeacdcbea5152eb |
|
BLAKE2b-256 | f3b37138196625cde76ba41ec38d60d2afa03dcf59d091bbfe91c0d73897aa16 |
Hashes for pysolnp-2021.3.8-cp39-cp39-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a0740b6e54e2b24dc38d60d57ddc278361ab5b3b9e29c7cd0c7824e36c12f46 |
|
MD5 | 42b51273149acaf9994c9912c2250524 |
|
BLAKE2b-256 | 5f93352892d5d7ec61ffd5573f16ed1ad215997715a9469c5413ff998baca2e5 |
Hashes for pysolnp-2021.3.8-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b119f7ecfa98a15e6c71e6745d31efeeb456716be513f7fcb3cb1300a55d1fe3 |
|
MD5 | 5672dad237266f51f958944d0f6a29d5 |
|
BLAKE2b-256 | 62e41535f3c78c9c2850077415d5799db42939178309d1b8b54080785fda7da0 |
Hashes for pysolnp-2021.3.8-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | add284f1d25176e1aede8904de14e62e6caee41e9fb0411ebf862396843d1afc |
|
MD5 | 8409bdd889b3872d8886067bcd696e96 |
|
BLAKE2b-256 | c18320a664a394458d631681635ce19ff0e4807ea80930f3e5a36ee3f35fb325 |
Hashes for pysolnp-2021.3.8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e90fd327c1010dd96191c09dd6d9eb9d289872c7844921002a07b8b740b1ff7f |
|
MD5 | 2eca633420bed2d3e82853761d716451 |
|
BLAKE2b-256 | 774c594d36212563f6e2741fdc781fb2c0d15f0e33db8705bc27fa615191010f |
Hashes for pysolnp-2021.3.8-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fdb02e15ed42ecc8b4e415ed200a7408dee348e58759aef5bb695522ad1aeca |
|
MD5 | 4e22108a15a02448c068831d188ec589 |
|
BLAKE2b-256 | cf53b2b7b39cef223de63976e9a41202e74b06b8179afa45d3c851396f8a385e |
Hashes for pysolnp-2021.3.8-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55a86b74a7ff741b656fc85a71f746ef7fc62df02d91e2309f6fc0ebad8da779 |
|
MD5 | 0168e8a2b9b226fdcc80c055493906f5 |
|
BLAKE2b-256 | b8339aa3de7bed641b3a911e3439185e38ab2546bd004c66fb166983ebfff2c4 |
Hashes for pysolnp-2021.3.8-cp38-cp38-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d98d9e8476e401ac53b7b881c7782685d8104cd9566ebeb95e73d5879815865e |
|
MD5 | 23068484378bd3765bafeab0b6589829 |
|
BLAKE2b-256 | 35a65639b46996a597c2b5ecbc307988ab7ec2452597c1abb3613efb1f4560bc |
Hashes for pysolnp-2021.3.8-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9a299b4586aecb6e0bb5ebc59ccd88e0eca1f3a711a7207ec08a22782e77cb7 |
|
MD5 | 5e48f05690350581c8c8dad60b5ea24f |
|
BLAKE2b-256 | dac37f36e7aa0e17de16b52defb7d5e446f83e5ac9ce2f2f3ab499e23cd1103a |
Hashes for pysolnp-2021.3.8-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09b84788192f5b20736ae3588a96f570e6dab518430d4c6c63e48364af62a6d2 |
|
MD5 | 406fe524555c7eed3f1c8dbbca842334 |
|
BLAKE2b-256 | 823d54652796ed62c5c1725ed7e802750bfbcda39c1e8d94f47249e9a36d522a |
Hashes for pysolnp-2021.3.8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3df5bc16b3ae6b312cf1a6b5b2338602df1b4aa7e8db5a820eecd239a72e7e8 |
|
MD5 | 82a6adae24564a8d3afbaaba22147780 |
|
BLAKE2b-256 | a7c30e3a975a07d1fcedbcd4851327eb42f28913d1bd8aa2fa224d339ca067ca |
Hashes for pysolnp-2021.3.8-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af0fcb968a3eb2cdb9bf8842a28384f671ab7b9a8d91630f547c2cb5e923e283 |
|
MD5 | 42c85573986cc9a464eeae98f1de1bda |
|
BLAKE2b-256 | 99a3697a7385432648a7ec5a56de10b0eaf0747993d6335e817f953d604ea75a |
Hashes for pysolnp-2021.3.8-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79a011da185562b63fcc44c247e9ef64479aa140cdcf3ab9d343de46ad1fd8e9 |
|
MD5 | 67202589f70877a2868874f9ab4517c6 |
|
BLAKE2b-256 | 800aa24b0cbd61d7da708e3f495a5f68f5b3cb3f658af60ae6e4fe73afac1e4b |
Hashes for pysolnp-2021.3.8-cp37-cp37m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87fb5a8cc6c8027b7d006214ab5f70bef67d48e7c9cbd44cce366f95eb362fab |
|
MD5 | 80f57fcb94b5b3e9bc7c4ab7dc84c2b6 |
|
BLAKE2b-256 | 1d33b9b095f93088d87bca83600d2094da6faee7cda4f5a0000a7d86c458f2f9 |
Hashes for pysolnp-2021.3.8-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ea6868bbebaed811c99ad9dcff498b98fc9ca330856f65b20f82258ef37b58b |
|
MD5 | 8699b95d940c0d0bdee5819597a3d4b8 |
|
BLAKE2b-256 | c29ba9c954a05b2fdde073c0148676dbf15643c019e4be62c9cf5cc8ce500dc3 |
Hashes for pysolnp-2021.3.8-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ae598b03ddc86745646a9c8a32f2f34c0e43479cddbaa78b2ab4e43f9c228f6 |
|
MD5 | c6a84a768184e790a5bb4fbba6c5ba34 |
|
BLAKE2b-256 | 67bed290a0975dac95f2b59b23d4959fd02de3218bb33e357e36822aa6d48009 |
Hashes for pysolnp-2021.3.8-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73723e8e8755e2dc636c6285ba0b85cb937433fe209abd36a7e28a2c04e804cf |
|
MD5 | f907d23b5196597a0cd05480c85ea974 |
|
BLAKE2b-256 | d033d95156eff1c68ab503dd42e8af39bf36f6c116121e4aafcf7d47d01de10c |
Hashes for pysolnp-2021.3.8-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bde01294a0454a31076a8fa7405e160c988859315ad22fde3a626addc79172b |
|
MD5 | 260baa77b7e1aeff82c435d2e710b977 |
|
BLAKE2b-256 | 3114d631a7f4ab85a7267ce9b12ff8268955bfe069bc607bc30c22314ccee74d |
Hashes for pysolnp-2021.3.8-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f326e6f33e3c145ef4855fb2002dfe6dcf63c493a57846b653cbad265c6dda3 |
|
MD5 | 6c31570ae0d99773a61da157b08716e7 |
|
BLAKE2b-256 | 4a2c9b907bbb9227eabd6ab45f8741d9358de21e90514898cf6e617cd743718d |
Hashes for pysolnp-2021.3.8-cp36-cp36m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a63f2fb6f196d246f3ea79cb700a7220fb6e1e8baec2e9087385760c634fe180 |
|
MD5 | e84a8271a21c756ea6c3e9bcfebfbf16 |
|
BLAKE2b-256 | 9161d5e9737c9593345aa2bf47f16cded8c6c4f350cced75340613541176986e |
Hashes for pysolnp-2021.3.8-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d97c3c568412794eba906b404a3f8c97c84618b5089826415f3859958e59063c |
|
MD5 | 7c96b07da80b8bd598b1b75288d3c55c |
|
BLAKE2b-256 | e2e044df369850521b55bfe04d56761f6f579e1d8ad048556619d57aa7c2e3bf |
Hashes for pysolnp-2021.3.8-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbf4d717d007734e1e4aa38469c24f500401031a4c7c96813fa4dc8f601c0fcf |
|
MD5 | d6a7354193cfdd1c5c5556a35ba7c78b |
|
BLAKE2b-256 | 89451f2f6dc51b46e0fc9a990514510a87064cb7da3973e326b0cebfd3fa4faf |
Hashes for pysolnp-2021.3.8-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d93886d28e4cbd02347776abc203c88aef1210417185a128b83e77a2d5c4d2f |
|
MD5 | b2f7da3a99ab8aa2ff9aa83638bc1456 |
|
BLAKE2b-256 | fa547b032a80528b146388d3421016f911593076634a690e9ec76c757e38bb9c |
Hashes for pysolnp-2021.3.8-cp35-cp35m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99892343e50e08e1c3ffb76f73376c00e68365a012b3876106babd1fcae418a1 |
|
MD5 | 8042c4802ef3fb599eb185a80a484c9e |
|
BLAKE2b-256 | 6fbbf718c928a14286a73a365be75515b833d31b1193405aa4868dfc88181a2f |
Hashes for pysolnp-2021.3.8-cp35-cp35m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6deaa5c3d28095251ddb4c51222e56f38218a69afe800c5148b68c4d9fcf0a7 |
|
MD5 | de661e1ac156cfbf3fb9f0c27dbbe2b9 |
|
BLAKE2b-256 | 09594256794ab44fa7e992baff2785f300a5fdd5557339aba7791923490509f3 |
Hashes for pysolnp-2021.3.8-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a3baa15674bef9d858f2b1cb465cf3e7405b1e4847e10deac55ffe1c3f7dd4 |
|
MD5 | 04ae209b70fe0e88d5b2b9ec587272e4 |
|
BLAKE2b-256 | f87fceb48af5ec4089648c56469d73577dcf575088ce16d6f773237337bdba2b |
Hashes for pysolnp-2021.3.8-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21d2dffc3abd10ccdfa98cc6d49c73696a95c0f76b09f9077753a92a2c0a22c5 |
|
MD5 | f886f1f05260a87ed8a3d9b9f06e0467 |
|
BLAKE2b-256 | 4c8863358fc6236913f9faddd9e34a108e10aec66c833364c398f2a5c2898fbf |
Hashes for pysolnp-2021.3.8-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f87b6dd8b7aab6c29f06a51212111a2ee9c1db1e092ae835fb1bae07767a0d44 |
|
MD5 | 5680ecfe9d69a386d8afc60c8f54805f |
|
BLAKE2b-256 | 8298f9115d5542526e9e7fca3f009a013a44ea7c3b1f4f3cc0196437d120e4e0 |
Hashes for pysolnp-2021.3.8-cp27-cp27m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e2439077ea6b3dd7cb3f875e3dcc315d415ddc62715e6a6e6daf7f18174bdc8 |
|
MD5 | 51e1cc86312f8ea56bdb161fed193709 |
|
BLAKE2b-256 | dc5b55b860983f702be41aae938db4c342d1e1f78e3ed551871cd1bd655a1997 |
Hashes for pysolnp-2021.3.8-cp27-cp27m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30e7d84134789dd48189943b8036c9a869f1bbf2ca6f528bc7e7f6687909ae5b |
|
MD5 | fea6b101a7f08f1a0ff517c7d46a6ffe |
|
BLAKE2b-256 | 9fac727646db418baeb0b63638bfbce52dbd8ede43175ebea0feb1004a181fff |