SCS (splitting conic solver
) is a numerical optimization package for solving
large-scale convex cone problems. The current version is 3.2.4
.
The full documentation is available here.
If you wish to cite SCS please cite the papers listed here.
Splitting Conic Solver
License: MIT License
When I run cvx_setup, it does not find the scs solver among its shims even though mex compiled fine. Am I missing a step?
make_scs.m ran without any problems. scs compiled nicely under Windows 7 using the SDK 7.1 compiler. I see scs_direct.mexw64, scs_indirect.mexw64. \scs-master\matlab\ is in the matlab path. But scs does not appear in the list of solvers when I run cvx_setup. This may be a cvx question, so I will post it there, too.
In contrast, ECOS came with three additional cvx-specific files
cvx_install_ecos.m,
cvx_solver_shim.m
cvx_conelp.m.
I ran cvx_install_ecos then cvx_setup. Then ecos appeared as a solver along with sedumi and sdpt3. scs does not appear in that list.
Hi,
I can't find the cvx_install_scs file. Is it bundled with cvx? I'm using CVX professional version 2.1, and I don't see it anywhere in the cvx folder.
Thanks,
Dj
Right now the setup.py script has e.g. root_dir + 'include'
, which doesnt work if root_dir doesnt have a trailing slash. Either enforce the trailing slash, or better yet, use os.path.join
.
I've run several times into this error:
m must be greater than or equal to n
ERROR: Validation returned failure
ERROR: Could not initialize work
FAILURE
is this condition necessary for SCS to solve the problem? Usually the problem will be unbounded in such a situation, but it would be nice if SCS could determine that for cvxpy.
I tried the pip installer on an Ubuntu machine, and it needed a fortran compiler. Is that supposed to be the case? Even with a fortran compiler, the installation failed. Here's the error log:
ATLAS version 3.8.4 built by ilan on Mon Jul 9 23:32:04 CDT 2012:
UNAME : Linux centos5x86 2.6.18-308.el5 #1 SMP Tue Feb 21 20:06:06 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
INSTFLG : -1 0 -a 1
ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_Corei1 -DATL_CPUMHZ=3296 -DATL_SSE3 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
F2CDEFS : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
CACHEEDGE: 524288
F77 : gfortran, version GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
F77FLAGS : -O -fPIC -m64
SMC : gcc, version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
SMCFLAGS : -fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fno-schedule-insns2 -fPIC -m64
SKC : gcc, version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
SKCFLAGS : -fomit-frame-pointer -mfpmath=sse -msse3 -O2 -fno-schedule-insns2 -fPIC -m64
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_dump.c:16:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
from /home/travis/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /home/travis/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15,
from scsmodule.c:6:
/home/travis/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_aat.c:18:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_preprocess.c:19:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_post_tree.c:13:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/amd_global.c:12:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
linsys/direct/external/amd_global.c:76:41: warning: initialization from incompatible pointer type [enabled by default]
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_info.c:15:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_control.c:16:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_1.c:27:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_postorder.c:13:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_valid.c:36:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_2.c:16:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_order.c:15:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/include/python2.7/Python.h:8:0,
from include/glbopts.h:12,
from linsys/direct/external/SuiteSparse_config.h:45,
from linsys/direct/external/amd.h:46,
from linsys/direct/external/amd_internal.h:168,
from linsys/direct/external/amd_defaults.c:15:
/home/travis/anaconda/include/python2.7/pyconfig.h:1179:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
In file included from /home/travis/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
from /home/travis/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /home/travis/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15,
from scsmodule.c:6:
/home/travis/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
I ran into an issue with SDPs when trying to update cvxpy to interface with SCS 1.1.0. Either I don't understand the interface, or something is wrong in SCS.
Here's a script that returns the wrong answer:
import numpy as np
import scipy.sparse as sp
import scs
A = np.array([[ 0., 1., 0., 0., 0., -1.],
[-1., 0., 0., 1., 0., 0.],
[ 0., 0., 0., 0., 1., -1.],
[ 1., 0., 0., 0., 0., 0.],
[ 0., 0., -1., 1., 0., 0.],
[ 0., -1., 0., 0., 0., 0.],
[ 0., 0., -1., 0., 0., 0.],
[ 0., 0., 0., 0., -1., 0.]])
A = sp.csc_matrix(A, dtype=np.double)
data = {'A':A, 'c': np.array([ 0., 0., 0., 0., 0., 1.]), 'b': np.array([-0., -0., -0., 2., -0., -0., -0., -0.])}
dims = {'q': [], 's': [2], 'f': 5, 'l': 0, 'ep': 0}
scs.solve(data, dims)
The value of the last primal variable should be 2, but instead it's sqrt(2). Also, the values of s
corresponding to the PSD constraint aren't PSD.
Is there a way to warm start SCS through the Python interface? It doesn't look like the option is available. I'd like to have the ability to warm start SCS in cvxpy.
Hi,
I am using OpenMP version of SCS solver, I would like to know what are the factors that can impact number of threads used for solving a problem.
In particular, I have a machine with 20 cores, specifying OMP_NUM_THREAD=20
uses only 10 of the 20 cores and increasing number of cores does not change the actual number of cores used.
I'm having a problem with pip install on Travis CI after the latest SCS commit. You can see the log here:
https://travis-ci.org/cvxgrp/cvxpy/jobs/109486048
Any ideas about what's going on?
Is it possible to write my own cost(penalty) function and then use CVXPY to call my own cost function to do optimization?
As an example, I would like to test something similar to the huber cost function, so it looks like this:
f(x) = x2 if |x| < M
f(x) = M2 if |x| >=M
and I would like to minimize sum(f(x)) over all my datapoints. I tried to write something like this(But it's not working):
def cost(X, y, b, M=1):
y_fit = X * b
t = abs(y - y_fit)
flag = t > M
return np.sum((~flag) * (t ** 2) + (flag) * (M**2)
coeffs = CVX.Variables(n)
ourcost = lambda coeffs : cost(X, y, coeffs, 1)
objective = cvx.Minimize(ourcost)
constraints = [coeffs > 1e-8]
prob = cvx.Problem(objective, constraints)
prob.solve(solver='SCS', eps=1e-6, verbose=True, use_indirect=False)
........
Any suggestions? Thanks!
Jimmy
Is it possible to write my own cost(penalty) function and then use CVXPY to call my own cost function to do optimization?
As an example, I would like to test something similar to the huber cost function, so it looks like this:
f(x) = x2 if |x| < M
f(x) = M2 if |x| >=M
and I would like to minimize sum(f(x)) over all my datapoints. I tried to write something like this(But it's not working):
def cost(X, y, b, M=1):
y_fit = X * b
t = abs(y - y_fit)
flag = t > M
return np.sum((~flag) * (t ** 2) + (flag) * (M**2)
coeffs = CVX.Variables(n)
ourcost = lambda coeffs : cost(X, y, coeffs, 1)
objective = cvx.Minimize(ourcost)
constraints = [coeffs > 1e-8]
prob = cvx.Problem(objective, constraints)
prob.solve(solver='SCS', eps=1e-6, verbose=True, use_indirect=False)
........
Any suggestions? Thanks!
Jimmy
CVX is not able to load scs_matlab as solver in matlab.
The problem seems to occur in cvx_setup.m line 103
nsolvers = [ nsolvers, tsolv ]; %#ok
because cvx_scs_matlab
returns a shim with the extra field shim.config
which is not occuring in the other solvers in nsolvers
.
I'm running CVX Version 2.1, Build 1110 (66e9a9c).
Hi,
SOCP is new to me. I'm learning convex optimization by following the Boyd & Vandenberghe (2010) Book. I'm very excited to find SCS and want to use to solve problems listed in that book.
However, it is not quite clear to me how to convert a SOCP problem into the standard form of SCS. In Chapter 4 of Boyd&Vandenberghe's book, Page 156, SOCP is defined with both equality and inequality form. It is not clear how to use SCS to solve it.
I have read the paper introducing SCS. However, converting to the standard form is skipped (I guess it is obvious to experts in this field).
I also read the python example of minimizing L-1 norm. But setting up the input matrices looks like magic to me.
So, I'm wondering whether anyone can point me to some papers/tutorials about how to convert SOCP problems to the standard from of SCS. It will be great if the authors can add a few examples, solving problems listed in Boyd &. Vandenberghe (2010). I think it will help many beginners a lot.
Thanks very much!
Tao
I'm documenting the SCS solver options on the cvxpy website.
I couldn't find any use of UNDET_TOL
in the code. What does this option do?
Also, would you mind briefly explaining what ALPHA
does?
I'm coding in C. I have all my data organized in the form that SCS needs to take but when I call the SCS functions, I get
ERROR: A->p (column pointers) decreasing
invalid linear system input data
ERROR: Validation returned failure
ERROR: NULL input
I've seen a github issue with this error here. jump-dev/Convex.jl#88. I can provide more information if needed as well.
Thanks!
When I test cvxpy with SCS on Ubuntu, I get memory errors. You can see an example here:
https://travis-ci.org/cvxgrp/cvxpy/jobs/65967866
If I run all the tests without SCS, there are no memory errors (nor were there with the old SCS). So I strongly suspect the issue is in SCS.
Here's a terminal.com snapshot I've been using to replicate the memory error:
https://www.terminal.com/snapshot/e25a3905cd195111dfd8fdf92ecda788a2226ebacf3930a518c4fe604ee36631
I noticed there is a GPU support for SCS now in master. I tried it but failed to install.
After running make purge && make && make gpu
and compiling gpu component I run setup.py with GPU=True
. However, I get following error:
/usr/bin/ld: cannot find -lscsgpu
/usr/bin/ld: skipping incompatible /usr/local/cuda/lib/libcudart.so when searching for -lcudart
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: skipping incompatible /usr/local/cuda/lib/libcublas.so when searching for -lcublas
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: skipping incompatible /usr/local/cuda/lib/libcusparse.so when searching for -lcusparse
/usr/bin/ld: cannot find -lcusparse
collect2: error: ld returned 1 exit status
/usr/bin/ld: cannot find -lscsgpu
/usr/bin/ld: skipping incompatible /usr/local/cuda/lib/libcudart.so when searching for -lcudart
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: skipping incompatible /usr/local/cuda/lib/libcublas.so when searching for -lcublas
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: skipping incompatible /usr/local/cuda/lib/libcusparse.so when searching for -lcusparse
/usr/bin/ld: cannot find -lcusparse
collect2: error: ld returned 1 exit status
Any suggestions why this may happen?
When I import scs 1.2.2 in OS X I get
>>> import scs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "scs.py", line 4, in <module>
import _scs_direct
ImportError: dlopen(/Users/stevend2/anaconda/envs/cvxpy/lib/python2.7/site-packages/scs-1.2.2-py2.7-macosx-10.5-x86_64.egg/_scs_direct.so, 2): Library not loaded: libmkl_intel_lp64.dylib
Referenced from: /Users/stevend2/anaconda/envs/cvxpy/lib/python2.7/site-packages/scs-1.2.2-py2.7-macosx-10.5-x86_64.egg/_scs_direct.so
Reason: image not found
SCS 1.2.1 works fine.
As mentioned in #12, on windows one really wants to link against a static libblas.a
(actually libblas.lib
) since there are no system libraries. In situations like this, it would be convenient to be able to configure the scs blas linkage independently of numpy, for example by simply loading include path, library path and library names from environment variables or --command-line-flags, instead of looking to numpy.distutils
.
I just installed scs, and I'm using it in c++. I have an SDP problem, a matrix X, entries of it are variables. There are some linear constraints on its entries, including some equations and inequalities.
For example, X is a 2 * 2 symmetric semidefinite matrix, I want X[1, 1] - X[1, 2] >= 0, X[1, 1] - X[2, 2] <=5, something like that. I don't have a objective, but just want to find out a feasible solution.
Can you give an more detailed tutorial, I know I need to build a Data, and a Cone, but don't know how, thank you.
when I try to run make scs in a new computer, It fails, even when mex -setup works fine. It gives me the following messages:
Building with 'Microsoft Visual C++ 2015 (C)'.
Error using mex
Creating library E:\Ghafarian\scs-master\matlab\scs_direct.lib and object E:\Ghafarian\scs-master\matlab\scs_direct.exp
common.obj : error LNK2001: unresolved external symbol _mxMalloc
scs_mex.obj : error LNK2001: unresolved external symbol _mxMalloc
private.obj : error LNK2001: unresolved external symbol _mxMalloc
amd_global.obj : error LNK2001: unresolved external symbol _mxMalloc
cones.obj : error LNK2001: unresolved external symbol _mxMalloc
cs.obj : error LNK2001: unresolved external symbol _mxMalloc
scs.obj : error LNK2001: unresolved external symbol _mxMalloc
common.obj : error LNK2001: unresolved external symbol _mxCalloc
scs_mex.obj : error LNK2001: unresolved external symbol _mxCalloc
private.obj : error LNK2001: unresolved external symbol _mxCalloc
amd_global.obj : error LNK2001: unresolved external symbol _mxCalloc
cones.obj : error LNK2001: unresolved external symbol _mxCalloc
cs.obj : error LNK2001: unresolved external symbol _mxCalloc
scs.obj : error LNK2001: unresolved external symbol _mxCalloc
scs.obj : error LNK2001: unresolved external symbol _mxFree
common.obj : error LNK2001: unresolved external symbol _mxFree
scs_mex.obj : error LNK2001: unresolved external symbol _mxFree
private.obj : error LNK2001: unresolved external symbol _mxFree
amd_global.obj : error LNK2001: unresolved external symbol _mxFree
cones.obj : error LNK2001: unresolved external symbol _mxFree
cs.obj : error LNK2001: unresolved external symbol _mxFree
util.obj : error LNK2001: unresolved external symbol _mxFree
amd_global.obj : error LNK2001: unresolved external symbol _mxRealloc
common.obj : error LNK2019: unresolved external symbol _mexPrintf referenced in function _freeAMatrix
scs_mex.obj : error LNK2001: unresolved external symbol _mexPrintf
ldl.obj : error LNK2001: unresolved external symbol _mexPrintf
cones.obj : error LNK2001: unresolved external symbol _mexPrintf
util.obj : error LNK2001: unresolved external symbol _mexPrintf
scs.obj : error LNK2001: unresolved external symbol _mexPrintf
cones.obj : error LNK2019: unresolved external symbol _dsyevr referenced in function _projSemiDefiniteCone
cones.obj : error LNK2019: unresolved external symbol _dsyr referenced in function _projSemiDefiniteCone
cones.obj : error LNK2019: unresolved external symbol _dscal referenced in function _projSemiDefiniteCone
cones.obj : error LNK2019: unresolved external symbol _dnrm2 referenced in function _projSemiDefiniteCone
scs.obj : error LNK2019: unresolved external symbol _mexEvalString referenced in function _printFooter
ctrlc.obj : error LNK2019: unresolved external symbol _utIsInterruptPending referenced in function _isInterrupted
ctrlc.obj : error LNK2019: unresolved external symbol _utSetInterruptEnabled referenced in function _endInterruptListener
scs_mex.obj : error LNK2019: unresolved external symbol _mxGetNumberOfDimensions_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxGetDimensions_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxGetIr_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxGetJc_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxIsSparse referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxGetPr referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxSetPr referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxSetM_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxIsEmpty referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxGetField_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxSetField_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxSetN_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxCreateDoubleMatrix_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxCreateString referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mxCreateStructArray_730 referenced in function _mexFunction
scs_mex.obj : error LNK2019: unresolved external symbol _mexErrMsgTxt referenced in function _mexFunction
C:\Program Files\MATLAB\MATLAB Production Server\R2015a\extern\lib\win64\microsoft\libut.lib : warning LNK4272: library machine type 'x64' conflicts with
target machine type 'X86'
C:\Program Files\MATLAB\MATLAB Production Server\R2015a\extern\lib\win64\microsoft\libmwblas.lib : warning LNK4272: library machine type 'x64' conflicts with
target machine type 'X86'
C:\Program Files\MATLAB\MATLAB Production Server\R2015a\extern\lib\win64\microsoft\libmwlapack.lib : warning LNK4272: library machine type 'x64' conflicts
with target machine type 'X86'
C:\Program Files\MATLAB\MATLAB Production Server\R2015a\extern\lib\win64\microsoft\libmx.lib : warning LNK4272: library machine type 'x64' conflicts with
target machine type 'X86'
C:\Program Files\MATLAB\MATLAB Production Server\R2015a\extern\lib\win64\microsoft\libmex.lib : warning LNK4272: library machine type 'x64' conflicts with
target machine type 'X86'
C:\Program Files\MATLAB\MATLAB Production Server\R2015a\extern\lib\win64\microsoft\libmat.lib : warning LNK4272: library machine type 'x64' conflicts with
target machine type 'X86'
E:\Ghafarian\scs-master\matlab\scs_direct.mexw32 : fatal error LNK1120: 28 unresolved externals
Error in compile_direct (line 17)
eval(cmd);
Error in make_scs (line 44)
compile_direct(flags, common_scs);
what is wrong? what should I do?
Thank you very much.
Hi,
I have been experimenting with the GPU version and managed to run out of memory! Is there any documentation of how the GPU implementation works? is there a way to address the memory issue?
When solving the unconstrained trace-norm minimization problem
minimize_X (1/2)||X - Z||_F^2 + \lambda ||X||_*
,
the solver (SCS) converges to X = 0 for certain sizes of X when there exists a nonzero solution. In particular, this appears to occur when X is square with side length a power of 2 and at least 256. The matrix Z = X_0 + W, where X_0 is a random rank-1 matrix with unit Frobenius norm, and W has iid Normal(0, \sigma^2) entries. The parameter \lambda is computed based on the size of Z and the noise level (code below).
The fact that I'm seeing "convergence to zero" and that it has this power-of-2 dependence made me think something is going on in SCS, but I haven't been able to eliminate CVXPY as the source of the bug. Solving with CVXOPT gobbles up too much memory. Solving this problem with CVX and SCS in MATLAB works as expected, but CVX also passes a different representation to SCS. Maybe @SteveDiamond has some thoughts on this.
Running Python 3.5.1 (brew installed) on OS X 10.10.5 with these CVXPY prerequisites:
CVXcanon (0.0.23.3)
cvxopt (1.1.8)
cvxpy (0.3.9)
ecos (2.0.4)
multiprocess (0.70.4)
numpy (1.11.0)
scipy (0.17.0)
scs (1.2.3)
setuptools (20.3.1)
toolz (0.7.4)
import cvxpy
import numpy as np
SHAPE = (256, 256)
SNR = 10.0 # 10.0 dB SNR
SIGMA = 10.0**(-SNR/20.0)*(1.0/np.sqrt(np.prod(SHAPE))) # compute noise level
LAMBDA = SIGMA*(np.sqrt(SHAPE[0]) + np.sqrt(SHAPE[1])) # penalty constant
# Generate a random rank-1 matrix X0, and corrupt it with noise
u = np.random.normal(size=(SHAPE[0], 1))
v = np.random.normal(size=(SHAPE[1], 1))
X0 = np.dot(u, v.T)
X0 = X0/np.linalg.norm(X0, 'fro') # normalize
Xnoisy = X0 + np.random.normal(scale=SIGMA, size=SHAPE)
# Set up the optimization problem
# minimize_X 0.5*||X - Xnoisy||^2_F + LAMBDA*||X||_*
X = cvxpy.Variable(*SHAPE)
measerr = 0.5*cvxpy.norm(X - Xnoisy, 'fro')**2 # measurement error
reg = LAMBDA*cvxpy.norm(X, 'nuc') # regularizer (trace norm)
prob = cvxpy.Problem(cvxpy.Minimize(measerr + reg))
prob.solve(solver=cvxpy.SCS, verbose=True)
# Calculate the objective at X0---a feasible point---using cvxpy
objX0 = ((0.5*cvxpy.norm(X0 - Xnoisy, 'fro')**2).value +
LAMBDA*cvxpy.norm(X0, 'nuc').value)
# Also calculate the objective at zero
obj0 = 0.5*np.linalg.norm(Xnoisy, ord='fro')**2
print('CVXPY status: {0}'.format(prob.status))
print('objective(X): {0}'.format(prob.objective.value))
print('objective(0): {0}'.format(obj0))
print('objective(X0): {0}'.format(objX0)) # X0 is a feasible point
print('||X||_* = {0}'.format(np.linalg.norm(X.value, ord='nuc')))
Running an instance of this script returns the following output:
----------------------------------------------------------------------------
SCS v1.2.3 - Splitting Conic Solver
(c) Brendan O'Donoghue, Stanford University, 2012-2016
----------------------------------------------------------------------------
Lin-sys: sparse-direct, nnz in A = 524036
eps = 1.00e-03, alpha = 1.50, max_iters = 2500, normalize = 1, scale = 1.00
Variables n = 327682, constraints m = 393220
Cones: primal zero / dual free vars: 196352
soc vars: 65540, soc blks: 2
sd vars: 131328, sd blks: 1
Setup time: 2.63e-01s
----------------------------------------------------------------------------
Iter | pri res | dua res | rel gap | pri obj | dua obj | kap/tau | time (s)
----------------------------------------------------------------------------
0| inf inf nan -inf inf inf 1.03e-01
20| 3.12e-05 4.02e-05 9.86e-06 5.49e-01 5.49e-01 1.16e-16 1.25e+00
----------------------------------------------------------------------------
Status: Solved
Timing: Solve time: 1.26e+00s
Lin-sys: nnz in L factor: 1244938, avg solve time: 8.16e-03s
Cones: avg projection time: 4.25e-02s
----------------------------------------------------------------------------
Error metrics:
dist(s, K) = 6.6613e-16, dist(y, K*) = 3.3307e-15, s'y/|s||y| = -3.2417e-16
|Ax + s - b|_2 / (1 + |b|_2) = 3.1215e-05
|A'y + c|_2 / (1 + |c|_2) = 4.0243e-05
|c'x + b'y| / (1 + |c'x| + |b'y|) = 9.8596e-06
----------------------------------------------------------------------------
c'x = 0.5488, -b'y = 0.5488
============================================================================
CVXPY status: optimal
objective(X): 0.5487381817397832
objective(0): 0.5487508250412936
objective(X0): 0.0894842367535229
||X||_* = 7.490368228752549e-05
We compare the objective value with that using the original matrix X0
, a feasible point, just to illustrate that the solution returned is suboptimal for the original problem. Note that requiring higher accuracy by setting eps=1e-6
in the options to SCS will push the solution closer to zero. That is, it appears we are really seeing convergence to zero in SCS.
Running with SHAPE = (257, 257)
, for instance, gives:
----------------------------------------------------------------------------
SCS v1.2.3 - Splitting Conic Solver
(c) Brendan O'Donoghue, Stanford University, 2012-2016
----------------------------------------------------------------------------
Lin-sys: sparse-direct, nnz in A = 594188
eps = 1.00e-03, alpha = 1.50, max_iters = 2500, normalize = 1, scale = 1.00
Variables n = 330247, constraints m = 396298
Cones: primal zero / dual free vars: 197890
soc vars: 66053, soc blks: 2
sd vars: 132355, sd blks: 1
Setup time: 3.25e-01s
----------------------------------------------------------------------------
Iter | pri res | dua res | rel gap | pri obj | dua obj | kap/tau | time (s)
----------------------------------------------------------------------------
0| inf inf nan -inf inf inf 3.48e-01
40| 3.23e-04 3.49e-04 4.79e-04 8.80e-02 8.86e-02 7.72e-17 1.09e+01
----------------------------------------------------------------------------
Status: Solved
Timing: Solve time: 1.10e+01s
Lin-sys: nnz in L factor: 1320733, avg solve time: 8.40e-03s
Cones: avg projection time: 2.50e-01s
----------------------------------------------------------------------------
Error metrics:
dist(s, K) = 1.4669e-09, dist(y, K*) = 4.4882e-10, s'y/|s||y| = 2.1510e-12
|Ax + s - b|_2 / (1 + |b|_2) = 3.2339e-04
|A'y + c|_2 / (1 + |c|_2) = 3.4862e-04
|c'x + b'y| / (1 + |c'x| + |b'y|) = 4.7882e-04
----------------------------------------------------------------------------
c'x = 0.0880, -b'y = 0.0886
============================================================================
CVXPY status: optimal
objective(X): 0.08781080164736181
objective(0): 0.5492738765988324
objective(X0): 0.08889587090716308
||X||_* = 0.96174448568897
In this case, SCS converges to a nonzero solution that is not demonstrably suboptimal when compared to X0
.
For square matrices, the issue does not occur for any size until 256^2. It fails at 512^2 and 1024^2 as well. With rectangular matrices, I observe the same behavior at 128x384, for instance.
Hi,
I'm one of the authors of Convex.jl / SCS.jl along with @madeleineudell @davidlizeng @jennyhong. So far, we have SCS working for everything except semi-definite cones.
This is the basic problem we're trying to solve:
y = Variable((2,2), Semidefinite()) # Semidefinite variable of size 2 x 2
p = minimize(y[1,1], y[2,2] == 1)
This is what we parse the problem into:
# Matrix A
-1.0 0.0 0.0 0.0 1.0
0.0 0.0 0.0 -1.0 0.0
-1.0 0.0 0.0 0.0 0.0
0.0 -1.0 0.0 0.0 0.0
0.0 0.0 -1.0 0.0 0.0
0.0 0.0 0.0 -1.0 0.0
# b
0.0
-1.0
0.0
0.0
0.0
0.0
# c
0.0
0.0
0.0
0.0
1.0
num primal zero cones (f) = 2
ssize = 1
s = [2]
We believe this translation is correct since it is saying
minimize x
subject to
y[1, 1] == x
-y[2, 2] == -1
y is in sdp cone
However, I inputted the following directly to SCS and it says the problem is unbounded.
5 6
2 0 0 1 0 0
2500
1 1
1.800000000000000044
0.001000000000000000
2
0.000000000000000000 -1.000000000000000000 0.000000000000000000 0.000000000000000000 0.000000000000000000 0.000000000000000000
0.000000000000000000 0.000000000000000000 0.000000000000000000 0.000000000000000000 1.000000000000000000
0 2 3 4 6 7
0 2 3 4 1 5 0
-1.0 -1.0 -1.0 -1.0 -1.0 -1.0 1.0
Could you give us leads to what we might be doing wrong?
Regards,
Karanveer
Can I use the BLAS and LAPACK from the built-in Accelerate framework in OS 10.8 for SDP's? If this is not possible, it would be a great feature to add.
Hi,
When using scs in C examples demo.c associated with data "demo_data".Compiling is OK,but I got the "Error reading in data, aborting." Whats wrong??
Thanks~
LD
I was helping someone install cvxpy, and they ran into a problem installing SCS. The user had MKL installed on OS 10.9. SCS couldn't find/link against the MKL lapack. Here's the install log:
Requirement already satisfied (use --upgrade to upgrade): cvxpy in ./anaconda/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): cvxopt>=1.1.6 in ./anaconda/lib/python2.7/site-packages (from cvxpy)
Requirement already satisfied (use --upgrade to upgrade): ecos>=1.0.3 in ./anaconda/lib/python2.7/site-packages (from cvxpy)
Downloading/unpacking scs>=1.0.1 (from cvxpy)
Running setup.py egg_info for package scs
Downloading/unpacking toolz (from cvxpy)
Downloading toolz-0.6.0.tar.gz
Running setup.py egg_info for package toolz
Installing collected packages: scs, toolz
Running setup.py install for scs
building '_scs_direct' extension
C compiler: gcc -fno-strict-aliasing -I/Users/ashah/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
compile options: '-DPYTHON -DDLONG -DLAPACK_LIB_FOUND -DSCIPY_MKL_H -DSCIPY_MKL_H -Iinclude -I/Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include -I/Users/ashah/anaconda/include -I/Users/ashah/anaconda/include -Ilinsys/direct/ -Ilinsys/direct/external/ -I/Users/ashah/anaconda/include/python2.7 -c'
extra options: '-O3'
gcc: linsys/direct/external/amd_preprocess.c
gcc: src/linAlg.c
gcc: src/cs.c
gcc: src/cones.c
gcc: linsys/direct/external/amd_control.c
gcc: linsys/direct/external/amd_info.c
gcc: linsys/direct/private.c
gcc: linsys/direct/external/amd_post_tree.c
gcc: linsys/direct/external/amd_global.c
linsys/direct/external/amd_global.c:76:7: warning: incompatible pointer types initializing 'int (*)(const char *, ...)' with an expression of type 'void (const char *, ...)' [-Wincompatible-pointer-types]
int (*amd_printf) (const char *, ...) = scs_printf ;
^ ~~~~~~~~~~
1 warning generated.
gcc: linsys/direct/external/amd_defaults.c
gcc: linsys/direct/external/amd_1.c
gcc: linsys/direct/external/amd_2.c
gcc: linsys/direct/external/amd_dump.c
gcc: src/scs.c
gcc: src/util.c
gcc: linsys/direct/external/amd_aat.c
gcc: linsys/direct/external/ldl.c
gcc: linsys/direct/external/amd_postorder.c
gcc: linsys/direct/external/amd_valid.c
gcc: linsys/direct/external/SuiteSparse_config.c
gcc: linsys/direct/external/amd_order.c
gcc: scsmodule.c
In file included from scsmodule.c:6:
In file included from /Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:
/Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
1 warning generated.
gcc -bundle -undefined dynamic_lookup -L/Users/ashah/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/scsmodule.o build/temp.macosx-10.5-x86_64-2.7/src/cones.o build/temp.macosx-10.5-x86_64-2.7/src/cs.o build/temp.macosx-10.5-x86_64-2.7/src/linAlg.o build/temp.macosx-10.5-x86_64-2.7/src/scs.o build/temp.macosx-10.5-x86_64-2.7/src/util.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/private.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_1.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_2.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_aat.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_control.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_defaults.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_dump.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_global.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_info.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_order.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_post_tree.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_postorder.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_preprocess.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_valid.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/ldl.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/SuiteSparse_config.o -L/Users/ashah/anaconda/lib -L/Users/ashah/anaconda/lib -L/Users/ashah/anaconda/lib -lm -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -o build/lib.macosx-10.5-x86_64-2.7/_scs_direct.so
ld: library not found for -lmkl_lapack95_lp64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lmkl_lapack95_lp64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: Command "gcc -bundle -undefined dynamic_lookup -L/Users/ashah/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/scsmodule.o build/temp.macosx-10.5-x86_64-2.7/src/cones.o build/temp.macosx-10.5-x86_64-2.7/src/cs.o build/temp.macosx-10.5-x86_64-2.7/src/linAlg.o build/temp.macosx-10.5-x86_64-2.7/src/scs.o build/temp.macosx-10.5-x86_64-2.7/src/util.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/private.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_1.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_2.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_aat.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_control.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_defaults.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_dump.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_global.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_info.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_order.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_post_tree.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_postorder.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_preprocess.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_valid.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/ldl.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/SuiteSparse_config.o -L/Users/ashah/anaconda/lib -L/Users/ashah/anaconda/lib -L/Users/ashah/anaconda/lib -lm -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -o build/lib.macosx-10.5-x86_64-2.7/_scs_direct.so" failed with exit status 1
Complete output from command /Users/ashah/anaconda/bin/python -c "import setuptools;__file__='/private/var/folders/yp/dfk7gqyx19x3l9qj8stcg3m5tsnt8x/T/pip_build_ashah/scs/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/yp/dfk7gqyx19x3l9qj8stcg3m5tsnt8x/T/pip-txx9aq-record/install-record.txt --single-version-externally-managed:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
copying scs.py -> build/lib.macosx-10.5-x86_64-2.7
running build_ext
building '_scs_direct' extension
C compiler: gcc -fno-strict-aliasing -I/Users/ashah/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
creating build/temp.macosx-10.5-x86_64-2.7
creating build/temp.macosx-10.5-x86_64-2.7/src
creating build/temp.macosx-10.5-x86_64-2.7/linsys
creating build/temp.macosx-10.5-x86_64-2.7/linsys/direct
creating build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external
compile options: '-DPYTHON -DDLONG -DLAPACK_LIB_FOUND -DSCIPY_MKL_H -DSCIPY_MKL_H -Iinclude -I/Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include -I/Users/ashah/anaconda/include -I/Users/ashah/anaconda/include -Ilinsys/direct/ -Ilinsys/direct/external/ -I/Users/ashah/anaconda/include/python2.7 -c'
extra options: '-O3'
gcc: linsys/direct/external/amd_preprocess.c
gcc: src/linAlg.c
gcc: src/cs.c
gcc: src/cones.c
gcc: linsys/direct/external/amd_control.c
gcc: linsys/direct/external/amd_info.c
gcc: linsys/direct/private.c
gcc: linsys/direct/external/amd_post_tree.c
gcc: linsys/direct/external/amd_global.c
linsys/direct/external/amd_global.c:76:7: warning: incompatible pointer types initializing 'int (*)(const char *, ...)' with an expression of type 'void (const char *, ...)' [-Wincompatible-pointer-types]
int (*amd_printf) (const char *, ...) = scs_printf ;
^ ~~~~~~~~~~
1 warning generated.
gcc: linsys/direct/external/amd_defaults.c
gcc: linsys/direct/external/amd_1.c
gcc: linsys/direct/external/amd_2.c
gcc: linsys/direct/external/amd_dump.c
gcc: src/scs.c
gcc: src/util.c
gcc: linsys/direct/external/amd_aat.c
gcc: linsys/direct/external/ldl.c
gcc: linsys/direct/external/amd_postorder.c
gcc: linsys/direct/external/amd_valid.c
gcc: linsys/direct/external/SuiteSparse_config.c
gcc: linsys/direct/external/amd_order.c
gcc: scsmodule.c
In file included from scsmodule.c:6:
In file included from /Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:
/Users/ashah/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
1 warning generated.
gcc -bundle -undefined dynamic_lookup -L/Users/ashah/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/scsmodule.o build/temp.macosx-10.5-x86_64-2.7/src/cones.o build/temp.macosx-10.5-x86_64-2.7/src/cs.o build/temp.macosx-10.5-x86_64-2.7/src/linAlg.o build/temp.macosx-10.5-x86_64-2.7/src/scs.o build/temp.macosx-10.5-x86_64-2.7/src/util.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/private.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_1.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_2.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_aat.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_control.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_defaults.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_dump.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_global.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_info.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_order.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_post_tree.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_postorder.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_preprocess.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_valid.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/ldl.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/SuiteSparse_config.o -L/Users/ashah/anaconda/lib -L/Users/ashah/anaconda/lib -L/Users/ashah/anaconda/lib -lm -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -o build/lib.macosx-10.5-x86_64-2.7/_scs_direct.so
ld: library not found for -lmkl_lapack95_lp64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lmkl_lapack95_lp64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: Command "gcc -bundle -undefined dynamic_lookup -L/Users/ashah/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/scsmodule.o build/temp.macosx-10.5-x86_64-2.7/src/cones.o build/temp.macosx-10.5-x86_64-2.7/src/cs.o build/temp.macosx-10.5-x86_64-2.7/src/linAlg.o build/temp.macosx-10.5-x86_64-2.7/src/scs.o build/temp.macosx-10.5-x86_64-2.7/src/util.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/private.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_1.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_2.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_aat.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_control.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_defaults.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_dump.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_global.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_info.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_order.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_post_tree.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_postorder.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_preprocess.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/amd_valid.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/ldl.o build/temp.macosx-10.5-x86_64-2.7/linsys/direct/external/SuiteSparse_config.o -L/Users/ashah/anaconda/lib -L/Users/ashah/anaconda/lib -L/Users/ashah/anaconda/lib -lm -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -o build/lib.macosx-10.5-x86_64-2.7/_scs_direct.so" failed with exit status 1
----------------------------------------
Cleaning up...
Command /Users/ashah/anaconda/bin/python -c "import setuptools;__file__='/private/var/folders/yp/dfk7gqyx19x3l9qj8stcg3m5tsnt8x/T/pip_build_ashah/scs/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/yp/dfk7gqyx19x3l9qj8stcg3m5tsnt8x/T/pip-txx9aq-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/yp/dfk7gqyx19x3l9qj8stcg3m5tsnt8x/T/pip_build_ashah/scs
Storing complete log in /Users/ashah/.pip/pip.log
I'm trying to use scs in my c++ project, and I have tried different ways to add linker options you mentioned in the manual, but seems it's not working, it can't find the header file.
And actually, I don't find a directory called 'lib' after make the package.
every time I call scs_solve(), it will output some version info, status, timing info, etc., but I don't need these info, and I need to output some other log info in the console.
So can i let scs_solve() not send messages to console?
This problem is infeasible, but SCS returns unbounded. The last line gives the arguments cvxpy passes to scs.solve
.
from cvxpy import *
x1 = Variable()
x2 = Variable()
obj = Minimize(-x1-x2)
prob = Problem(obj, [0 <= x1, x1 <= -1])
prob.solve(solver=SCS)
print prob.status
data, dims = prob.get_problem_data(SCS)
Sorry if I am submitting this a second time (I touched a button and issue seemed to go away). CVX installation script fails to complete on my windows 64-bit windows machine using MATLAB recommended SDK version 7 compiler. One hypothesis this compiler requires strict C89 ANSI standard. Similar problem was recently fixed in the PDOS distribution. Any ideas or help would be greatly appreciated.
It would be nice if SCS could be interrupted with Ctrl-c. As it is I have to pause and kill the process.
The script 'cvx_install_scs.m' is not running to completion on my 64-bit windows machine. The screen dump from matlab is given below. From previous discussion with pdos author, the MATLAB-compliant C-compiler that comes with windows SDK 7 may be picky about C-syntax (adheres to ANSI standard C89 and not C99?). That is one hypothesis. Any advice?
linAlg.c
c:\users\adnan\downloads\scs-master\scs-master\include\scs.h(5) : fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: Compile of '..\src\linAlg.c' failed.
linAlg.c
c:\users\adnan\downloads\scs-master\scs-master\include\scs.h(5) : fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: Compile of '..\src\linAlg.c' failed.
Unable to complete successfully.
Error in compile_direct (line 20)
eval(cmd);
Error in make_scs (line 23)
compile_direct(flags);
Error in cvx_install_scs (line 2)
make_scs
Hi, I am experimenting with SCS. A couple issues occured to me last few days:
1). Since the default eps for SCS is only 1e-3, I tried to set eps = 1e-6 and also set verbose = True. But when the job was finished, the output shows that the eps is still 1e-3!
2). I have a constraints [x >= 1e-8], where x is the cvx variables.of dimension 79x1 and I tried to solve cvx.sum_entries(cvx.square(A*x - b)), where A is a 100,000x79 matrix, and b is 100,000x1 matrix. But in the final results, I see lot components of x have values of around -1e-3, or even -1e-2! So many negative coeffs!
Jimmy
Hello.
I have been using cvx for almost 4 months, and I wanted to add the scs to the cvx solver list. I downdloaded the whole zip file of scs and copied the unzipped file into the cvx directory. I then copied cvx_scs into cvx shim folder and I ran the cvx_install_scs. I get the following error:
Error using mex (line 206)
Unable to complete successfully.
Error in compile_direct (line 24)
eval(cmd);
Error in make_scs (line 10)
compile_direct(flags);
Error in cvx_install_scs (line 2)
make_scs
Please help
Hi,
Actually, this is not an issue. I am quite new to github, so apologies if this is not the right place. I am thinking of sharing this knowledge as it might benefit others who struggle to compile SCS on windows.
I managed to compile SCS on windows, based on this wonderful instruction on compiling scipy on Windows : http://www.scipy.org/scipylib/building/windows.html . This article is a bit old but still quite relevant.
The steps that I have done extra are below :
Compiler: MINGW 32 Bit
[atlas]
library_dirs = C:\BLASLAPACKLIBS
atlas_libs = atlas
[blas]
library_dirs = C:\BLASLAPACKLIBS
blas_libs = blas
[lapack]
library_dirs = C:\BLASLAPACKLIBS
lapack_libs = lapack
The atlas library is from http://www.netlib.org/atlas/archives/windows/ : http://www.netlib.org/atlas/archives/windows/atlas330_WinNT_P4SSE2.zip
lapack and blas are from http://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries_mingw
Then python install as per normal works ( MINGW is already my default compiler ):
cd /python
python setup.py install
Since atlas, blas and lapack are not compiled on the specific machine architecture, the performance might not be the most optimal. But again, for my case, SCS has already surpassed CVXOPT multiple folds. Not to mention that I ran into the memory error issue - https://github.com/cvxgrp/cvxpy/issues/82 which CVXOPT cannot handle.
I hope this is useful
Kind regards,
Kris
I'd like to import scs
and then ask for its version, kind of like how numpy.__version__
or scipy.__version__
work. Currently I can look at scs.__file__
and parse its version out of scs-1.0.6-py2.7-linux-x86_64.egg/scs.pyc
but this is less convenient.
Hello there,
I'm currently preparing a Homebrew formula for this software package, for bottling for Julia language bindings, (SCS.jl, if you're interested) and it would be great to get a new release sometime soon so that I can refer to a stable tarball location, rather than pulling down the latest master
which may or may not be stable at the time of building.
I've been trying to figure out why SCS has been randomly failing JuMP's SDP unit tests.
Here's an example failure:
Lin-sys: sparse-direct, nnz in A = 60
eps = 1.00e-06, alpha = 1.80, max_iters = 20000, normalize = 1, scale = 5.00
Variables n = 26, constraints m = 46
Cones: primal zero / dual free vars: 12
linear vars: 4
soc vars: 14, soc blks: 2
sd vars: 16, sd blks: 2
Setup time: 1.63e-04s
----------------------------------------------------------------------------
Iter | pri res | dua res | rel gap | pri obj | dua obj | kap/tau | time (s)
----------------------------------------------------------------------------
0| inf inf -nan -inf inf inf 7.85e-05
100| inf inf -nan inf inf inf 1.93e-03
200| inf inf -nan -inf inf inf 3.82e-03
220| inf inf -nan -inf inf inf 4.21e-03
----------------------------------------------------------------------------
and then if you run it again, you might get the right solution:
Lin-sys: sparse-direct, nnz in A = 60
eps = 1.00e-06, alpha = 1.80, max_iters = 20000, normalize = 1, scale = 5.00
Variables n = 26, constraints m = 46
Cones: primal zero / dual free vars: 12
linear vars: 4
soc vars: 14, soc blks: 2
sd vars: 16, sd blks: 2
Setup time: 1.68e-04s
----------------------------------------------------------------------------
Iter | pri res | dua res | rel gap | pri obj | dua obj | kap/tau | time (s)
----------------------------------------------------------------------------
0| inf inf -nan -inf -inf inf 8.67e-05
100| 2.78e-04 2.73e-04 5.18e-04 -2.72e+00 -2.72e+00 7.40e-17 1.23e-03
200| 3.43e-06 1.03e-05 4.96e-06 -2.72e+00 -2.72e+00 1.23e-16 2.35e-03
260| 2.46e-07 7.22e-07 3.62e-07 -2.72e+00 -2.72e+00 1.23e-16 3.02e-03
----------------------------------------------------------------------------
Status: Solved
Timing: Total solve time: 3.03e-03s
Interestingly, I can only reproduce the issue if SCS is used to solve a number of SDPs before this one in the same session.
So anyway I ran this under valgrind. I get some messages like this:
Status: Solved/Inaccurate
Hit max_iters, solution may be inaccurate
Timing: Total solve time: 6.96e+01s
Lin-sys: nnz in L factor: 150, avg solve time: 4.39e-05s
Cones: avg projection time: 3.35e-03s
----------------------------------------------------------------------------
Error metrics:
==27222== Invalid read of size 16
==27222== at 0xCC815AC: daxpy_k_SANDYBRIDGE (in /mnt/hdd/mlubin/julia-0.4/usr/lib/libopenblas.so)
==27222== by 0xBC3350C: syr_kernel (in /mnt/hdd/mlubin/julia-0.4/usr/lib/libopenblas.so)
==27222== by 0xBE04488: exec_blas (in /mnt/hdd/mlubin/julia-0.4/usr/lib/libopenblas.so)
==27222== by 0xBC336FA: dsyr_thread_L (in /mnt/hdd/mlubin/julia-0.4/usr/lib/libopenblas.so)
==27222== by 0xBBEE521: dsyr_64_ (in /mnt/hdd/mlubin/julia-0.4/usr/lib/libopenblas.so)
==27222== by 0x13A3F6B7: projSemiDefiniteCone (cones.c:530)
==27222== by 0x13A3F6B7: projDualCone (cones.c:667)
==27222== by 0x13A38109: getDualConeDist (scs.c:500)
==27222== by 0x13A3A9E9: printFooter (scs.c:570)
==27222== by 0x13A3A9E9: scs_solve (scs.c:802)
==27222== by 0x1706F176: ???
==27222== by 0x1706EC5E: ???
==27222== by 0x1706E604: ???
==27222== by 0x4F15354: jl_apply (julia.h:1263)
==27222== by 0x4F15354: jl_apply_generic (gf.c:1675)
==27222== Address 0x12604c60 is 192 bytes inside a block of size 200 alloc'd
==27222== at 0x4C2DC90: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27222== by 0x13A3E444: initCone (cones.c:378)
==27222== by 0x13A3AF55: initWork (scs.c:695)
==27222== by 0x13A3AF55: scs_init (scs.c:849)
==27222== by 0x1706EB66: ???
==27222== by 0x1706E604: ???
==27222== by 0x4F15354: jl_apply (julia.h:1263)
==27222== by 0x4F15354: jl_apply_generic (gf.c:1675)
==27222== by 0x1706B875: ???
==27222== by 0x1706CF8B: ???
==27222== by 0x1706CD99: ???
==27222== by 0x1706AE3C: ???
==27222== by 0x1706A8B9: ???
==27222== by 0x1706A6DB: ???
==27222==
On v1.1.5, cones:378 is where the Z vector for eigenvectors is allocated. In this case, it's a 5*5
SDP constraint, so Z has 5*5*8=200
bytes. For some reason, openblas is trying to read the last elements and goes off past the end. If I explicitly add 16 bytes padding to the calloc
call, then the error goes away, but doesn't resolve the random failures. It doesn't help to use posix_memalign
instead of malloc
. This is maybe completely unrelated to the failures above, maybe not.
@bodono, any debugging tips?
data.A = sparse(randn(100,50));
data.b = randn(100,1);
data.c = randn(50,1);
K = struct( 'f', 0, 'l', 100, 'q', [], 's', [], 'ed', [] );
pars = struct( 'free', 0, 'eps', sqrt(eps), 'bigeps', sqrt(sqrt(eps)) );
scs_direct(data,K,pars)
This crashes. However, just changing K as to
K = struct( 'l', 100 )
fixes this.
This makes all software that depends on scs download version 1.0.7
Hi again,
Sorry for making too many requests!
Is there a way to check if SCS is correctly configured to run on OpenMP? Of course I can check through number of processes and CPU consumption but I was wondering if there is anything inside that could show how many threads are used.
I have a an optimization program with 11M data points taking over 20hours to run the first iteration. smaller datasets with 7M data points run in significantly shorter time. Is there anyway I could investigate why it takes such long time?
Following is the problem statement printed by SCS:
Lin-sys: sparse-direct, nnz in A = 326795355
eps = 1.00e-03, alpha = 1.50, max_iters = 200, normalize = 1, scale = 1.00
Variables n = 53115585, constraints m = 117868881
Cones: primal zero / dual free vars: 1
linear vars: 39616055
exp vars: 78252825, dual exp vars: 0
Would you mind changing the solver options to use **kwargs instead of taking a dictionary? Instead of
sol = scs(data, cone, opts = None, USE_INDIRECT = False)
it would be
sol = scs(data, cone, use_indirect = False, **kwargs)
We changed the ECOS interface to look like this. You can see the discussion here: embotech/ecos#56
I think this is nicer and more pythonic than constructing and passing in a dictionary. Internally the only difference is that kwargs would have lower case keys whereas opts had upper case keys.
Unless we(SCS.jl) are doing something wrong, it seems possible that SCS can return semi-definite matrices that are not symmetric.
using Convex, SCS
set_default_solver(SCSSolver())
y = Variable((2, 2), :Semidefinite)
p = minimize(y[1, 1], y[1, 2] == 1)
solve!(p)
y.value
0 1.0
-1.0 0.58682
Is there a reason why it is possible for SDP matrices to not be symmetric?
The README seems to say
positive semidefinite cone { X | min(eig(X)) >= 0, X = X^T }
in which case the matrix should be symmetric.
Here is the data in raw format:
A = [
0.0 0.0 1.0 0.0;
-1.0 0.0 0.0 0.0;
0.0 -1.0 0.0 0.0;
0.0 0.0 -1.0 0.0;
0.0 0.0 0.0 -1.0]
c = [1.0,0.0,0.0,0.0]
b = [1.0,0.0,0.0,0.0,0.0]
f = 1
s = [2]
ssize = 1
This might not be bug in scs but a problem due to using prebuilt blas and lapack libraries. I am using windows 8.1 and anaconda. I downloaded the prebuilt 64bit libs and dlls for blas and lapack from http://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries_mingw. I modified the site.cfg in C:\Anaconda\Lib\site-packages\numpy\distutils accordingly and called python setup.py install to build scs. Everything seemed fine. Then I copied the libblas.dll and liblapack.dll into C:\Anaconda\DLLs directory. When I call import scs, it doesn't give me any error however when I tried to use it like
import numpy as np
import cvxpy as cp
kD=3
vS=cp.semidefinite(kD)
pS=cp.Parameter(kD,kD)
obj=cp.norm(vS-pS)
prob=cp.Problem(cp.Minimize(obj))
pS.value=np.identity(kD)
prob.solve(verbose=True,solver=cp.SCS)
ipython crashes. As far as I can see it is actually the scs that crashes. I guess it has something to do with the prebuilt lib and dll files that makes scs crash. Do you know what is the cause of the problem and how can I fix it ?
Regards,
Caglar
I've had some people create problems in cvxpy with SDP constraints so large they crash SCS (specifically they crash DSYEVR). The problems are also too large for CVXOPT (at least with the KKT solver I use now), so it would be nice to use SCS. I was wondering if it would be possible to do the SDP projection in such cases.
I found something about indirect methods for eigenvalues here:
http://docs.scipy.org/doc/scipy/reference/tutorial/arpack.html
This is not an urgent issue at all, but I wanted to let you know about it.
The documentation says that the primal problem solved is
minimize c'x
subject to Ax + s = b
s in K
However, when running the solver, it appears that the problem solved is actually
maximize c'x
subject to Ax + s = b
s in K
I think that the comments for which problem is being solved need to be changed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.