Skip to content

cHYzZQo/scs-python

 
 

Repository files navigation

scs-python

Build Status Build status

Python interface for SCS 2.0.0 and higher.

To install using pip (recommended) use:

pip install scs

To install SCS from source:

git clone --recursive https://github.com/bodono/scs-python.git
cd scs-python
python setup.py install

You 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 --gpu

To test that SCS installed correctly and you have nose installed, run

nosetests

you can also solve a random cone problem (without nose) using

python test/solve_random_cone_prob.py

After installing the SCS interface, you import SCS using

import scs

This module provides a single function solve with the following call signature:

sol = scs.solve(data, cone, use_indirect=True, 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=20)

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.

About

Python interface for SCS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 79.4%
  • Python 13.2%
  • C 7.4%