Skip to main content

This is the Python package for ECOS: Embedded Cone Solver. See Github page for more information.

Project description

Python Wrapper for Embedded Conic Solver (ECOS)

Build Status

Visit www.embotech.com/ECOS for detailed information on ECOS.

ECOS is a numerical software for solving convex second-order cone programs (SOCPs) of type

min  c'*x
s.t. A*x = b
     G*x <=_K h

where the last inequality is generalized, i.e. h - G*x belongs to the cone K. ECOS supports the positive orthant R_+ and second-order cones Q_n defined as

Q_n = { (t,x) | t >= || x ||_2 }

In the definition above, t is a scalar and x is in R_{n-1}. The cone K is therefore a direct product of the positive orthant and second-order cones:

K = R_+ x Q_n1 x ... x Q_nN

Installation

The latest version of ECOS is available via pip:

pip install ecos

This will download the relevant wheel for your machine.

Building from source

If you are attempting to build the Python extension from source, then use

make install

This will use the latest tag on git to version your local installation of ECOS.

You will need Numpy and Scipy. For installation instructions, see their respective pages.

You may need sudo privileges for a global installation.

Windows users

Windows users may experience some extreme pain when installing ECOS from source for Python 2.7. We suggest switching to Linux or Mac OSX.

If you must use (or insist on using) Windows, we suggest using the Miniconda distribution to minimize this pain.

If during the installation process, you see the error message Unable to find vcvarsall.bat, you will need to install Microsoft Visual Studio Express 2008, since Python 2.7 is built against the 2008 compiler.

If using a newer version of Python, you can use a newer version of Visual Studio. For instance, Python 3.3 is built against Visual Studio 2010.

Calling ECOS from Python

After installing the ECOS interface, you must import the module with

import ecos

This module provides a single function ecos with one of the following calling sequences:

solution = ecos.solve(c,G,h,dims)
solution = ecos.solve(c,G,h,dims,A,b,**kwargs)

The arguments c, h, and b are Numpy arrays (i.e., matrices with a single column). The arguments G and A are Scipy sparse matrices in CSR format; if they are not of the proper format, ECOS will attempt to convert them. The argument dims is a dictionary with two fields, dims['l'] and dims['q']. These are the same fields as in the Matlab case. If the fields are omitted or empty, they default to 0. The argument kwargs can include the keywords

  • feastol, abstol, reltol, feastol_inacc, abstol_innac, and reltol_inacc for tolerance values,
  • max_iters for the maximum number of iterations,
  • the Booleans verbose and mi_verbose,
  • bool_vars_idx, a list of ints which index the boolean variables,
  • int_vars_idx, a list of ints which index the integer variables,
  • mi_max_iters for maximum number of branch and bound iterations (mixed integer problems only),
  • mi_abs_eps for the absolute tolerance between upper and lower bounds (mixed integer problems only), and
  • mi_rel_eps for the relative tolerance, (U-L)/L, between upper and lower bounds (mixed integer problems only).

The arguments A, b, and kwargs are optional.

The returned object is a dictionary containing the fields solution['x'], solution['y'], solution['s'], solution['z'], and solution['info']. The first four are Numpy arrays containing the relevant solution. The last field contains a dictionary with the same fields as the info struct in the MATLAB interface.

Using ECOS with CVXPY

CVXPY is a powerful Python modeling framework for convex optimization, similar to the MATLAB counterpart CVX. ECOS is one of the default solvers in CVXPY, so there is nothing special you have to do in order to use ECOS with CVXPY, besides specifying it as a solver. Here is a small example from the CVXPY tutorial:

import cvxpy as cp

# Solving a problem with different solvers.
x = cp.Variable(2)
obj = cp.Minimize(cp.norm(x, 2) + cp.norm(x, 1))
constraints = [x >= 2]
prob = cp.Problem(obj, constraints)

# Solve with ECOS.
prob.solve(solver=cp.ECOS)
print("optimal value with ECOS:", prob.value)

ECOS Versioning

The Python module contains two version numbers:

  1. ecos.__version__: This is the version of the Python wrapper for ECOS
  2. ecos.__solver_version__: This is the version of the underlying ECOS solver

These two version numbers should typically agree, but they might not when a bug in the Python module has been fixed and nothing in the underlying C solver has changed. The major version numbers should agree, however.

What happened to 2.0.7?

