{"id":2765,"library":"scs","title":"SCS: Splitting Conic Solver","description":"SCS (Splitting Conic Solver) is a numerical optimization package for solving large-scale convex cone problems, including linear programs (LPs), second-order cone programs (SOCPs), and semidefinite programs (SDPs). It uses an operator-splitting method (ADMM) with Anderson acceleration for fast convergence. The current version is 3.2.11, with frequent patch releases.","status":"active","version":"3.2.11","language":"python","source_language":"en","source_url":"https://github.com/bodono/scs-python","tags":["optimization","convex-optimization","conic-programming","LP","SOCP","SDP","ADMM","sparse-solvers"],"install":[{"cmd":"pip install scs","lang":"bash","label":"Standard installation"},{"cmd":"pip install scs -Csetup-args=-Dlink_mkl=true","lang":"bash","label":"Installation with MKL Pardiso direct solver (requires MKL)"},{"cmd":"pip install scs -Csetup-args=-Dlink_cudss=true -Csetup-args=-Dint32=true","lang":"bash","label":"Installation with GPU direct sparse solver (requires NVIDIA cuDSS)"}],"dependencies":[{"reason":"Required for numerical arrays (b, c vectors).","package":"numpy","optional":false},{"reason":"Required for sparse matrices (P, A matrices, specifically CSC format).","package":"scipy","optional":false},{"reason":"Optional for MKL Pardiso direct solver backend.","package":"mkl","optional":true},{"reason":"Optional for NVIDIA cuDSS GPU direct solver backend.","package":"cudss","optional":true}],"imports":[{"wrong":"import scs","symbol":"SCS","correct":"from scs import SCS"},{"wrong":"import scs","symbol":"solve","correct":"from scs import solve"},{"wrong":"import scs","symbol":"SOLVED","correct":"from scs import SOLVED"}],"quickstart":{"code":"import numpy as np\nimport scipy.sparse as sp\nimport scs\n\n# Define problem dimensions\nm, n = 4, 2\n\n# Create problem data matrices (P, A as sparse CSC, b, c as numpy arrays)\nP = sp.eye(n, format=\"csc\") # Quadratic cost (identity for simplicity)\nA = sp.random(m, n, density=0.5, format=\"csc\", random_state=1)\nb = np.random.randn(m)\nc = np.random.randn(n)\n\ndata = {\"P\": P, \"A\": A, \"b\": b, \"c\": c}\n\n# Define the cone: 'l' for non-negative cone of length m\ncone = {\"l\": m}\n\n# Initialize the SCS solver\nsolver = scs.SCS(data, cone, verbose=False)\n\n# Solve the problem\nsol = solver.solve()\n\nprint(f\"Solver status: {sol['info']['status']}\")\nif sol['info']['status'] == 'solved':\n    print(f\"Primal solution (x): {sol['x']}\")\n    print(f\"Dual solution (y): {sol['y']}\")","lang":"python","description":"This quickstart solves a simple convex cone program with a non-negative cone. It demonstrates how to prepare the problem data (sparse matrices P, A and dense vectors b, c), define the cone, initialize the SCS solver, and retrieve the solution."},"warnings":[{"fix":"Consult the official documentation for detailed installation instructions for desired backends. Ensure all necessary system-level libraries are installed before attempting Python package installation.","message":"Installing SCS with optional backends (MKL, GPU) requires specific `pip install -Csetup-args` flags and pre-installed libraries (e.g., MKL, cuDSS, CUDA Toolkit). A standard `pip install scs` will use the default sparse direct solver (QDLDL), which may not be optimal for performance-critical applications.","severity":"gotcha","affected_versions":"3.x.x and earlier"},{"fix":"Always construct `P` and `A` as `scipy.sparse.csc_matrix` and `b`, `c` as 1D `numpy.ndarray` to ensure optimal performance and avoid implicit conversions.","message":"Problem data `P` and `A` must be `scipy.sparse.csc_matrix`, and `b` and `c` must be `numpy.ndarray`. While SCS attempts conversion, providing data in the correct format directly avoids potential overhead or unexpected behavior.","severity":"gotcha","affected_versions":"3.x.x and earlier"},{"fix":"For new projects, use SCS 3.x or higher, which has improved compatibility. If using older SCS versions, check for `numpy` version requirements in the specific release notes or issues.","message":"SCS versions before 3.x have experienced compatibility issues with newer NumPy versions, sometimes failing installation or requiring specific NumPy versions to be pre-installed.","severity":"gotcha","affected_versions":"<3.0.0"},{"fix":"Utilize the `warm_start` parameter in the `solve()` method when solving a series of problems where the current solution is a good approximation of the next. Pass the `sol` dictionary from a previous solve directly, or provide specific `x, y, s` arrays.","message":"Warm-starting solutions can significantly improve performance for solving sequences of similar problems, but incorrect use or stale warm-start data can lead to slower convergence or suboptimal results.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'3.2.11':54 'acceler':46 'admm':43,69 'anderson':45 'cone':20,29 'conic':3,7,64 'conic-program':63 'converg':49 'convex':19,61 'convex-optim':60 'current':51 'fast':48 'frequent':56 'includ':22 'larg':17 'large-scal':16 'linear':23 'lp':66 'lps':25 'method':42 'numer':11 'oper':40 'operator-split':39 'optim':12,59,62 'order':28 'packag':13 'patch':57 'problem':21 'program':24,30,34,65 'releas':58 'scale':18 'scs':1,5 'sdp':68 'sdps':35 'second':27 'second-ord':26 'semidefinit':33 'socp':31,67 'solv':15 'solver':4,8,72 'spars':71 'sparse-solv':70 'split':2,6,41 'use':37 'version':52","created_at":"2026-04-11T01:41:51.866992+00:00","updated_at":"2026-04-16T21:29:02.001105+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.2.11","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.cvxgrp.org/scs/","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/scs/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-08-28","next_check":"2026-07-30","install_tag":null}}