Python¶
After installing you can import SCS using
import scs
This 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=int(1e5),
scale=0.1,
adaptive_scale=True,
eps_abs=1e-4,
eps_rel=1e-4,
eps_infeas=1e-7,
alpha=1.5,
rho_x=1e-3,
acceleration_lookback=0,
acceleration_interval=1,
time_limit_secs=0,
write_data_filename=None,
log_csv_filename=None)
where data
is a dict containing P, A, b, c
, and cone
is
a dict that contains that Cones information.
The b
, and c
must be 1d numpy arrays and P
and A
must be scipy sparse matrices in CSC format; if they are not of the proper
format, SCS will attempt to convert them. The remaining fields are explained
in Settings.
At termination sol
is a dict with fields x, y, s, info
where
x, y, s
contains the primal-dual solution or the
certificate of infeasibility, and info
is a dict
containing the solve Return information.
Warm-starting¶
Warm-starting SCS with a guess of the primal-dual solution can reduce the total
solve time. This is useful, for example, when solving several similar problems
sequentially. To do this add to the data
dict passed to
scs.solve
the additional fields x
, y
, and s
(or
any subset thereof) where x
and s
correspond to numpy arrays
containing the primal solution guesses and y
corresponds to a numpy
array containing the dual solution guess.