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)
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
, andreltol_inacc
for tolerance values,max_iters
for the maximum number of iterations,- the Booleans
verbose
andmi_verbose
, bool_vars_idx
, a list ofint
s which index the boolean variables,int_vars_idx
, a list ofint
s 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), andmi_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:
ecos.__version__
: This is the version of the Python wrapper for ECOSecos.__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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file ecos-2.0.13.tar.gz
.
File metadata
- Download URL: ecos-2.0.13.tar.gz
- Upload date:
- Size: 142.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2a9dc108ade7faf6f6f4fad245f4714b7293c8767d2a351ead59428a94a98b9 |
|
MD5 | 91f22c03f1a246ee143933fecea503e4 |
|
BLAKE2b-256 | 4d261494d3da76c1ebecdcb1f3028c77b50a272f07e9d34b8eca981a7b3f6267 |
File details
Details for the file ecos-2.0.13-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 72.2 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c1ea09069e32185912506f946bb6d1f144841ba1d1cd0217c67f72cbdf7a8fd |
|
MD5 | 2c07958b10f5b3edef8b0d39756b550f |
|
BLAKE2b-256 | 03f1488fd5970a3a1c9043f005b4a58353f166f5f4ce873c961bd0c760dd6888 |
File details
Details for the file ecos-2.0.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 223.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf2b1384012bee9e58e5a2373905d3644f74a0ea000b307a239366fe7850c29c |
|
MD5 | e6273bf8ab23b9cca5eff5315535992c |
|
BLAKE2b-256 | a35b3169ac631acff650698e8119fda54f3747c0ab232b2b485d8593b7cefcd7 |
File details
Details for the file ecos-2.0.13-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 90.8 kB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62ed497ab56017f1d7264eb56223826a984462b1d84fb850d10f0bec3490877d |
|
MD5 | cec772b4d2649cfdb4f8cc1d0a5ae5c2 |
|
BLAKE2b-256 | 63d3f7142d270cce3e8db7606e90abb8e84f1b9e951c4c3feb6129288c87a596 |
File details
Details for the file ecos-2.0.13-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: ecos-2.0.13-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.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 936890fb85a186360a5c8f228dd19acb760e234b38c598d0b46ab29644e31dfc |
|
MD5 | 629666cd877016d5515924c74979f479 |
|
BLAKE2b-256 | 671f165ca12f4b3de6bd3fe8b16695013d28e88808effeff37858427ae56f449 |
File details
Details for the file ecos-2.0.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 221.6 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78b2c969c7e22fd8a1d1cd0a90f4325d90572da23e2e923b0da6138ce62503d0 |
|
MD5 | 2c8d39fe4468fd01c925825193efc7f0 |
|
BLAKE2b-256 | e1ecbbc7c651c3c06d312daf29382ded38bb74a52b73ac2b1cfee9be59dd4204 |
File details
Details for the file ecos-2.0.13-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 90.8 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88dd628bc6e77a069165fa5f50340e2856795c28e00e3fce213a04d7c41c584a |
|
MD5 | 87e0f8da03779d98daaf2f8ad6c97742 |
|
BLAKE2b-256 | 19792de423d1ce19d7e5e5070d8972d2bc997a79f2745c82f78f66493b378892 |
File details
Details for the file ecos-2.0.13-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: ecos-2.0.13-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.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df8ae7fce79be9e5f79f0511c51a4824795de5154847fabe1a0288bc2ea349d3 |
|
MD5 | c40cf2bb3cdc5c57d85b001fd3b0dc5b |
|
BLAKE2b-256 | c434d51f5ef1024f79fa55adbd31d24b10880e79e1b424b662858e7759863dd9 |
File details
Details for the file ecos-2.0.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 220.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ea88ee2c94192004d6be9c55a3c79f184eaba3bbf31474229045a1b0a8a1536 |
|
MD5 | 16f7840798ef20905f54a02dfd9180de |
|
BLAKE2b-256 | 804398ca58202009431558f4d838e07b8a0a906a604492e420eac23d10aa688e |
File details
Details for the file ecos-2.0.13-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 90.8 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1c1acf33b70f8657c25f07ec8d7b59bb01dbad39f072fa61fc956c2166ed979 |
|
MD5 | 42380a259c484bfe5444533c09617b2b |
|
BLAKE2b-256 | d4e67882e8871cd036ef3d2c6f130c60459c15a62cb59116acc1079c500b7494 |
File details
Details for the file ecos-2.0.13-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: ecos-2.0.13-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68995ab12d363576dddb2d1f91ead3b9c8a8ca61f29000f0b1daef1b4e7b5b64 |
|
MD5 | 7ffec0e6db0bccb5aa6b010e7d8e6d44 |
|
BLAKE2b-256 | 32872814e0c6f93db878ed8a6ffc9e5fa934b9316554132c692ebd9df19c076f |
File details
Details for the file ecos-2.0.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 220.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32fb33185f6dd94a1c798bc481eb86c9f4e832efec91f6ab0584e2fc26fd375e |
|
MD5 | ca3d7a6e905236215b17a998c7316c82 |
|
BLAKE2b-256 | ded5aafdc766bb51ef70975902f48c6c07550f110fe6522d7629b872ee54ca8b |
File details
Details for the file ecos-2.0.13-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 90.8 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba42c15f1d79eb2ada532e9781b4aeb3ed84b1c7e38239ba4d6502c6a092d5b1 |
|
MD5 | 23289779b7b9886705ade6bb9e0a9346 |
|
BLAKE2b-256 | 4c5817cf7402da41f796fb4a35ac3d419431b3321a3963311d782651ad0252cf |
File details
Details for the file ecos-2.0.13-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: ecos-2.0.13-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30c7d0cce6c830da5b9ea25af0d47b203255639524eb4d03d1331c600958c834 |
|
MD5 | c88a61c8cde165324bb81da91be67bf8 |
|
BLAKE2b-256 | b8a1cd810f4341a3653012e01aa3f56d414f70ca93f241115041de428260297b |
File details
Details for the file ecos-2.0.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 221.6 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059e6c29c89f47a490353e4f9336e96350a5102a97e1d8a2aaff796bcbe50058 |
|
MD5 | 40a1e2fc3ba743b545b63affa2b8b5ce |
|
BLAKE2b-256 | fa13829deb922a81299241d270364e154d5bbf1636606ce48d5be31561feddce |
File details
Details for the file ecos-2.0.13-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 90.8 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1979f1f17ec7f1a0fc45964d02d762393f9f427d965fe8a893e7b1476a9023c3 |
|
MD5 | 9d49018b4ea6ac9cd9dfff1d81e965aa |
|
BLAKE2b-256 | 21b1f322024c0f40550214531723887e9897bbdb0102ae562440257326fd0011 |
File details
Details for the file ecos-2.0.13-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: ecos-2.0.13-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84c72e1e5ffa41cd38352dcf0a8c25418f5bf04ed76a576db0daaf9a69f5568f |
|
MD5 | f29b671bac21aef7ba546b9c1ca2866e |
|
BLAKE2b-256 | fbfcdaa2ea986b28c66f436860c5650011d2ff2c506dd33ef17359081559e16d |
File details
Details for the file ecos-2.0.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 218.2 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3c2d4e0d3ada1a619ddd62fbf48ccbe9b738fdbef119945fe2a05566d03b85a |
|
MD5 | 2dcf54f45616e7bd480ea7360714bed5 |
|
BLAKE2b-256 | 1bcc349504b9250fb0dda3660f4e8178742e037dd5dc6ffde567a4c0d6238deb |
File details
Details for the file ecos-2.0.13-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: ecos-2.0.13-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 90.6 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f4a76a3e1165359e1704ec6b1b89d487858ec0d838d62a7268133d88221914 |
|
MD5 | 8fb76b1d44f626c371849fd1525bf5a7 |
|
BLAKE2b-256 | f154621cd4885ba3b922300c8e50744a5f311feb8173dc16119a786887781cfa |