Skip to main content

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}
}

Metadata

Release files for ecos 2.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ecos 2.0.14
File Size Uploaded Provenance
ecos-2.0.14.tar.gz 142.4 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for ecos 2.0.14
File
ecos-2.0.14-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
ecos-2.0.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
ecos-2.0.14-cp312-cp312-macosx_10_9_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.9+ x86-64 Details
ecos-2.0.14-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
ecos-2.0.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
ecos-2.0.14-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details
ecos-2.0.14-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
ecos-2.0.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
ecos-2.0.14-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details
ecos-2.0.14-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
ecos-2.0.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
ecos-2.0.14-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
ecos-2.0.14-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
ecos-2.0.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
ecos-2.0.14-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
ecos-2.0.14-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
ecos-2.0.14-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
ecos-2.0.14-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details

Total release size: 2.4 MB

Release files / ecos-2.0.14.tar.gz

Download URL ecos-2.0.14.tar.gz
Size 142.4 kB
Tags Source
SHA-256 checksum
How to use checksums
64b3201c0e0a7f0129050557c4ac50b00031e80a10534506dba1200c8dc1efe4
BLAKE2b-256 checksum
How to use checksums
2e5f17716c533da95ed110815b159efa22b1064c8c41fd5c862f21aff7a7fec0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.8.18

Release files / ecos-2.0.14-cp312-cp312-win_amd64.whl

Download URL ecos-2.0.14-cp312-cp312-win_amd64.whl
Size 72.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
718eb62afb8e45426bcc365ebaf3ca9f610afcbb754de6073ef5f104da8fca1f
BLAKE2b-256 checksum
How to use checksums
569aca30572f3e3ff3cef6a0ea8aa6cdc12c36f9fefe559f65c7d6265713196a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / ecos-2.0.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ecos-2.0.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 222.1 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f3cbb1a66ecf10955a1a4bcd6b99db55148000cb79fd176bfac26d98b21a4814
BLAKE2b-256 checksum
How to use checksums
821242f4d953f9284571726b085f99e13bfa84522bf63bf2e7a81460013b09e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / ecos-2.0.14-cp312-cp312-macosx_10_9_x86_64.whl

Download URL ecos-2.0.14-cp312-cp312-macosx_10_9_x86_64.whl
Size 92.5 kB
Tags CPython 3.12 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
4a7e2704a3ef9acfb8146d594deff9942d3a0f0d0399de8fe2e0bd95e8b0855c
BLAKE2b-256 checksum
How to use checksums
afc384e392f2410f51fa557198937cc52a2e80f887c517ef4e3fb6d46e3bb008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / ecos-2.0.14-cp311-cp311-win_amd64.whl

Download URL ecos-2.0.14-cp311-cp311-win_amd64.whl
Size 72.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
7495b3031ccc2d4cec72cdb40aed8a2d1fdd734fe40519b7e6047aead5e811cf
BLAKE2b-256 checksum
How to use checksums
2f451e52519d6c29dd26bbfaf92ece5b45ca3de3b7c8b2615a818aaeadb7ad63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / ecos-2.0.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ecos-2.0.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 220.1 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7a8be3b4856838ae351fec40fb3589181d52b41cf75bf4d35342686a508c37a6
BLAKE2b-256 checksum
How to use checksums
49e9fae34e8ef6a9b78c3098a4428ed0e8f77cdeb334a7dc17c649abb686ed08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / ecos-2.0.14-cp311-cp311-macosx_10_9_x86_64.whl

Download URL ecos-2.0.14-cp311-cp311-macosx_10_9_x86_64.whl
Size 92.6 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
dc90b54eaae16ead128bfdd95e04bf808b73578bdf40ed652c55aa36a6d02e42
BLAKE2b-256 checksum
How to use checksums
2b9bc886a268d4b7adfaa1171244cdbfa3c944e5a599fe7a5e738ee27390ab20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / ecos-2.0.14-cp310-cp310-win_amd64.whl

Download URL ecos-2.0.14-cp310-cp310-win_amd64.whl
Size 72.2 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
f2e8ab314609117f7e96bb83db7458f011ab0496c61078e146a8f5c8244e70b2
BLAKE2b-256 checksum
How to use checksums
55545424e7865d171b5ebd436fabdf66cdcf05bcfe5528ef5a45a02bca008dc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.11

