Converter from numpy to cvxopt.
Project description
NpyCVX
A small library to connect numpy and CVXOPT together and solves all messy conversions in between.
Install
pip install npycvx
Example usage
A simple example when maximizing w^T x
over the same system of linear inequalities.
import numpy as np
import npycvx
import functools # <- built-in python lib...
# Some dummy data...
A = np.array([
[-1, 1, 1],
[-2,-1,-1]
])
b = np.array([0,-3])
objectives = np.array([
[ 0, 0, 0],
[ 1, 1, 1],
[-1,-1,-1],
[ 1, 0, 1],
])
# Load solve-function with the now converted numpy
# matrices/vectors into cvxopt data type...
solve_part_fn = functools.partial(
npycvx.solve_lp,
*npycvx.convert_numpy(A, b),
False
)
# Exectue each objective with solver function
solutions = list(
map(
solve_part_fn,
objectives
)
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
npycvx-0.0.4.tar.gz
(4.2 kB
view details)
Built Distribution
File details
Details for the file npycvx-0.0.4.tar.gz
.
File metadata
- Download URL: npycvx-0.0.4.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.18 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddba97e66a31863b90cf7844d78ac4f3d69e28d3c13cbbf84bac5d256ac708e1 |
|
MD5 | 353ffae0d26c1b0fbe4fe818533ce418 |
|
BLAKE2b-256 | 45a3ad745fc09da6f7023c7dc67d5a501ab910522a12fc24059156cd738c7a98 |
File details
Details for the file npycvx-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: npycvx-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.18 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2da9a37d47a9229e785b91ecd0dcad0daeb6b57a84ccddecf8db23bc2c625082 |
|
MD5 | 0ce0d84ce361ee5f309a1b3faad82ea7 |
|
BLAKE2b-256 | db96c9a2e388d6d5a5a13caaeea81e24e0a929ea564c672c2401ed636a36a5b0 |