This provides the SOLNP optimizaiton Algorithm.
Project description
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_x
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:
pip install pysolnp
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
Output:
>>> result.solve_value
-48.11252206814995
>>> result.optimum
[2.8867750707815447, 2.8867750713194273, 5.773407748939196]
>>> result.callbacks
118
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 | double | The value of the objective function at optimum f(x*). |
optimum | list[double] | A list of parameters for the optimum x*. |
callbacks | int | Number of callbacks done to find this optimum. |
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-2020.4.11-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af7b57b312f82c712a42223502f642137249a8a55e03ddc15abd213b6b304f38 |
|
MD5 | 8899c0681929377ee13ffe9eeea4a630 |
|
BLAKE2b-256 | 6721910dc9ae09d811185d8b780a3c6540abe8140ac90996d433bdd2987f438e |
Hashes for pysolnp-2020.4.11-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 963cf1eb29d67cc817daf3737876fc64804ec3d0f40d3c9f236c239a18aa6b64 |
|
MD5 | 73fd84142c2052311d7692958a6ef0ca |
|
BLAKE2b-256 | 7ea55bbd1df0a8a63c2a07336bd2e4409302e89340dd194e0e205680b9159216 |
Hashes for pysolnp-2020.4.11-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47e209d14d791c18cb32fa58b705118dede8f5a519478fb0014e727c021790c8 |
|
MD5 | eee07e625dc675817c9c4c5335e2181f |
|
BLAKE2b-256 | a76e2c113551236bb55447298f68702496c3f197fcae80d8c396955037dcfa6a |
Hashes for pysolnp-2020.4.11-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0407ba1aa18d2b70597ba50d51c7be50efc83ddd5a750ef64db31b1535c9e5af |
|
MD5 | dba7a74adde9c242c1cdf557816d0573 |
|
BLAKE2b-256 | eaba328be674f68f7ca6cc79a382f945ef82112a8496f7e1449c9f568a01af87 |
Hashes for pysolnp-2020.4.11-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 932da30a0cf86b4a119c4610e97806045807df284a5d8810a6b2f4555ee6dd71 |
|
MD5 | a764c2be86c35f151f1da32c7be0cb58 |
|
BLAKE2b-256 | 90890143c999df45c547c65d11c377dc9ec3031f405cfb50c22a3e05daac1cb0 |
Hashes for pysolnp-2020.4.11-cp38-cp38-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 441e1426360135bdb61db504606958480f4e735286f1f1dca1d6ac3fbb31b6da |
|
MD5 | d9a8279260934948906c1b2c96e5ac85 |
|
BLAKE2b-256 | 7ea8a8622a7a671eb2a712f27e1b654fa3489dbf60112ac6328ca1f39d3ac488 |
Hashes for pysolnp-2020.4.11-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d38b33e9a0f0a4b27200a86ba52ddc90140f6a5e695e246fa757c14974524d |
|
MD5 | d7abd58dc08b51367996c88acab1073a |
|
BLAKE2b-256 | b688e526f5fc7007b2a8463555f7fbb72edf64564e8d5fd43974b04d5a536b4e |
Hashes for pysolnp-2020.4.11-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6068280829ea8c044d40287cf1a7b5236b86483268c1f17e7847937e359983d |
|
MD5 | 6a7b057dd92b6501c634be271548d92f |
|
BLAKE2b-256 | 5c5feeec932a793247d101a5759435efcde0c0bba465d43bd476a2ae7ba0c31b |
Hashes for pysolnp-2020.4.11-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 619a59b10bcc5a7f62687cb37d3731d8b6e328c7a02858d814054e613648806d |
|
MD5 | 121bdadbc2f4263e3eed6ce0f6d68d11 |
|
BLAKE2b-256 | 1706a40e0b52d3ece36c78ee845d179bda259817e80231a68ce077b12b5a66bb |
Hashes for pysolnp-2020.4.11-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4ad8b1ad6e38688872fd53604f10307b4b93c14904af0e08d80947821f1fd80 |
|
MD5 | b1e1344b49cf4d8ffef50aa025167739 |
|
BLAKE2b-256 | dfcaf076b421ab627e4835308d03327d2bdd3badc30e7bc1ccd70b8173431f0e |
Hashes for pysolnp-2020.4.11-cp37-cp37m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02bed8925d349335d3ee67c17da208cd402a7e332c4e640fb70cf387a7857212 |
|
MD5 | 321bd9a41b0a453c38ae9b08d4490f0b |
|
BLAKE2b-256 | d896c37c7c714d9ca9f954a14b36fb5e38e7cba49dcdc91702de9f8c7682a8d6 |
Hashes for pysolnp-2020.4.11-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9279e86771c6122f5db4232a88d1a52287a0a49f67013eadd3d74fed227c205e |
|
MD5 | 8deee864fe66c8f283d449aaf3835b1f |
|
BLAKE2b-256 | c990e9ed6bdda1c46f2ae27d603b2cd3d65e58f7b44c253f9a646b8746d1b5c2 |
Hashes for pysolnp-2020.4.11-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11ac9211af51725bce229ab2302f748ffc3efb6c6a2b8793bf75c8290d764323 |
|
MD5 | a201b0eb4db0b338f9b65ba4b9d2da8e |
|
BLAKE2b-256 | ab11d7b2a5514b60230afcd4464efb9d4dc0bde83fbc62983419014642e362c8 |
Hashes for pysolnp-2020.4.11-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e89190eed5a33f506b74cba186c554f426cf757417dee7e41365e36aecb43d65 |
|
MD5 | 25bcc7f08639e5cef11a39589001ce44 |
|
BLAKE2b-256 | e5ff12b4adf851a447de871902dd0e31f1dd6d9a1ad68294cef9681f9e280fee |
Hashes for pysolnp-2020.4.11-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ead2aec88019f21ae162f00c4df64336578cf36e1f725c84b36219aed1dea11 |
|
MD5 | 40575ba09ade2d0ffeab645911ddcada |
|
BLAKE2b-256 | 103fcf0485c302a6e3c94b12157ee68cfd5dc99baed2bce13dab7eb10efd26c0 |
Hashes for pysolnp-2020.4.11-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d77f7e4c2982c09b246908a505f32c2bb74e06a6f5f3463edf558f1a2e93b39 |
|
MD5 | ddeacb0f7169efb10df16130a3d50683 |
|
BLAKE2b-256 | 50b7c71469b757a87f0e66de2fb7c4cae74773c404bd4837522e807e3f9369db |
Hashes for pysolnp-2020.4.11-cp36-cp36m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4bde27672ef0246fca393e8d2fdf5cf4863a2216f36703b836d1278aacd01c7 |
|
MD5 | a0146ac0457f1869c17c80cccdfec018 |
|
BLAKE2b-256 | e89cce03b09e121ada96b02039a06905ef112546a92009ad79cf21a3279fdac8 |
Hashes for pysolnp-2020.4.11-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d7ba7561c0cb8d474e93755d2f357664a787a3dc7e056d35525e9e614af47d6 |
|
MD5 | d63aa248bbeabf3c61fcadcce6d5ceb2 |
|
BLAKE2b-256 | f39b5e4008f6425c52aeca07c2f133580f729d33b40d5bb2e1016f0443b716a3 |
Hashes for pysolnp-2020.4.11-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fbd5a44d2396e96498b8f87939b3284a62cfb8249ce3970d679350174e89e06 |
|
MD5 | 1437d1f2fbe01d046132761bd300d7f7 |
|
BLAKE2b-256 | 8bed41de7a7d1cde1dfeeed5db200efcd09c4fcde40647e8406cbf0e18b9b19a |
Hashes for pysolnp-2020.4.11-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ca659496d3da00f86b09f988d22b7a992768b16b5d3e7600f1710968eb3c0f6 |
|
MD5 | c18f7ef86023505621ca169ba646e7e3 |
|
BLAKE2b-256 | 2449a9dc1d6791ff79b2b30a31a5accd65557b1fcd0895de8a7d6ebf869982e4 |
Hashes for pysolnp-2020.4.11-cp35-cp35m-manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f302227a361ac85979bc2854f7f1030b8a88dece422086195f08a3f9a5785e95 |
|
MD5 | 450ec82bb9c787bf922b205abeeeffca |
|
BLAKE2b-256 | 1edb5baf5beecec706b74ad4a82f73ce8dd8b2b9ec42a4d8e999213730d482d7 |
Hashes for pysolnp-2020.4.11-cp35-cp35m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7689afb60ca1ab62bd2e568092ef11b3fe133d04c5b0219a063680244422234d |
|
MD5 | d6b4ee532ae460b7183eefa277217a1f |
|
BLAKE2b-256 | 53364299753772f048a68b867c7849dcd286d06ef80eb10875750a5dc440cf16 |
Hashes for pysolnp-2020.4.11-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 705e8fd984093e8a772bf3b666aa78abce41ac7c33c0378eb9e0aec15781a767 |
|
MD5 | 5c9b24f06fb8e5b58aac288682d58ad2 |
|
BLAKE2b-256 | 8695cf63a81d37d8d81f29df8d3767d17e8cea8511400e915c9f67d1412952d6 |
Hashes for pysolnp-2020.4.11-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76cdaea0640707e62d3d91c260d97e8498cc15e5bc41a1a3af74acd74984e3b3 |
|
MD5 | 06d43c2b203dd8f083becb8f16d83daa |
|
BLAKE2b-256 | a8bb0f66773f5c1138e90a8cbc47fd28a8c8498abf43f74e8d8654c4503f8d74 |
Hashes for pysolnp-2020.4.11-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffd8438e48741fa534b0dde49dd1f1b1ace3c78dab9004f3ce71b10f94851569 |
|
MD5 | 7357709cddbcca2bb33a30590aa9a3be |
|
BLAKE2b-256 | d417399800865112588eec7acd359adbbc226fcf8eb1bf7c7302503755c45ff2 |
Hashes for pysolnp-2020.4.11-cp27-cp27m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccc10dadf1e2632ab52475ecafbedd18758974de9174444b558da5a0fe3ffb3c |
|
MD5 | 86e5933ea1e4665bb9937ab5dc397607 |
|
BLAKE2b-256 | 1ad81244cf47a55637e7a3af35f8aaaaa829370ff5f68d930b29d311b374e995 |
Hashes for pysolnp-2020.4.11-cp27-cp27m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06deffd869b1ef23f24dfc4d01591a6cad1cb567f784d0ad1ffb52e7ef6745be |
|
MD5 | 435d6f660daba4ca833481c0e25d4540 |
|
BLAKE2b-256 | 1403fcc5472288e940a1e01bac4adcf79d050f439c921377a9f902ac8c146fb4 |