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.12.tar.gz (142.4 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

ecos-2.0.12-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.12-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.12-cp310-cp310-win_amd64.whl (72.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

ecos-2.0.12-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.12-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.12-cp39-cp39-win_amd64.whl (72.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

ecos-2.0.12-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.12-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.12-cp38-cp38-win_amd64.whl (72.0 kB view details)

Uploaded CPython 3.8 Windows x86-64

ecos-2.0.12-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.12-cp38-cp38-macosx_10_9_x86_64.whl (90.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

ecos-2.0.12-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.12-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.12.tar.gz.

File metadata

  • Download URL: ecos-2.0.12.tar.gz
  • Upload date:
  • Size: 142.4 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.12.tar.gz
Algorithm Hash digest
SHA256 f48816d73b87ae325556ea537b7c8743187311403c80e3832035224156337c4e
MD5 a76939695aa07f8ab2f01a532732f348
BLAKE2b-256 04daaefd27c06a9179a7e5614d0d97c0384072d2d22800790690c661eb6f2f4a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ecos-2.0.12-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.1

File hashes

Hashes for ecos-2.0.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 da8fbbca3feb83a9e27075d29b3765417d0c80af8ea83cbdc4a558cae7b564af
MD5 1863d5731ecd5c5dd2cb9306f207c764
BLAKE2b-256 ab4b09ed42ee4800b1fe142ca18ced3824f46a6709752d4da7625681086b42e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4979dc2d1cb6667e371a45a61887068505c1305437eef104ed6ef16f4b6aa0e3
MD5 2f9663ddf791388d6cb817c5b3599b11
BLAKE2b-256 c7b112fac27a2afc40c3a02db4d0a454faa4b08c086025e77ade822e694fdf45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eba07599084724eedc20b2862d5580eebebb09609f4740baadc78401cb99827c
MD5 af3bc49f8dd4259edbca0291c7b484cb
BLAKE2b-256 b3dc22fb7a26e12f7b610c1b2ae4640995c536562e8cb02068ff873d5d6200ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ecos-2.0.12-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.12-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5184a9d8521ad1af90ffcd9902a6fa75c7bc473f37d30d86f97beda1033dfca2
MD5 0b72b1861edce3a42cd4de594ab44c6d
BLAKE2b-256 5bcd04605d89661879ff9e8c3771da3674f6b522cff693bd369ef44551ea0fe5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 608bc822ee8e070927ab3519169b13a1a0fe88f3d562212d6b5dbb1039776360
MD5 c4efdc704cb8331de8b64413b815a9ed
BLAKE2b-256 6920b1f8aa05dea40825181d62be127fc8077193a769b10ee2b1ecd986ef634e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 835298a299c88c207b3402fba60ad9b5688b59bbbf2ac34a46de5b37165d773a
MD5 56b9b501ef4f8303a764e56dc1a9f997
BLAKE2b-256 0782408273c86d2aa99a26d4a1518a4fd2efe799bf01bdabf1fdcf3883b2c46b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ecos-2.0.12-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.12-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7af08941552fce108bd80145cdb6be7fa74477a20bacdac170800442cc7027d4
MD5 d285384722d1b0c1b06bdb0e4f37bd20
BLAKE2b-256 e29ea9c8786fb278ba4a2a5388e14a4143ac294a3c7b8a0a4249dacf12b47f82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6def54336a15b5a49bc3bfcaa36035e8557cae8a4853b17ca84f5a29c93bcaea
MD5 bd7390d466ee919150bc0d9ca880255f
BLAKE2b-256 0ed7d79bddbfe09da07dee320fe2edbaa5224720b2a679c53db47a461a6f1d98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3e42bd4c19af6e04f76ccc85d941b1f1adc7faeee4d06d482395a6beb7bec895
MD5 771f1ec5fda80e9e1ec25e20ed444b2f
BLAKE2b-256 8b547e63a1dc9d45ebe7743c1647af63a97b3306679deb2d9bea29d5d1575ebb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ecos-2.0.12-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.12-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 528b02f53835bd1baeb2e23f8153b8d6cc2b3704e1768be6a1a972f542241670
MD5 6b7b21b3b78e02812692906763387bed
BLAKE2b-256 bc40458fbe1e9ddefa6958f862974e28a1cd9405e6d3555583944834b199cebc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 858a4dd3177bdc8cc6e362031732f5177b62138a1e4ef91c0dc3c6bd7d2d1248
MD5 bfe710696b737e123a02f154e3e15eb3
BLAKE2b-256 aa1bf72a5fd12afda79f1d885b45b9c2737070576d4a9cf48112cbb288bf5230

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4e86671397d1d2cd7cccff8a9c45be0541b0c60af8b92a0ff3581c9ed869db67
MD5 0d1307f0d9936f1ef990605b02a8b564
BLAKE2b-256 1836eda93730201877db06bfc321f410877ff49f92654edc6d7650802124dba9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ecos-2.0.12-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.12-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 29d00164eaea66ed54697a3b361c575284a8bca54f2623381a0635806c7303a7
MD5 d3eea15ed5d041e54181c7733d047d4c
BLAKE2b-256 236a922704896b631bc6c67f40a9507af7c8ad1d5f0613052a16da48651e60e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 617be25d74222849622b0f82b94a11abcf1fae78ccaf69977b328321ee6ffa0b
MD5 883e9f2d248f0c1974dbc2cf0603074c
BLAKE2b-256 d7e74cb8b9597c7e649bedc4ba8247d9f4305c453f6176b12dacaff0f0d97831

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecos-2.0.12-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f70e4547966f530fd7715756f7a65d5b9b90b312b9d37f243ef9356c05e7d74c
MD5 2af1acc994e053045c83c5c7b0ceecb0
BLAKE2b-256 9acbba4abbedfb4bfb4f41c8fa0da1df0c78cc8014f6efc72516bcc8028b9b58

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