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 Distribution
Built Distributions
Hashes for pysolnp-2021.4.26-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a248071da92c60f66ca342e161d84c12887ffd942b270a4fd1b4c3493d060803 |
|
MD5 | 6afd8ae767dff58de944613a266789ca |
|
BLAKE2b-256 | 7fb422ccb92beb8eaf4a86813000f9714a98ca70e9a3696816919d1dd24f36d4 |
Hashes for pysolnp-2021.4.26-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39c0356c27d7d73acf3275e4fcd3ef659915b757e6c140d2dadd3c89f68ad223 |
|
MD5 | 6a202b452d84ee50cdfbd49c77ffb56c |
|
BLAKE2b-256 | 96d9266da99200f095e2060b53d1ce2e1c235144c2b2471d8fc8007213a1bf8d |
Hashes for pysolnp-2021.4.26-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eeaa06f76e3f183cd5af845b3662f20f50793aaf1da51fbc56e10d57f693cb1d |
|
MD5 | 26c202958edc8628cfdf1d3dc9bfe298 |
|
BLAKE2b-256 | 51b2c397b904649ba30d62f71011e5c83c8eb7b9626dd6ba774c1d1dd355cd4a |
Hashes for pysolnp-2021.4.26-cp39-cp39-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76800260979a3ae28928462c58a70ee3cf46bd61387e6793c0f28fd17ee954b7 |
|
MD5 | 18e5057e9d97e8872467c8696c3ed718 |
|
BLAKE2b-256 | 35d01912250b3f1f0453985edef0100fed086e788b3a5995e172b2abaa9c5aed |
Hashes for pysolnp-2021.4.26-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a4ebd3351fdb23f81eb6041f128d3e60c41304a2741537c09c3850b3cef24fb |
|
MD5 | 4dcb8b944c854123644c4278af9323f3 |
|
BLAKE2b-256 | 1882ddf7b0f38b595c21c71d8cd5e895450e96381859fb7c23fe7ffd3dd8f87f |
Hashes for pysolnp-2021.4.26-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e776aab9550e53a26c4f7ce352cfac79809115242359d5c5335e9e6f8b78273c |
|
MD5 | 41b1e0653ee767d28d6437801fb37504 |
|
BLAKE2b-256 | d0f386a6905925b7dcec4ca75ae29af0b5e0e03432e87a5b1645b8a9d8caa592 |
Hashes for pysolnp-2021.4.26-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e893349cc10da27df679c5d99bd286f675efd0badd8d5da72a2c347840eceb67 |
|
MD5 | 1af9bd98bc144583f708697224a10860 |
|
BLAKE2b-256 | 497b83ca140870b3e38415f7a5166ce0d646ee9c0e0c85a2426f966c4c8313ad |
Hashes for pysolnp-2021.4.26-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3830595a2faecee465f27d989ca2b8b6422d3c5af60d7f5aee1297be85986b38 |
|
MD5 | 94f26ab7b9b9e92da68082449ca049a5 |
|
BLAKE2b-256 | 62a14bdea80cccdc57c73f7834f2bd3eaebb09b46f745a4169bfde58786837bd |
Hashes for pysolnp-2021.4.26-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f7731aa021671c0f6ea4faa5778036fc59dbef671562898255e3fe205cdaed |
|
MD5 | cd5ca8e0a4d981405f7a015e6cb41bc5 |
|
BLAKE2b-256 | 22247ad32956a284e06385cf7ade67f39e7f51a5ef3ba0566528cba1f2d8fc0e |
Hashes for pysolnp-2021.4.26-cp38-cp38-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ea7ff246d79b62129592e35f4a75842ca5a5588011ae2e58f8f491076ecd375 |
|
MD5 | 20b6e634a40f264c64495215615d5ca5 |
|
BLAKE2b-256 | ec0d3378d3d92a0a1a413d121c17e65f79766491d96068828d75071143079e9c |
Hashes for pysolnp-2021.4.26-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27e17e9f5882e96249f572bf6acb92a01d6c05f803a91c1f5313fda73693474d |
|
MD5 | 15ab439c92d27a900d1350cfa6e31cb5 |
|
BLAKE2b-256 | 62284dd3a4147a5fc895213b754076ecbb99dbc2d3d9b6bd8b394d11b502a24f |
Hashes for pysolnp-2021.4.26-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8aa8e63486c2d87e979cc177f0d0486f8d30c93158197d94c8eb2055b2b2028 |
|
MD5 | 97d05f948ef5edd9b89a08c1dc62f034 |
|
BLAKE2b-256 | acc54cd0b926bc6a86f906f64127569d21537dc2aec89c314e608956ac85659c |
Hashes for pysolnp-2021.4.26-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f820cdca5a350786ed76bd2046343f582493a11fc5d7c08af8037f01b4caf292 |
|
MD5 | 9c5b5455f2d14ae26a13508b22a5fd49 |
|
BLAKE2b-256 | 544ecf6afb665e2b3d695fd37416c734c1e76a80ca677726f0bec5d198683bc8 |
Hashes for pysolnp-2021.4.26-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 455d0c20d7139af5bce8cf37b2ed35e28088923163cdc4da42da4f3f98aa891c |
|
MD5 | 6ee60621fb6be0814d7dcb4d546e0641 |
|
BLAKE2b-256 | 253eda24053bf470ebd56d9d988925330bffec0f79483a49b2bbb6015b8ec92b |
Hashes for pysolnp-2021.4.26-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c825bf3f0ca59769e5a72b9daf6193d3b58b8003c950dfd0d9c2eb760643626f |
|
MD5 | 7d3e4040ec6c13c2ea90275ed4f54247 |
|
BLAKE2b-256 | 29a0e1c354457f6c73ffdc61098e16bd68c4394c1497310e3146c6fd6e621b0c |
Hashes for pysolnp-2021.4.26-cp37-cp37m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 681fb19f1ab5a19bbae8618d360a853f54eff28eedca9703446a4a8850f92f55 |
|
MD5 | f86f606975b71da93c6cfd5458968ef0 |
|
BLAKE2b-256 | 10d98f423f1e5a6788046eae635203fdde6bb3db93e00872b8bf809f3ba8075b |
Hashes for pysolnp-2021.4.26-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82c9de7789724ea7d6a368353ec98193d3234aebbf3d1b858ed8285597c3c4bf |
|
MD5 | ab62565164f241d92409f5f00a702eae |
|
BLAKE2b-256 | d449d994aef928f67899da1043e78e995458b3375260feb154f23cb336064733 |
Hashes for pysolnp-2021.4.26-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6192efd435e30417c8d1e77db6eaed1da13d8cdf15a728910cf340a3b49be64d |
|
MD5 | 3ba6b4fc7e388203515dbe185e31c56f |
|
BLAKE2b-256 | 9fd20a4aaaf170790eab880a7e8742ae4c6cea36f4dae53afd99a374d9e92ce0 |
Hashes for pysolnp-2021.4.26-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29f5f8e2ab6a97175917299f2d1888f247a0d5f8051bc4489a25cb1901585032 |
|
MD5 | a572adc266afa65c9d1d37bc4747beff |
|
BLAKE2b-256 | 859b2bcb9b4001da4ad5b536a4a943e33331de280494107ec5baa99bb880f979 |
Hashes for pysolnp-2021.4.26-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dbd4f2d3ab517eccf8ea24a127709e98ebed3eed6774f841cff7c7946224460 |
|
MD5 | 64b84b3694f8f41d1cf62626581cba36 |
|
BLAKE2b-256 | 7e5a0b4fdcbe0a7d4a1d26daad80c7d4cb14ba9f80e131254a6301d1850e9dce |
Hashes for pysolnp-2021.4.26-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d91a723f8cae1e5a069f97e11661188bbff919ec0d370b0532fa78ed80d820cb |
|
MD5 | 9b59c85c2b6cf827499473a548232940 |
|
BLAKE2b-256 | c6fc5a45eff72ae54d1c3b71fdac08c7c012dd3a516dffbcc48bf69d8a3a0990 |
Hashes for pysolnp-2021.4.26-cp36-cp36m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7a85c42d42100315de507ac84cc9eb3b0ddd26b078127ffecd7b0b5c6f41d04 |
|
MD5 | 2285caecfd52dd814c4b03e7e587351a |
|
BLAKE2b-256 | e7ddd4af50fee56ad9b91d8962e5c1a38811699b6f145642e0424e39c985eb05 |
Hashes for pysolnp-2021.4.26-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 763386d607c084bad63a40f2cf4de55129cfe37f227681919e3f6aa528670401 |
|
MD5 | 8fe3fb81316b9451b252c327fcc4e1e9 |
|
BLAKE2b-256 | 9be44ccf781aa26d0aae425b2cf15def187d9c0ea77c177914b4168c92ee693c |
Hashes for pysolnp-2021.4.26-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 345f3f4341473b0b34839135d018159370a9f0e86923bab8758efa484ddfd40b |
|
MD5 | 2b30826ac377fa439c0c2be9ec89f41c |
|
BLAKE2b-256 | d7274a4ab9a2910b546df2dc9067a8a70da1b1754f96ce2278eda9e00ecbcdd0 |
Hashes for pysolnp-2021.4.26-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aba33e94ad06637911d2ecd955146016f6ccb784008a0448dae177e60784d47f |
|
MD5 | 3ddef8da754598f908dcad25facadfb1 |
|
BLAKE2b-256 | dff0e5e7022b05205c93a053be5bdf2c6e96abc2cdddb5e13e44c7fe545b717b |
Hashes for pysolnp-2021.4.26-cp35-cp35m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45050f38aaa0b157416ea162bed340cfeb98558c8bc6821dc2a4f41662cd1c11 |
|
MD5 | f5ef8c980cad7e6226599e1027a1e745 |
|
BLAKE2b-256 | 4d621857b981c9a5ee1bd6aaa854543d80f3e5857df7e878befca41a8bcf315c |
Hashes for pysolnp-2021.4.26-cp35-cp35m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9773eee6035780beeeb7c9107ac6590183700a431b173707ed98c30baece5117 |
|
MD5 | 2af3d950f9b9420ab551f2bab06cccbe |
|
BLAKE2b-256 | 70b50b621094e7b67e40b715409c669259db07affd637ffd7f0ccea7b8b55e38 |
Hashes for pysolnp-2021.4.26-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 648152adf83e56c54d65797cfed99fb6f352fef9981cf639b582a35ea706ed41 |
|
MD5 | 3c4ba0f39ed8d533a5ce9917783a4e3f |
|
BLAKE2b-256 | 2f599c1bfc222d8d66c1cd668454ee3f80938be43592cde8da7c4d633e3b394c |
Hashes for pysolnp-2021.4.26-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38daccd821c652a67cefa75b133dae4802aaadf6cb697b1f7ab23d80b9cc1d96 |
|
MD5 | e481716ef3173712ca769bda270cd9ab |
|
BLAKE2b-256 | 927c2d1a83e319881055aa4e54d69674c56ac8088863bb1c155b5a5c35bd632e |
Hashes for pysolnp-2021.4.26-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8c2458678bd98b74dbf8af51ba02e3e9bcd894628a9500ca1e302fd8d2105f4 |
|
MD5 | 703c63bfd9b98fde13716e0d7944518f |
|
BLAKE2b-256 | afbe9af3fba36777bf1d40bc30126f395c255b8b3b0932cb7dc1ff6c9b29bf44 |
Hashes for pysolnp-2021.4.26-cp27-cp27m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 107ce2c641db6569ad5fe804caf799e476bb0585fcbf3fc1098504ec8a4c8519 |
|
MD5 | 5996c960e71fbeff7eb1ca478a0d3b64 |
|
BLAKE2b-256 | 57a2fcba5232b9e95c61e1603792a9bca88a266eaa75a4dc87171634766c1075 |
Hashes for pysolnp-2021.4.26-cp27-cp27m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bddf6355657e9410bc4d30bb0cca16c87f16f42e2073291de37f4ade2dac0c6f |
|
MD5 | c307eadb5b5ff551abc7bf77a415ea3e |
|
BLAKE2b-256 | 10e730f3b29dd2dd5561b7f9967d4123576e7fa73703d100c7610ac740d43965 |