Because version-syncing ECOS and ECOS-Python can be tricky, the 2.0.7 version did not incorporate some minor changes to ECOS. In an ill-advised move, the release was deleted in hopes it could be re-uploaded, despite plenty warnings stating otherwise.

Instead, a post release has been made that contains identical content to the 2.0.7 release. Generally, pip should pick up the post release for 2.0.7 and any dependencies such as pip install "ecos>=2.0.5" should still work as expected.

Deployment

When creating new versions of the Python wrapper, please use bumpversion to bump the version number and also remember to tag the commit so that CI is able to properly pick it up. See Release for more information.

Python2 Support

Starting with version 2.0.8, ecos-python will no longer support Python2.7. You may be able to download an older version but moving forward we will no longer publish Python2 wheels for use.

License

ECOS is distributed under the GNU General Public License v3.0. Other licenses may be available upon request from embotech.

Credits

The solver is essentially based on Lieven Vandenberghe's CVXOPT ConeLP solver, although it differs in the particular way the linear systems are treated.

The following people have been, and are, involved in the development and maintenance of ECOS:

  • Alexander Domahidi (principal developer)
  • Eric Chu (Python interface, unit tests)
  • Stephen Boyd (methods and maths)
  • Michael Grant (CVX interface)
  • Johan Löfberg (YALMIP interface)
  • João Felipe Santos, Iain Dunning (Julia interface)
  • Han Wang (ECOS branch and bound)

The main technical idea behind ECOS is described in a short paper. More details are given in Alexander Domahidi's PhD Thesis in Chapter 9.

If you find ECOS useful, you can cite it using the following BibTex entry:

