Python interface for SCS 2.0.0 and higher.
To install using pip (recommended) use:
pip install scsTo install SCS from source:
git clone --recursive https://github.com/bodono/scs-python.git
cd scs-python
python setup.py installYou may need sudo privileges for a global installation. Running SCS requires
numpy and scipy to be installed. You can install the gpu interface using
python setup.py install --scs --gpuTo test that SCS installed correctly and you have nose installed, run
nosetestsyou can also solve a random cone problem (without nose) using
python test/solve_random_cone_prob.pyAfter installing the SCS interface, you import SCS using
import scsThis module provides a single function solve with the following call signature:
sol = scs.solve(data,
cone,
use_indirect=False,
gpu=False,
verbose=True,
normalize=True,
max_iters=5000,
scale=1,
eps=1e-5,
cg_rate=2,
alpha=1.5,
rho_x=1e-3,
acceleration_lookback=10,
write_data_filename=None)The argument data is a python dictionary with three elements A, b, and c
where b and c are 1d NUMPY arrays and A is a SCIPY sparse matrix in
CSC format; if they are not of the proper format, SCS will attempt to convert
them.
The argument cone is a dictionary with fields f, l, q, s, ep, ed,
and p (all of which are optional) corresponding to the supported cone types.
The returned object is a dictionary containing the keys 'x', 'y', 's', and
'info'. The first three are NUMPY arrays containing the respective solution
vector. The 'info' value is a dictionary with solver information.