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.25-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb617a41ab4cb9c5010e546e2edb478730c526747a3f3c02de929875f88314c3 |
|
MD5 | 56efd3a0e0a7e98e3b61b220b9bfb1b7 |
|
BLAKE2b-256 | 5faf5bacf371144faa02eb216b351dfad51c19be0571dbc85121bffeea8fe598 |
Hashes for pysolnp-2021.4.25-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e342f2b6ce614d4d92dfa0da50c2e423a82008f4d9e44e2428ee284737e8875 |
|
MD5 | b6d0e6dc1662f00029b6de59f89f9bfe |
|
BLAKE2b-256 | 7e167ba490ae4ed5ca6586b1ab3562415e057ed0516b0dc44db19c539d65cadb |
Hashes for pysolnp-2021.4.25-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7c6392861879505f8fd69e59c73c6f31fb88bb07ebffa941b7dbc987aa9d99b |
|
MD5 | 03167e5d20c462e15a0b3dc914a61bf6 |
|
BLAKE2b-256 | 14ec9a01f697ed50e089909968a49ca1f099ae20346f814c1ff85516485293fe |
Hashes for pysolnp-2021.4.25-cp39-cp39-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f43c6552913b367a92dfad6eb5a3a6b56b20bcb0b6e515d3a7b4e5a564b8dd5f |
|
MD5 | a0c139c231720d602bbef25d0b36dbc1 |
|
BLAKE2b-256 | d0eeb2fc986309206087406ecc7937cd214eb0b8aaa1ee538cac231264ac9ef8 |
Hashes for pysolnp-2021.4.25-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f7ebd05fe938069842e42452d202529184927e77b5e93f3ed9078c54f4b2f19 |
|
MD5 | 26f0373f404fb41d2cbaf3a0194ceff7 |
|
BLAKE2b-256 | 1d9c1f147aa02a44b959d2070e9596bc011ae467757b92ce2a24df786bd35630 |
Hashes for pysolnp-2021.4.25-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5d68df2da830a7566fad9adc232f3fce6a390e2512b2c2064af33dccea696c9 |
|
MD5 | 73cc5fbeeefb51a6ed0d47c316012d81 |
|
BLAKE2b-256 | 024851545a508b134c152640fa5a4c8e2524efb5fde79b931d5e5f9f68c2f0a0 |
Hashes for pysolnp-2021.4.25-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c22434bc19a2bec0c84bcf2bb61dd58befbf9a9d9734241750d90e1bad7c4992 |
|
MD5 | b7f8266b0827331145663bf673d09523 |
|
BLAKE2b-256 | cee9a481c73d101c4fb6f714ead0853f62330cc0dc1ff2a4d28ed7d557ba643c |
Hashes for pysolnp-2021.4.25-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0704cda9fc171dfef157a990d5abb514e79a580c5810d5fca72e08c3656c6883 |
|
MD5 | d692390e33510130b3b04aff1ebbe9d2 |
|
BLAKE2b-256 | f7a1ab7ef66d649fcc95dbd9b8e2eac4e1176cf868a54c51d7f4351df599936c |
Hashes for pysolnp-2021.4.25-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17135a8e227a6203f3ffe6064c2221d00f853b565140af78dfef7c9e64285077 |
|
MD5 | 7c8ffb74579367db0450f999229c6cfb |
|
BLAKE2b-256 | ec1fff13be573a04fcc41ca634eb1c29ee50eb3194d30b59a10f048abc1e20fb |
Hashes for pysolnp-2021.4.25-cp38-cp38-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c24139ab0fb974438266547ac40e2aa0e45e377a2bc4da499d5cd33f2949047f |
|
MD5 | 2a9dff4f7b7aabadadcdb3b0e3ceb6fb |
|
BLAKE2b-256 | d4043657f55d2f1be65b470a15c4aeb408bff4eeda09632f4ef38da63ff280a6 |
Hashes for pysolnp-2021.4.25-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58e25d378764b366a81da756e49205db26788717e23e8365944ceb35d78eb169 |
|
MD5 | 3d0c8be47fbf46632ab5848c19d8b861 |
|
BLAKE2b-256 | 1c64490bcbe2112bd0d869ed3b1a7d2747045adc7cd77c6d1e136558facf6710 |
Hashes for pysolnp-2021.4.25-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83802d60ced5f55cdfda52da0da73b814d9e23685b1a7d030372dd0aa9cb33db |
|
MD5 | a499011e744cd215f17a4f3b1001992a |
|
BLAKE2b-256 | 4c5398d8148d0c338779056d98e7728472f17f0ee79fcfb0edd7a89fc5123a45 |
Hashes for pysolnp-2021.4.25-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcfc7a4c919ae7b25f7aa706742e1497d89c17490b1e8343755b8205aa99fd56 |
|
MD5 | 22438e4183052c8dbd5f3af21480fcc6 |
|
BLAKE2b-256 | aa622ca258c50891a0655a450d7d492f753cd387f95f6f8e2660ee568d8ab8c4 |
Hashes for pysolnp-2021.4.25-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 330fff57c29b4423481f5bde5d30a30db876a0455ac6a05df3666c495cf28477 |
|
MD5 | 4fd049854702606c12fc147679acb521 |
|
BLAKE2b-256 | 0c9b00439b62328e71fd7a601b44e5a071b9f72aa5901a57424fb3fd72f92eec |
Hashes for pysolnp-2021.4.25-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8c5af1fffcac3d270c4592277824d3fde46aa0130911001ecd18b4cf358b90c |
|
MD5 | 5fa63d6b5a3f4ea3c9eba46d3e102da9 |
|
BLAKE2b-256 | 18313b1934fd0fb382cc1914330238350bab7a734222ffd0bffa1e8953adf987 |
Hashes for pysolnp-2021.4.25-cp37-cp37m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a98dff33e7ad7acf722abc275b02a94a105d9162d4d6a14da32bb1beceba7315 |
|
MD5 | 9bbc4b90c56ce2fa19d4e03d761984ac |
|
BLAKE2b-256 | a14896bff757648607a26e7d758be936e04b4ea84c0c214e60dcc910c384bbc5 |
Hashes for pysolnp-2021.4.25-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25ac45cea0978ac37a924b41bf267caf90eae0648942370668f354516f360057 |
|
MD5 | 30ac3cb8f11fd39c2618719cbd5bab98 |
|
BLAKE2b-256 | 310daf7d3cfc10c295a60c11428399184f33f34003be31604a1018866eedd546 |
Hashes for pysolnp-2021.4.25-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab2a1ecb82ddbf5bd1d45d59e10ef7d83ee10646c32a6b5ebab1f62193b383d7 |
|
MD5 | f6102a08546ce12f7632ec3f9d108c2e |
|
BLAKE2b-256 | 8a4f5c0348eac225ddf0287b35efb0ce1ab37814e334f76d761f3a778d2b7975 |
Hashes for pysolnp-2021.4.25-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 133e9f9147293f9fd0e3830988d2ed2dab786dc967368ecfe263dc9b33888a7f |
|
MD5 | 3834c2931110234a8aa2af82dc10f66c |
|
BLAKE2b-256 | c06fa32f5cd88f56300949a36854215591c4ebbda078cd527e7c1140faf483e3 |
Hashes for pysolnp-2021.4.25-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 433d2578beaa499031ff61246a287fb85380cbc33f44ffc89a9df04e8ad0cf62 |
|
MD5 | 980b1846a5f62493c79361b90bae4764 |
|
BLAKE2b-256 | 9b7218739f55ceed3047ddc3a4f48e97a0992beedb458b4a1ebe2be1efd3d24f |
Hashes for pysolnp-2021.4.25-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db933655644aa359e635ac43cdc8712c373489f2ada40c5510a9742209c77890 |
|
MD5 | 103190df624fd1032f614f5b3a7d0d0f |
|
BLAKE2b-256 | 8e300ef0a31e9f7cedcca55e11dc9079b70b87acc24f11ae4a71ea833d146c7e |
Hashes for pysolnp-2021.4.25-cp36-cp36m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7222c3c66915ba26b05d8d9d16b5cc860be9cd32f2588de5f4999d5b4ffacbc7 |
|
MD5 | 77b173d2d582ad125a6d574d2d2667e5 |
|
BLAKE2b-256 | 3a7a027978db59df2a41df1871b465cf12510b9dae7cc0108ec8c5a709554d05 |
Hashes for pysolnp-2021.4.25-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed05d00073464c7e361e68a5e64ef7f465378cea3091a762defb0a16027ffb93 |
|
MD5 | 746e7b9ec506cfca0448b487e3c40455 |
|
BLAKE2b-256 | d25a3b23904428a6ef18b69f6d78c982009ec49da0a8cbc4236cf761bb71aa5e |
Hashes for pysolnp-2021.4.25-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee98e41a12516e9f0d1855c31b213d6fbcd1bf92f8561acfe5398fbd09773a31 |
|
MD5 | e9c0da815217ca0d97726cca89371794 |
|
BLAKE2b-256 | c063f92745c8bc9a4c62d8c8b19198095f94d47d6a05b66b4b230929f300c284 |
Hashes for pysolnp-2021.4.25-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c549338bd044c32c6268f4909b20c8276c2fdb9de004f60fbd0cd82157fe9ae |
|
MD5 | cef6c7b4090c4dcad2db74ce5aa45b40 |
|
BLAKE2b-256 | d458ff6e90c4bc6c51732fa0cc71c2fdd12596f63dfe2b6e1304bf8b3b71b20d |
Hashes for pysolnp-2021.4.25-cp35-cp35m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 948342eb97a7ff94a4c5a462d4cc83dfa2d724cc1ce8d19cbb49ea4179df84ac |
|
MD5 | e9bb8f7edf90ee53ed3a4c2fb8665331 |
|
BLAKE2b-256 | 0dab1a1f8611ab90a5c11feffb67d9f7a2cc27aabd38eeb589db04f0bd0b8062 |
Hashes for pysolnp-2021.4.25-cp35-cp35m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0a99503e137559bf9fd14b2c23a35c743a7cc008b438bbff16d5e3cae04dd7f |
|
MD5 | 8bad2060ed0a35ac62442b22786df8e9 |
|
BLAKE2b-256 | 4a7f27cf09e2d76ffae865bbd653bcf672d43bdd89691c4c4760260b7dea562d |
Hashes for pysolnp-2021.4.25-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8566d3d1ec5c9b099f6fb821b182cf589a2b99a3f63bdee503eab4f037bae3c |
|
MD5 | e79ee5c929691106eff853305b42d4e6 |
|
BLAKE2b-256 | 93c90620df01ca41f660863b94e78ff107e6ed376156bf48dbe49f458a110da4 |
Hashes for pysolnp-2021.4.25-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c49f53c33588ae14c21706181fc2c31d6e8fc2cd95c2c7d3577fa66a47a6eaf0 |
|
MD5 | de9233213c747e5404cff111709679d0 |
|
BLAKE2b-256 | dd6550cbf11c6c088ccbe4b5b02d7bbdf9fd0645383e3ad89f3352897ac29ede |
Hashes for pysolnp-2021.4.25-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a253db1ed0aa655b3eed2984a5969a477b05f3dc4c39569bdca1afccd427cae9 |
|
MD5 | b17c0e44918fc3227421bf3b91c4f20a |
|
BLAKE2b-256 | 8708a74a71ed332fa77f7fa860598242f0cdc94f5ca64bd623d653dba1f9899e |
Hashes for pysolnp-2021.4.25-cp27-cp27m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa81cfb6159a6a9cd5e3482bcab044124065fcfd9340f7449b8a9e57625f94a8 |
|
MD5 | 8e7ded878d1982336240d15c74e13808 |
|
BLAKE2b-256 | c75c12e910e58ff93e2d37da05dc9301c91955025e6292fc0259cceb1ff6a258 |
Hashes for pysolnp-2021.4.25-cp27-cp27m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 993c5e30b27052894811ed5266d309fb57b66fcfb396b81c1157f650406237e9 |
|
MD5 | 13f5d1e55d6187b8d0988b49510b02ef |
|
BLAKE2b-256 | 27e5f78bb6acf853c38b07a824ec96c902199f95d0c66c7c8d545c4871c62a8d |