3.5.5
Install
Grab a binary from the table (for MATLAB, use the newest compatible version below):
| Windows | Linux | Mac (High Sierra or above) | |
|---|---|---|---|
| Matlab | R2016a or later, R2014b, R2014a, R2013a or R2013b |
R2014b or later, R2014a |
R2015a or later, R2014b, R2014a |
| Octave | 4.4.1 (32bit / 64bit), 4.4.0 (32bit / 64bit), 5.1.0 (32bit / 64bit), 5.2.0 (32bit / 64bit), 6.1.0 (32bit / 64bit) |
4.4.1, 5.1.0, 5.2.0, 6.1.0 |
5.2.0, 6.1.0(Mojave or higher) |
| Python | Py27 (32bit* / 64bit*), Py35 (32bit* / 64bit*), Py36 (32bit* / 64bit*), Py37 (32bit* / 64bit*), Py38 (32bit* / 64bit*) Py39 (32bit* / 64bit*) |
Py27, Py35, Py36, Py37, Py38, Py39 |
Py27, Py35, Py36, Py37, Py38, Py39 |
or just pip install casadi (needs pip -V>=8.1) |
|||
(*) Check your Python console if you need 32bit or 64bit - bitness should be printed at startup.
Unzip in your home directory and adapt the path:
| Matlab/Octave | Python |
|---|---|
|
|
Get started with the example pack.
Troubleshooting
Release notes
CasADi Functions
- CasADi Functions can be serialized now (#308).
f.save('f.casadi') % Dump any CasADi Function to a file
f = Function.load('f.casadi') % Loads back in
This enables easy sharing of models/solver isntances beteen Matlab/Python/C++ cross-platform, and enables a form of parallelization.
- You can now evaluate CasADi Functions from C without requiring code-generation. This makes it possible to embed CasADi computations in Fortran, Julia, FMI, ...
- All CasADi Functions support timing information now (
print_time, default true for QP and NLP solvers). Userecord_timeto make timings available throughf.stats()without printing them. mapwith reduce arguments now has an efficient implementation (no copying/repmat)- Low-overhead Callback eval support was changed to
eval_buffer FunctionInternal::finalizeno longer takes options dict.- Options
always_inlineandnever_inlinewere added - Options
is_diff_inandis_diff_outwere added - (3.5.2) Ctrl-C interrupts are now disabled in multi-threaded Maps since they could result in crashes
- (3.5.2) Sparsity of Callbacks can be set with
has_jacobian_sparsity/get_jacobian_sparsity - (3.5.2) Jitted functions can now be serialized
- (3.5.2) BSpline constructor takes an inline option yielding a fully differentiable (but not very scalable) BSpline operation for MX
- (3.5.5) Fixed performance deficiency in inline BSline derivatives
CasADi expressions
- breaking:
IMtype is removed from public API (was used to represent integer sparse matrices). UseDMinstead. - breaking:
linspace(0,1,3)andlinspace(0.0,1,3)now both return[0 0.5 1]instead of[0 0 1]for the former MXsupports slicing withMXnow (symbolic indexing).- Issue #2364:
- breaking:
veccatof an empty list now returns0-by-1instead of0-by-0. jtimesoutput dimensions have changed when any of the arguments is empty.- NLP function object's 'lam_p' is now
0-by-1in case of missing parameters.
- breaking:
- (3.5.2) Fixed long-standing bug in
coshderivative - (3.5.2) An MX operation
convexifywas added - (3.5.2) An inefficiency in MX multiplication sparsity was detected and fixed by Mirko Hahn
Interpolation functionality
- Support for parametric (=changeable only, but not differentiable) grid and/or coefficients for linear/spline interpolation
- for
interpolant, new constructors where added that takes dimensions instead of concrete vectors
- for
- Support for symbolic (differentiable) grid and coefficients for linear interpolation (set
inlineoption to true).
Python specific
- Overhead-less CasADi Function evaluation API added through Python memoryviews
- Similar functionality in Callbacks
- (3.5.2) fix numpy compatibility (numpy 1.19)
- (3.5.3) fix the numpy fix
Matlab/Octave specific
- breaking:
a(:)=bnow behaves like Matlab builtin matrices whenais a CasADi matrix. Before, only the first column ofawould be touched by this statement. (#2363) - breaking: Fixed bug where
MXconstructor treated a numeric row vector as column vector. Nowsize(MX(ones(1,4)))returns(1,4)as expected. (#2366) - Can now use spy directly on
DM,MX,SX - (3.5.2) Printing from a multi-threaded map context is disabled beause it could result in crashes. In linux, you may still see the output from a terminal used to start Matlab
Opti
- Opti supports conic problems now:
Opti('conic') - One can now easily obtain a parametric solution as a CasADi Function from an Opti instance:
opti = Opti()
x = opti.variable()
y = opti.variable()
p = opti.parameter()
opti.minimize(y**2+sin(x-y-p)**2)
opti.subject_to(x+y>=1)
opti.solver(nlpsolver,nlpsolver_options)
F = opti.to_function("F",[x,p,opti.lam_g],[x,y])
r = F(0,0.1,0)
(3.5.1) Improved support for vertcatted inputs to to_function
- Using Opti together with
max_iteris more natural now: usesolve_limited()to avoid exceptions to be raised when iterations or time runs out. No need to try/catch.
Code-generation
- breaking:
externalnow looks for a.dylibfile, not.sofor mac - breaking: Codegen API has changes related to thread-local memory:
void* memchanged toint memalloc_mem,init_mem,free_memhave been purged.checkoutandreleasereplace them.
int mem = checkout();
eval(arg, res, iw, w, mem);
release(mem);
- Codegen 'CODEGEN_PREFIX' has been renamed to 'CASADI_CODEGEN_PREFIX'
- QP solvers (QRQP, OSQP) and SqpMethod codegenerate now. This means that embedded MPC with CasADi is now more practical.
- Runge-Kutta and Collocation Integrator objects can be inlined into code-generatable MX Function with the 'simplify' option.
- (3.5.1) an important flaw was corrected that caused incorrect code for expression graphs with logical 'and' and 'or'.
- (3.5.1) fixed regression for expression graphs containing inf/nan
- (3.5.2) fixed bug of a division looking like a comment
- (3.5.2) fixed
mem.hregression - (3.5.2) Made
mainand mex-related functionsc89-compliant
Solvers
-
breaking: NLP solvers -
bound_consistency, an option to post-process the primal and dual solution by projecting it on the bounds, introduced in 3.4, was changed to defaultoff -
Sundials was patched to support multi-threading
-
WORHP was bumped to v1.13
-
SNOPT was bumped to v7.7
-
SuperSCS (conic solver) was added
-
OSQP (QP solver) was added
-
CBC (LP solver) was added
-
(3.5.3) AMPL was fixed to allow other solvers than IPOPT
-
breaking: SQP Method
regularize_marginoption was addedregularize(bool) option was removed. To get the effect ofregularize=true, specifyconvexify_strategy='regularize'. Other strategies include clipping eigenvalues.- line search was reverted from a custom designed thing, to standard textbook L1
-
CPLEX and Gurobi got support for sos constraints
-
Conic/qpsol interface extended for semidefinite programming and SOCP
- Solvers supporting SOCP:
Gurobi,SuperSCS,CPLEX
- Solvers supporting SOCP:
-
breaking: Newton Rootfinder now supports a
line_searchoption (default true) -
Rootfinder now throws an exception by default ('error_on_fail' option true) when failing to converge
-
(3.5.5) Implemented constraints in IDAS and step size limits in CVODES/IDAS integrators
Convenience tools
- Debugging facilities:
- Function options
print_in/print_inprint inputs/outputs when numerically evaluating a function - Function option
dump_in/dump_outdumps to the file system - Function option
dumpdumps the function itself (loadable withFunction.load)
- Function options
DM.from_fileandDM.to_filewith aMatrixMarketandtxtsupport- Helping interaction with codegen with
main=true:Function.generate_in/Function.nz_from_in/Function.nz_to_into help creating input text files. Function.convert_in/Function.convert_outto switch between list and dictionary arguments/results
Binaries
- (3.5.1) Mac binaries for Matlab was switched to a different build environment. The binaries now require High Sierra or above, and work on Catalina.
- (3.5.4) Mac binaries for Python and octave have been switched just like Matlab
- (3.5.4) Linux binaries for Matlab and Octave have been switched to the manylinux environment, with gfortran dependency now grafted in (included, with a unique alias to avoid name collision)
Third-party solver interfaces in binaries
Versions used in binaries ( see FAQ ):
| software | version | library | license env | build env |
|---|---|---|---|---|
| IPOPT | 3.12.3 | shipped | / | / |
| SNOPT | 7.7 | libsnopt7.so/snopt7.dll | SNOPT_LICENSE | SNOPT |
| WORHP | 1.13 | libworhp.so/worhp.dll | WORHP_LICENSE_FILE | WORHP |
| KNITRO | 10.3 | libknitro1030.so/knitro1032.dll | / | KNITRO |
| CPLEX | windows/mac: 12.8.0, linux:12.6.3 | libcplex1263.so / libcplex1280.dll | ILOG_LICENSE_FILE | CPLEX |
| GUROBI | 6.5.0 | libgurobi65.so/gurobi65.dll | GRB_LICENSE_FILE | GUROBI_HOME |