Release files / ecos-2.0.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ecos-2.0.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 218.9 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f9a977976ec618261456d6c9cd4ec7b7745607e448e78cd0c851190c6cc515ef
BLAKE2b-256 checksum
How to use checksums
aa14e6a1692aea5647cf29988a351b1a5effe53421504e8648a4a1f04721120a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.14

Release files / ecos-2.0.14-cp310-cp310-macosx_10_9_x86_64.whl

Download URL ecos-2.0.14-cp310-cp310-macosx_10_9_x86_64.whl
Size 92.6 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
d16f8c97c42a18be77530b4d0090d8dd38105ae311518fc58a66c5c403d79672
BLAKE2b-256 checksum
How to use checksums
7c2580b44247ec5ad98ce8acec5b8b9cb73a43e4367cdc679769be109c1e2ae0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.14

Release files / ecos-2.0.14-cp39-cp39-win_amd64.whl

Download URL ecos-2.0.14-cp39-cp39-win_amd64.whl
Size 72.2 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
e412718b23c46500e0f0a3be2a5e5a552e89f495992cf7b3742eae6c75c830a7
BLAKE2b-256 checksum
How to use checksums
970be887413862b12cd0ce3d14c052cacef1b6aa30fb45a51c63008d92331116
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.13

Release files / ecos-2.0.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ecos-2.0.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 218.7 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
aa30ce5d4ebe012f2432da53369349f9aee8df3c463987f5a4af44477eecd9a5
BLAKE2b-256 checksum
How to use checksums
383e72d2c618691986ff90d77f3324afb582387b855c1d0cbe0061513a6bc6e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / ecos-2.0.14-cp39-cp39-macosx_10_9_x86_64.whl

Download URL ecos-2.0.14-cp39-cp39-macosx_10_9_x86_64.whl
Size 92.6 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
cb7189a1fabb46c6058484158f7002aa7b0d97633af18fd3cc98e4239d550a58
BLAKE2b-256 checksum
How to use checksums
a8ad4050d41d823928759f20e917e67c05b2842c0da562ffbffb1d5ac07b1657
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / ecos-2.0.14-cp38-cp38-win_amd64.whl

Download URL ecos-2.0.14-cp38-cp38-win_amd64.whl
Size 72.0 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
56e461ce7ef57bacd9c3653da2bfb959571b4e57177b7f0ea9a69170f7e2a1e3
BLAKE2b-256 checksum
How to use checksums
a25e8c5f561ae51f7faf1d2cb91299d4802a7b436a871408a72185dd53cc66da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.8.10

Release files / ecos-2.0.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ecos-2.0.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 221.6 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
81488788f92b1a288a44398835a371740d2f91b1d2361f76e3a27c4c6c8f8104
BLAKE2b-256 checksum
How to use checksums
381c84b143eb38b1e94f0876792289322abc14ad6b1e8ed7bed5f97c27741b7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.8.18

Release files / ecos-2.0.14-cp38-cp38-macosx_10_9_x86_64.whl

Download URL ecos-2.0.14-cp38-cp38-macosx_10_9_x86_64.whl
Size 92.4 kB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
85007d4462178f1e44aa824122e05e3e72605a7ec4366a55f678002793448f84
BLAKE2b-256 checksum
How to use checksums
456b36e6cf40e37765f890aa6e16510eff05a991da4012486323e7c265907dac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.8.18

Release files / ecos-2.0.14-cp37-cp37m-win_amd64.whl

Download URL ecos-2.0.14-cp37-cp37m-win_amd64.whl
Size 71.7 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
ceba1e1b411a5ff0acb41bf1732da426b482bf51b40ccc1a114132f8ecedb165
BLAKE2b-256 checksum
How to use checksums
ff8af9d83622a1662e24b739b2b47b49187260e59a0d577a8e8a2741412d8d2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.9

Release files / ecos-2.0.14-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ecos-2.0.14-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 218.2 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e55833bb2a468989ed9ffae4944b005888dfbf4c273daff13259d22104cfc097
BLAKE2b-256 checksum
How to use checksums
6a1dfe16ce275aa97de04899bb3a16d6293d59453ed9a34749dcb091690aaef7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.17

Release files / ecos-2.0.14-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL ecos-2.0.14-cp37-cp37m-macosx_10_9_x86_64.whl
Size 92.2 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
1a4048d576dc312679cc56a6a9af24e0fc6501988d89b725107fd05b4f0dcec8
BLAKE2b-256 checksum
How to use checksums
adb7d4442d1d45413aa0e59313f008cfabe1066108f1535b4cb6ca3be29665a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.17

Security for ecos 2.0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page