@INPROCEEDINGS{bib:Domahidi2013ecos,
author={Domahidi, A. and Chu, E. and Boyd, S.},
booktitle={European Control Conference (ECC)},
title={{ECOS}: {A}n {SOCP} solver for embedded systems},
year={2013},
pages={3071-3076}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecos-2.0.11.tar.gz (141.9 kB view details)

Uploaded Source

Built Distributions

ecos-2.0.11-cp311-cp311-win_amd64.whl (72.0 kB view details)

Uploaded CPython 3.11 Windows x86-64

ecos-2.0.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (221.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

ecos-2.0.11-cp311-cp311-macosx_10_9_x86_64.whl (90.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

ecos-2.0.11-cp310-cp310-win_amd64.whl (72.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

ecos-2.0.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (220.3 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

ecos-2.0.11-cp310-cp310-macosx_10_9_x86_64.whl (90.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

ecos-2.0.11-cp39-cp39-win_amd64.whl (72.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

ecos-2.0.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (220.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

ecos-2.0.11-cp39-cp39-macosx_10_9_x86_64.whl (90.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

ecos-2.0.11-cp38-cp38-win_amd64.whl (72.0 kB view details)

Uploaded CPython 3.8 Windows x86-64

ecos-2.0.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (221.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

ecos-2.0.11-cp38-cp38-macosx_10_9_x86_64.whl (90.5 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

ecos-2.0.11-cp37-cp37m-win_amd64.whl (71.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

ecos-2.0.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (218.1 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

ecos-2.0.11-cp37-cp37m-macosx_10_9_x86_64.whl (90.4 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file ecos-2.0.11.tar.gz.

File metadata

  • Download URL: ecos-2.0.11.tar.gz
  • Upload date:
  • Size: 141.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for ecos-2.0.11.tar.gz
Algorithm Hash digest
SHA256 97d8944cac7e88b6ebd7ebfc04eedf922f6641ea7ecadd2764fb7be4043f9056
MD5 9d91d99186542be5179240d2cac7dbb4
BLAKE2b-256 842a1480b85692f349fd669655e020a1aafdd2b798eab69305d394989f1d2b64

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ecos-2.0.11-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 72.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for ecos-2.0.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2b4177b43b85a4741df99610a87d3d7579f4f6ded513d0ac877ce7e6b2345716
MD5 36c6a7d5a3ab52e3b927c9e024288356
BLAKE2b-256 031d531d4f625c504dabb049812d75353e1fc485547fdd9f84b469481548dea4

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94a6cb983dfd3db853e428f2e095e42ffebecda807973c2eed9601c1dcb00360
MD5 c3c31949ad52a6370045799eea97bde3
BLAKE2b-256 65d96941e89fa44ce01f07393db5bb1757b74200577c9663dc1c6d8d0c8311af

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ee6b56a67df74677566438cf3c5985d3404d6017a4acd21092ba0b57548cafdf
MD5 fc492bfa387078e5161dd9d8b49de55e
BLAKE2b-256 6d50661f6713d651031785587e1888459344503b2a92205648578a14eef4a280

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ecos-2.0.11-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 72.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for ecos-2.0.11-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1072177518ad4771623d07137e101a2b4837e3a6240668230cebf63d23fbbf63
MD5 b6e80fc81bc11efc3ac3c9ae52d42bf1
BLAKE2b-256 8c59d6e8bf5696b8354ae552eb962a9ce752c0ac0d15ed4a07a4ea9a1dd9c4fe

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ed8a69990d7cee42e7c77b2408600f6ee2c495e35e2f993c4e602bdfab893fd5
MD5 1e74baa980396943a2d0bb6dad5bbfc4
BLAKE2b-256 6069e7beaa88b8413aa10fb595c34f54b5a0c55133f0a58008e63b8f56bd7daa

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 527d3c527958de10e9dfaf2d1a4856c8140b565a5e16a24908031e9581574290
MD5 273e1ca0623600da3c4bb1f8a1cd7884
BLAKE2b-256 a85785fa27b56ec35b6145f7b6fe773da76513e6f52e7ebe37a7248d584f88d1

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: ecos-2.0.11-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 72.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for ecos-2.0.11-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5ddae3516d8ee25fc4ff026dacbebc93d51bb1d3ad7e0d5eeda76e5579365fc2
MD5 283119992a7c0a3916e41cef21b555b8
BLAKE2b-256 8e653a6eeea74ec14ac4c4979c22f833b3950090b3f9e8dbf0904f983ef1f4f3

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7dbf983886a2b404461750bc114fdd4fce5e3aa380f83aeee157d4036ec3919b
MD5 0017b890f1feda470b6795a06958512a
BLAKE2b-256 793d0208e53147f584f78f746bb9a5bbd70ce2db5bcd4b041d8fc5b72a8acb1b

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fe504974b0d981325223527746338c73a9d9ded0b82ee3e0b710d8f0b6d9606e
MD5 a88bdb230ae726ca31e8dc48d57e84dd
BLAKE2b-256 205c167a7047983a0dc853201d89e5c9f87d54e676cf25f56cd144754a63386e

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: ecos-2.0.11-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 72.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for ecos-2.0.11-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e3a9051c349b79d974d9b7c1d078fb5d5780013c9e0259e083b65903a3b83d57
MD5 95840c9635e227fba3ff6006a20885a1
BLAKE2b-256 21fd6c8fd1855eadecefc403e22c8dd5b2fd44bad11e60ce743fb9c26dcdd5a7

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5bac024a1809fa39b68b1a67776111e0d721fb92dfb9192b8e6747f63731e120
MD5 bb4e15f59f5028cebf3fb85a9c97e35f
BLAKE2b-256 680b3372290ccc7655fd0e0073279c73835b732b93f04b218b5f2b19b42fc1fb

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a75157e5484fe28b1f53cf852f413c8d9dbc7e2b5405571094f64fc1d3104e1a
MD5 8a6ca1bd4b902e86a1e5320083e62871
BLAKE2b-256 fd2c16038764ffeb6bea9b4d8dee847b163044b11b7327fcd5391230133c6e6f

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: ecos-2.0.11-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 71.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for ecos-2.0.11-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 248097c95e88370424aa5381dce3c20a9376a266386e508011ed1b843668e575
MD5 94a239a79d6bc7cf61216b0aeffa3eba
BLAKE2b-256 e8b109222a90519f16af8d20ca146dfdc7c01ef1f7114d8cf087256171f49d80

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83d0eabd1519bb0d5b43757c45a8d03caeb3e0a8547d2e09e7db75c7db0c9459
MD5 2eb4d3c0e0c3ed1385d248cc99acb352
BLAKE2b-256 3a3e21cc41d87d75ddc51cafd876fbd59a9e53be3ba8cc84e3d863b344cf2fbe

See more details on using hashes here.

File details

Details for the file ecos-2.0.11-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ecos-2.0.11-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 36f7fbfa7c96b4c1d14dbc53abd93bba24f10bac2d4f8c9b6213282725cf1f8d
MD5 fbd2c65b2bac2da3a989d2525f161cb0
BLAKE2b-256 3398e4a3cad4305e5637667997f08c0c9a33d670d862c648e8fc68ad7782df04

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page