NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2756 most downloaded on PyPI
CasADi -- framework for algorithmic differentiation and numeric optimization
Last release 18 days ago
16 Sep 2026
Release timing varies
gaps range from 3 weeks to 12 months
Most releases are documented
notes for 23 of 32 stable releases
1 version withdrawn
withdrawn after publishing
9 years old
38 releases · first in 2017
Grab a binary from the table: Windows Linux Mac classic (High Sierra or above) Mac M1
Grab a binary from the table:
| Windows | Linux | Mac classic (High Sierra or above) | Mac M1 | |
|---|---|---|---|---|
| Matlab | R2018b or later | R2018b or later | R2018b or later | R2023b or later (Apple Silicon) R2018b or later (Rosetta) |
| Octave | 6.2.0 or later | 6.2.0 or later | 6.2.0 or later | 6.2.0 or later |
| Python | pip install casadi (needs pip -V>=8.1) or wheel below.
Note that we adopted Python Stable ABI, so Python 3.12, 3.13, 3.14, etc should all work with the `cp311-abi3` variant. |
|||
| Javascript | npm install @casadi/casadi-wasm |
For Matlab/Octave, unzip in your home directory and adapt the path:
addpath('<yourpath>/casadi-3.8.1-windows64-matlab2018b')
Check your installation:
| Matlab/Octave | Python | Javascript |
|---|---|---|
|
|
|
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
These notes cover the 3.8 series; additions specific to the patch release are marked 3.8.1.
CasADi gains two new language front-ends, each with a set of examples under docs/examples shipped in the example pack.
This is experimental work. Users are encouraged to try it out and post any bugs.
CasADi can now be driven from Julia without Python intermediary, thanks to an extension of SWIG.
The example docs/examples/julia/simple_nlp.jl should look fairly familiar to seasoned CasADi Python users:
import CasADi as ca
x = ca.SX.sym("x", 2)
f = x[1]^2 + x[2]^2 # objective
g = x[1] + x[2] - 10 # constraint: x0 + x1 - 10 >= 0
nlp = Dict("x" => x, "f" => f, "g" => g)
solver = ca.nlpsol("solver", "ipopt", nlp)
sol = solver(lbg = 0)
println("primal solution = ", sol["x"])CasADi now runs in the browser and in Node.js as a WebAssembly module (#4355), distributed on npm. As JavaScript has no operator overloading, expressions are built with functional forms such as ca.plus/ca.times (from docs/examples/javascript/simple_nlp.js):
const ca = await require("@casadi/casadi-wasm")(); // load the WebAssembly module
const x = ca.SX.sym("x", 2);
const [x0, x1] = ca.vertsplit(x);
const nlp = { x: x,
f: ca.plus(ca.times(x0, x0), ca.times(x1, x1)), // objective
g: ca.minus(ca.plus(x0, x1), ca.SX(10)) }; // x0 + x1 - 10 >= 0
await ca.load_nlpsol("ipopt"); // 3.8.1: load the plugin before use
const solver = ca.nlpsol("solver", "ipopt", nlp);
const sol = solver.call({ lbg: ca.DM(0) });
console.log("primal solution = " + sol["x"]);The same module loads straight from a CDN (e.g. unpkg.com/@casadi/casadi-wasm), so if you are into vibecoding self-contained HTML pages, you can now drop a full CasADi optimization - IPOPT and all - into a single static .html file with no build step (see docs/examples/javascript/unpkg_demo.html).
ca.load_nlpsol("ipopt") (or the appropriate load_* method) before constructing a solver; concurrent loads share a request and failed loads can be retried (commit).CasADi can now bridge to the ONNX ecosystem in two complementary ways, so that trained neural networks and other ONNX graphs can participate directly in CasADi computations:
Both modes are driven through a new GraphBuilder class:
# Black-box: load an ONNX model and evaluate it as a CasADi Function
f = ca.GraphBuilder("model.onnx").create("f")
print(f(ca.vertcat(0.5, 1.0, -2.0)))
# Symbolic: import the model into native, differentiable CasADi expressions ...
g = GraphBuilder("model.onnx").create("g", {"symbolic": True})
# ... or export a CasADi Function back to ONNX
GraphBuilder(f).export_onnx("roundtrip.onnx")This is a new capability and still evolving. The symbolic translation is available when CasADi is built with WITH_ONNX; the ONNX Runtime black-box backend additionally requires WITH_ONNX_RUNTIME (which forces WITH_ONNX).
f.onnx, supply fwd_f.onnx, adj_f.onnx or jac_f.onnx. Models are loaded on demand, and the same convention supports nested derivatives such as adj_adj_f.onnx (#4411).Constant, Reshape and Slice handling. Structural integer constants retain their precision, and floating-point inputs/outputs are identified as differentiable (import fix, integer and differentiation fix).CASADI_ONNXRUNTIME_LIB, replacing the non-functional stub previously shipped (#4406). ONNX code generation also received runtime and header fixes (runtime fix, header fix).CasADi was historically targeted at small/medium heterogeneous dynamic systems, where dense-dense multiplication is typically rare and not a computational bottleneck (though large sparse-sparse products do play an important role). This release closes the remaining gaps so that dense-heavy workloads are no longer penalized:
mtimes, in both the runtime and the generated code, now takes an extra "BLAS argument" that selects which multiplication kernel is used. For dense problems you can choose between the built-in reference kernel, whatever BLAS CasADi was built against, and blasfeo: mtimes(A, B) # default: built-in reference kernel (triple loop)
mtimes(A, B, "reference") # same -- explicit
mtimes(A, B, "classic") # whatever was built into CasADi via WITH_LAPACK (typically OpenBLAS)
mtimes(A, B, "blasfeo") # uses blasfeoThe blas argument is ignored when either operand is sparse.
det(A, lsolver) computes a determinant through a linear-solver factorization (e.g. CSparse LU, symbolic_qr) instead of cofactor expansion, making determinants of large, sparse matrices practical (#2821). Thanks @nielsvd (Niels van Duijkeren).bspline constructor takes its knots (and coefficients) as MX, so knot positions can be supplied or differentiated at evaluation time rather than baked in at construction.blazing_spline now supports up to five input dimensions and a parametric-knots variant whose knots are a symbolic input.monitor for inspecting intermediate values during evaluationkron (Kronecker product) is now backed by a dedicated MX node (#939).SX and an MX with == now raises an error instead of silently returning False (#2817).linspace with MX symbols as start/end points no longer causes the number of nodes to blow up (#3531).TypeError instead of segfaulting (#4216).eval_mx (#2934).SX::set_precision is now respected when printing SX (#4326), andprint_instructions is harmonized across SX and MX (#4170).if_else with vector-valued conditions (#4387).transformExpression and Function graphs can now be optimized through a single, ordered pipeline of passes, exposed as Function.transform (and as a free function transform on expressions). This is the new, consistent entry point for graph simplification, replacing the older per-type simplify methods (#4227); the simplification engine underneath has itself been substantially reworked and extended (#2069, #4219).
The syntax takes the form of a list of verbs such as combine_terms prefixed with "simplify".
# on an expression (or list of expressions):
transform(8*y - 3*y, [["simplify", "combine_terms"]]) # -> 5*y
# on a Function — an explicit pipeline, or the default flow with no arguments:
f.transform([["simplify", "combine_terms"]])
f.transform() # default: cse + ref_count + const_folding + empty_inputsThe currently available verbs are:
simplify) like terms are collected into a single weighted term:
transform(8*y - 3*y, [["simplify", "combine_terms"]]) # -> 5*y
transform(8*(5*x) - 3*(x + 3 + (12*x - x) - 17*x),
[["simplify", "combine_terms"]]) # -> 55*x - 9A = MX(DM([[2, 0], [1, 3]]))
transform(A @ A @ x, [["simplify", "const_folding"]]) # A@A precomputed to [[4,0],[5,9]]a+b-a -> b since a long while in CasADi. These are restricted to situations where the resultant nodes set is unconditionally beneficial. As an example, a transformation -(a-b) -> b-a is only beneficial if a-b is not used somewhere else in the graph. The list of reference-counting aware simplifications is fairly limited for now, but is expected to grow in the future.
transform(-(a - b), [["simplify", "ref_count"]]) # -> b - acse):
transform(sin(x)+1/sin(x), [["simplify", "cse"]]) # sin(x) evaluated once, sharedf = Function("f", [x, p], [x**2]) # p never reaches the output
g = f.transform([["simplify", "empty_inputs"]])
g.nnz_in(1) # 3 -> 0: input p is now emptyTwo further pipeline verbs compose with these: expand lowers an MX Function to an SXFunction, and external applies a transform supplied by an external shared library (for plugin-defined optimizations).
Passes run in the order given; an integer before a task sets how many times it runs - a positive count runs it that many times, and 0 runs it until a fixed point - so a pipeline can be iterated to convergence.
For example, the following commands runs an unlimited amount "ref_count" passes, followed by 2 "constant_folding" passes.
f.transform("g", [["simplify",0,"ref_count",2,"const_folding"]])Function.activity(mask) propagates an input "activity" mask (which input nonzeros may be nonzero) to the outputs, exploiting annihilation - an inactive operand of a multiplication kills the product - so it is strictly sharper than ordinary sparsity propagation (#3019).get_function() now raises a clear error instead of crashing when given an unknown name (#4238), and find_functions now descends into the oracle (#4033).expand now honours the expand option/generate_options (#4236), and thedetect_simple_bounds helper now observes the expand option (#4235). For example, a Function constructed with 'print_instructions' now still prints the instructions after an .expand() pass.dump_trace option records numerical evaluation traces that can be replayed in the graph viewer (#4412, #747).Function.export_graph("graph.html") exports SX/MX instruction graphs for interactive inspection in a browser; Graphviz .dot and JSON .casadi_viz exports are also supported (#4412, #747).It is now thread-safe to evaluate code-generated non-trivial Functions (i.e. those carrying memory objects, such as NLP/QP solvers) from multiple threads at once (#2463). To make a generated Function thread-safe:
incref/decref from the main thread.thread_safe option as true in the code-generation step. This injects generic mutex facilities into the generated code.-DCASADI_THREAD_TYPE=CASADI_THREAD_TYPE_POSIX, -DCASADI_THREAD_TYPE=CASADI_THREAD_TYPE_C11, -DCASADI_THREAD_TYPE=CASADI_THREAD_TYPE_OMP, or -DCASADI_THREAD_TYPE=CASADI_THREAD_TYPE_WINDOWS.-DCASADI_MAX_NUM_THREADS=2.Related thread-safety fixes: a memory leak in JIT-compiled Functions that mixed incref/decref (#4331), and a crash of the Windows binaries when thread-mapping a Function with memory objects (#4274).
Other code-generation changes:
alloc_mem/init_mem/free_mem entry points. They were always ignored by external so it is unlikely that any code relied on theire presence. Memory was always managed through checkout/release (#4249, #3764).CASADI_PREFIX are now correctly prefixed (#4245).dump_in is now implemented in code generation (#3971).is_diff_in (#4278).docs/examples/python/pseudospectral_collocation.py). Thanks to @sandeep026 (Sandeepkumar R), #4380.y for outputs, alg for residual variables), a generalized all, and a single generic outputs(cat) replacing the per-category shorthands (ydef(), wdef(), ...).DaeBuilder.export_fmu has been streamlined (#4165) and now returns a dictionary giving the relative path of each generated file, instead of just a list of generated files. Two companion methods close the loop entirely within CasADi: compile_fmu compiles the exported sources into a binary, and pack_fmu packs the file map into a single distributable .fmu archive.x and q, #4100), and a timeNew solver interfaces:
conic interface for LP/MIP/QP (#2797,conic interface.conic interface wrapping the PIQP proximal interior-point QP solver.ccopt, a new nlpsol plugin for mathematical programs with complementarity constraints (MPCC), built on the madNLP backend. Complementarity pairs (0 <= x ⊥ y >= 0) are declared through the ind_cc option; see docs/examples/cplusplus/basic_mpcc.cpp.nlpsol interface (#3908; contribution bynlpsol interface to CONOPT, a commercial nonlinear solver from GAMS (@GAMS-dev). Thanks to @stephenjmaher (Stephen J. Maher), #4369.bisection, a new rootfinder plugin for scalar equations, with bracket bounds, bracket search and configurable residual/step tolerances. Thanks to @Zcaic, #4404.New capabilities on existing solvers:
lazy_constraints_callback option. Gurobi calls it at each new integer-feasible solution (a MIPSOL event) with the current solution, and the function returns lazy constraints that are injected into the branch-and-bound on the fly, enabling cutting-plane workflows such as subtour elimination (contribution by @aghezz1, Andrea Ghezzi).opti.dual return values (#4020).Opti.to_function accepts helper_options to configure its internal helper Function (#3655).CasADi now works much more naturally alongside NumPy, through two new facilities.
A numpy-style array view, casadi.array (a.k.a. casadi.ArrayInterface). This wraps a DM, SX or MX and gives it NumPy semantics: a logical ndim, NumPy-style indexing (so A[0] is the first row, where a plain CasADi M[0] is the first element), axis-aware reductions, and the usual operators. Call .to_casadi() to get the native CasADi value back. This settles the long-standing confusion that CasADi indexing did not match NumPy (#2959):
import casadi as ca
A = ca.array([[1, 2, 3], [4, 5, 6]]) # ca.array is ca.ArrayInterface
A.ndim # 2
A[0] # first row [1, 2, 3] (NumPy-style)
A.to_casadi() # back to a native DM / SX / MXOpt-in NumPy dispatch via GlobalOptions.setNumpyMode(1).
With this enabled, calling a NumPy function on a CasADi value follows NumPy's shape/axis contract and returns a casadi.array, instead of the old behaviour of silently densifying. A large set of NumPy ufuncs (__array_ufunc__, NEP 13) and array-functions (__array_function__, NEP 18) now dispatch natively on CasADi types — np.concatenate, np.where, np.reshape, np.dot/np.matmul/np.kron, the reductions (np.sum, np.cumsum, np.max, ...), and np.linalg.* (solve, det, inv, cholesky, norm) - including symbolic SX/MX inputs (#2626, partly inspired by aerosandbox, #2762):
import numpy as np
from casadi import SX, DM, GlobalOptions
GlobalOptions.setNumpyMode(1) # opt in (temporary - becomes the default later)
x = SX.sym("x", 3)
np.concatenate([x, x]) # dispatches on a symbolic (NEP 18)
np.sum(DM([[1, 2], [3, 4]]), axis=0) # [4, 6] — true NumPy axis semantics
np.linalg.solve(DM([[2, 0], [0, 4]]), DM([2, 8])) # np.linalg.* handled natively -> [1, 2]The mode is a transitional feature: 0 (default) keeps the old behaviour but warns, -1 keeps it silently, 1 opts into the new NumPy-aware behaviour. As the mode may disappear in the future, it is best to probe availability with hasattr(casadi.GlobalOptions, "setNumpyMode").
ArrayInterface indexing, assignment, broadcasting and NumPy dispatch (#4400).breaking The behavior of np.remainder/np.mod/% applied on CasADi types was fixed to be in align with numpy expectations.
All of the below return 1 in Python.
print(np.remainder(3,2))
print(np.mod(3,2))
print(3 % 2)Now consider the CasADi variants:
print(np.remainder(ca.DM(3),ca.DM(2)))
print(np.mod(ca.DM(3),ca.DM(2)))
print(ca.DM(3) % np.array(2))These returned -1 in prior CasADi versions, and now return 1.
IM alias (#4390, #4407). Thanks to @Kroppeb (Robbe Pincket) for the type-alias forward-reference fix (#4398).casadi.tools.structure (#4399). Multiple-return-value wrapping now works with unpatched SWIG, preserving list-valued outputs (#4057).Callback objects work in MATLAB again: a long-standing regression that made MATLAB callbacks segfault has been fixed (#1720).vcat/hcat and friends for MATLAB (#4338).CASADI_PLUGIN_SEARCH_PATH environment variable (#4339), and the Windows DLL search has been refined (#4340).GlobalOptions.setTempWorkDir() (#4175).RTLD_DEEPBIND/environ workaround that corrupted the environment for loaded libraries (#4317), a build bug with -DWITH_BUILD_MUMPS and a missing METIS_DIR (#4328), and a SWIG issue on Apple Silicon (#2992).EXT_DEP=ON in the BLASFEO build configuration to avoid crashes when used alongside acados (#4395).WITH_FMI3=OFF (#4397).manylinux_2_28 (previously manylinux2014). manylinux2014 Python wheels are still supplied in parallel for backwards compatibility.CXX_USE_CXX11_ABI=0 (#4222). C++ code that links against the binaries must now be built with the newThanks to everyone who contributed pull requests to this release. Beyond the items credited inline above, this release includes community contributions from @sixpearls (Ben Margolis - Python mtimes dispatch, #4268), @barracuda156 (Sergey Fedorov - PowerPC/Darwin build fixes, #4112,
#4113), @qbisi (FindMUMPS.cmake fix, #3899), @nim65s (Guilhem Saurel - a missing include, #4192), @jarsarasty (HiGHS v1.13.1 upgrade, #4299), @billtubbs (Bill Tubbs - Python semicolons and asserts, #3968), @adrian-nilsson-fcc (Adrian Nilsson - FMU demo notebook, #3900), and @josipkh (Josip Kir Hromatko - typo fixes, #3848).
3.8.1: Thanks also to @leanderbuerkin for an Opti documentation correction (#4410).
The full list of closed issues for this release is available on the 3.8 milestone.
3.8.1: Closed issues are listed on the 3.8.1 milestone. The complete patch-release history is available in the 3.8.0...3.8.1 comparison.
Note truncated.
One column per quarter.
Grab a binary from the table: Windows Linux Mac classic (High Sierra or above) Mac M1
Grab a binary from the table:
| Windows | Linux | Mac classic (High Sierra or above) | Mac M1 | |
|---|---|---|---|---|
| Matlab | R2018b or later | R2018b or later | R2018b or later | R2023b or later (Apple Silicon) R2018b or later (Rosetta) |
| Octave | 6.2.0 or later | 6.2.0 or later | 6.2.0 or later | 6.2.0 or later |
| Python | pip install casadi (needs pip -V>=8.1) or wheel below.
Note that we adopted Python Stable ABI, so Python 3.12, 3.13, 3.14, etc should all work with the `cp311-abi3` variant. |
|||
| Javascript | npm install @casadi/casadi-wasm |
For Matlab/Octave, unzip in your home directory and adapt the path:
addpath('<yourpath>/casadi-3.8.0-windows64-matlab2018b')
Check your installation:
| Matlab/Octave | Python | Javascript |
|---|---|---|
|
|
|
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
CasADi gains two new language front-ends, each with a set of examples under docs/examples shipped in the example pack.
This is experimental work. Users are encouraged to try it out and post any bugs.
CasADi can now be driven from Julia without Python intermediary, thanks to an extension of SWIG.
The example docs/examples/julia/simple_nlp.jl should look fairly familiar to seasoned CasADi Python users:
import CasADi as ca
x = ca.SX.sym("x", 2)
f = x[1]^2 + x[2]^2 # objective
g = x[1] + x[2] - 10 # constraint: x0 + x1 - 10 >= 0
nlp = Dict("x" => x, "f" => f, "g" => g)
solver = ca.nlpsol("solver", "ipopt", nlp)
sol = solver(lbg = 0)
println("primal solution = ", sol["x"])CasADi now runs in the browser and in Node.js as a WebAssembly module (#4355), distributed on npm. As JavaScript has no operator overloading, expressions are built with functional forms such as ca.plus/ca.times (from docs/examples/javascript/simple_nlp.js):
const ca = await require("@casadi/casadi-wasm")(); // load the WebAssembly module
const x = ca.SX.sym("x", 2);
const [x0, x1] = ca.vertsplit(x);
const nlp = { x: x,
f: ca.plus(ca.times(x0, x0), ca.times(x1, x1)), // objective
g: ca.minus(ca.plus(x0, x1), ca.SX(10)) }; // x0 + x1 - 10 >= 0
const solver = ca.nlpsol("solver", "ipopt", nlp);
const sol = solver.call({ lbg: ca.DM(0) });
console.log("primal solution = " + sol["x"]);The same module loads straight from a CDN (e.g. unpkg.com/@casadi/casadi-wasm), so if you are into vibecoding self-contained HTML pages, you can now drop a full CasADi optimization - IPOPT and all - into a single static .html file with no build step (see docs/examples/javascript/unpkg_demo.html).
CasADi can now bridge to the ONNX ecosystem in two complementary ways, so that trained neural networks and other ONNX graphs can participate directly in CasADi computations:
Both modes are driven through a new GraphBuilder class:
# Black-box: load an ONNX model and evaluate it as a CasADi Function
f = ca.GraphBuilder("model.onnx").create("f")
print(f(ca.vertcat(0.5, 1.0, -2.0)))
# Symbolic: import the model into native, differentiable CasADi expressions ...
g = GraphBuilder("model.onnx").create("g", {"symbolic": True})
# ... or export a CasADi Function back to ONNX
GraphBuilder(f).export_onnx("roundtrip.onnx")This is a new capability and still evolving. The symbolic translation is available when CasADi is built with WITH_ONNX; the ONNX Runtime black-box backend additionally requires WITH_ONNX_RUNTIME (which forces WITH_ONNX).
CasADi was historically targeted at small/medium heterogeneous dynamic systems, where dense-dense multiplication is typically rare and not a computational bottleneck (though large sparse-sparse products do play an important role). This release closes the remaining gaps so that dense-heavy workloads are no longer penalized:
mtimes, in both the runtime and the generated code, now takes an extra "BLAS argument" that selects which multiplication kernel is used. For dense problems you can choose between the built-in reference kernel, whatever BLAS CasADi was built against, and blasfeo: mtimes(A, B) # default: built-in reference kernel (triple loop)
mtimes(A, B, "reference") # same -- explicit
mtimes(A, B, "classic") # whatever was built into CasADi via WITH_LAPACK (typically OpenBLAS)
mtimes(A, B, "blasfeo") # uses blasfeoThe blas argument is ignored when either operand is sparse.
det(A, lsolver) computes a determinant through a linear-solver factorization (e.g. CSparse LU, symbolic_qr) instead of cofactor expansion, making determinants of large, sparse matrices practical (#2821). Thanks @nielsvd (Niels van Duijkeren).bspline constructor takes its knots (and coefficients) as MX, so knot positions can be supplied or differentiated at evaluation time rather than baked in at construction.blazing_spline now supports up to five input dimensions and a parametric-knots variant whose knots are a symbolic input.monitor for inspecting intermediate values during evaluationkron (Kronecker product) is now backed by a dedicated MX node (#939).SX and an MX with == now raises an error instead of silently returning False (#2817).linspace with MX symbols as start/end points no longer causes the number of nodes to blow up (#3531).TypeError instead of segfaulting (#4216).eval_mx (#2934).SX::set_precision is now respected when printing SX (#4326), andprint_instructions is harmonized across SX and MX (#4170).transformExpression and Function graphs can now be optimized through a single, ordered pipeline of passes, exposed as Function.transform (and as a free function transform on expressions). This is the new, consistent entry point for graph simplification, replacing the older per-type simplify methods (#4227); the simplification engine underneath has itself been substantially reworked and extended (#2069, #4219).
The syntax takes the form of a list of verbs such as combine_terms prefixed with "simplify".
# on an expression (or list of expressions):
transform(8*y - 3*y, [["simplify", "combine_terms"]]) # -> 5*y
# on a Function — an explicit pipeline, or the default flow with no arguments:
f.transform([["simplify", "combine_terms"]])
f.transform() # default: cse + ref_count + const_folding + empty_inputsThe currently available verbs are:
simplify) like terms are collected into a single weighted term:
transform(8*y - 3*y, [["simplify", "combine_terms"]]) # -> 5*y
transform(8*(5*x) - 3*(x + 3 + (12*x - x) - 17*x),
[["simplify", "combine_terms"]]) # -> 55*x - 9A = MX(DM([[2, 0], [1, 3]]))
transform(A @ A @ x, [["simplify", "const_folding"]]) # A@A precomputed to [[4,0],[5,9]]a+b-a -> b since a long while in CasADi. These are restricted to situations where the resultant nodes set is unconditionally beneficial. As an example, a transformation -(a-b) -> b-a is only beneficial if a-b is not used somewhere else in the graph. The list of reference-counting aware simplifications is fairly limited for now, but is expected to grow in the future.
transform(-(a - b), [["simplify", "ref_count"]]) # -> b - acse):
transform(sin(x)+1/sin(x), [["simplify", "cse"]]) # sin(x) evaluated once, sharedf = Function("f", [x, p], [x**2]) # p never reaches the output
g = f.transform([["simplify", "empty_inputs"]])
g.nnz_in(1) # 3 -> 0: input p is now emptyTwo further pipeline verbs compose with these: expand lowers an MX Function to an SXFunction, and external applies a transform supplied by an external shared library (for plugin-defined optimizations).
Passes run in the order given; an integer before a task sets how many times it runs - a positive count runs it that many times, and 0 runs it until a fixed point - so a pipeline can be iterated to convergence.
For example, the following commands runs an unlimited amount "ref_count" passes, followed by 2 "constant_folding" passes.
f.transform("g", [["simplify",0,"ref_count",2,"const_folding"]])Function.activity(mask) propagates an input "activity" mask (whichinput nonzeros may be nonzero) to the outputs, exploiting annihilation - an inactive operand of a multiplication kills the product - so it is strictly sharper than ordinary sparsity propagation (#3019).get_function() now raises a clear error instead of crashing when given an unknown name (#4238), and find_functions now descends into the oracle (#4033).expand now honours the expand option/generate_options (#4236), and thedetect_simple_bounds helper now observes the expand option (#4235). For example, a Function constructed with 'print_instructions' now still prints the instructions after an .expand() pass.It is now thread-safe to evaluate code-generated non-trivial Functions (i.e. those carrying memory objects, such as NLP/QP solvers) from multiple threads at once (#2463). To make a generated Function thread-safe:
incref/decref from the main thread.thread_safe option as true in the code-generation step. This injects generic mutex facilities into the generated code.-DCASADI_THREAD_TYPE=CASADI_THREAD_TYPE_POSIX, -DCASADI_THREAD_TYPE=CASADI_THREAD_TYPE_C11, -DCASADI_THREAD_TYPE=CASADI_THREAD_TYPE_OMP, or -DCASADI_THREAD_TYPE=CASADI_THREAD_TYPE_WINDOWS.-DCASADI_MAX_NUM_THREADS=2.Related thread-safety fixes: a memory leak in JIT-compiled Functions that mixed incref/decref (#4331), and a crash of the Windows binaries when thread-mapping a Function with memory objects (#4274).
Other code-generation changes:
alloc_mem/init_mem/free_mem entry points. They were always ignored by external so it is unlikely that any code relied on theire presence. Memory was always managed through checkout/release (#4249, #3764).CASADI_PREFIX are now correctly prefixed (#4245).dump_in is now implemented in code generation (#3971).is_diff_in (#4278).y for outputs, alg for residual variables), a generalized all, and a single generic outputs(cat) replacing the per-category shorthands (ydef(), wdef(), ...).DaeBuilder.export_fmu has been streamlined (#4165) and now returns a dictionary giving the relative path of each generated file, instead of just a list of generated files. Two companion methods close the loop entirely within CasADi: compile_fmu compiles the exported sources into a binary, and pack_fmu packs the file map into a single distributable .fmu archive.x and q, #4100), and a timeNew solver interfaces:
conic interface for LP/MIP/QP (#2797,conic interface.conic interface wrapping the PIQP proximal interior-point QP solver.ccopt, a new nlpsol plugin for mathematical programs with complementarity constraints (MPCC), built on the madNLP backend. Complementarity pairs (0 <= x ⊥ y >= 0) are declared through the ind_cc option; see docs/examples/cplusplus/basic_mpcc.cpp.nlpsol interface (#3908; contribution byNew capabilities on existing solvers:
lazy_constraints_callback option. Gurobi calls it at each new integer-feasible solution (a MIPSOL event) with the current solution, and the function returns lazy constraints that are injected into the branch-and-bound on the fly, enabling cutting-plane workflows such as subtour elimination (contribution by @aghezz1, Andrea Ghezzi).opti.dual return values (#4020).CasADi now works much more naturally alongside NumPy, through two new facilities.
A numpy-style array view, casadi.array (a.k.a. casadi.ArrayInterface). This wraps a DM, SX or MX and gives it NumPy semantics: a logical ndim, NumPy-style indexing (so A[0] is the first row, where a plain CasADi M[0] is the first element), axis-aware reductions, and the usual operators. Call .to_casadi() to get the native CasADi value back. This settles the long-standing confusion that CasADi indexing did not match NumPy (#2959):
import casadi as ca
A = ca.array([[1, 2, 3], [4, 5, 6]]) # ca.array is ca.ArrayInterface
A.ndim # 2
A[0] # first row [1, 2, 3] (NumPy-style)
A.to_casadi() # back to a native DM / SX / MXOpt-in NumPy dispatch via GlobalOptions.setNumpyMode(1).
With this enabled, calling a NumPy function on a CasADi value follows NumPy's shape/axis contract and returns a casadi.array, instead of the old behaviour of silently densifying. A large set of NumPy ufuncs (__array_ufunc__, NEP 13) and array-functions (__array_function__, NEP 18) now dispatch natively on CasADi types — np.concatenate, np.where, np.reshape, np.dot/np.matmul/np.kron, the reductions (np.sum, np.cumsum, np.max, ...), and np.linalg.* (solve, det, inv, cholesky, norm) - including symbolic SX/MX inputs (#2626, partly inspired by aerosandbox, #2762):
import numpy as np
from casadi import SX, DM, GlobalOptions
GlobalOptions.setNumpyMode(1) # opt in (temporary - becomes the default later)
x = SX.sym("x", 3)
np.concatenate([x, x]) # dispatches on a symbolic (NEP 18)
np.sum(DM([[1, 2], [3, 4]]), axis=0) # [4, 6] — true NumPy axis semantics
np.linalg.solve(DM([[2, 0], [0, 4]]), DM([2, 8])) # np.linalg.* handled natively -> [1, 2]The mode is a transitional feature: 0 (default) keeps the old behaviour but warns, -1 keeps it silently, 1 opts into the new NumPy-aware behaviour. As the mode may disappear in the future, it is best to probe availability with hasattr(casadi.GlobalOptions, "setNumpyMode").
breaking The behavior of np.remainder/np.mod/% applied on CasADi types was fixed to be in align with numpy expectations.
All of the below return 1 in Python.
print(np.remainder(3,2))
print(np.mod(3,2))
print(3 % 2)
Now consider the CasADi variants:
print(np.remainder(ca.DM(3),ca.DM(2)))
print(np.mod(ca.DM(3),ca.DM(2)))
print(ca.DM(3) % np.array(2))
These returned -1 in prior CasADi versions, and now return 1.
Callback objects work in MATLAB again: a long-standing regression that made MATLAB callbacks segfault has been fixed (#1720).vcat/hcat and friends for MATLAB (#4338).CASADI_PLUGIN_SEARCH_PATH environment variable (#4339), and the Windows DLL search has been refined (#4340).GlobalOptions.setTempWorkDir() (#4175).RTLD_DEEPBIND/environ workaround that corrupted the environment for loaded libraries (#4317), a build bug with -DWITH_BUILD_MUMPS and a missing METIS_DIR (#4328), and a SWIG issue on Apple Silicon (#2992).manylinux_2_28 (previously manylinux2014). manylinux2014 Python wheels are still supplied in parallel for backwards compatibility.CXX_USE_CXX11_ABI=0 (#4222). C++ code that links against the binaries must now be built with the newThanks to everyone who contributed pull requests to this release. Beyond the items credited inline above, this release includes community contributions from @sixpearls (Ben Margolis - Python mtimes dispatch, #4268), @barracuda156 (Sergey Fedorov - PowerPC/Darwin build fixes, #4112,
#4113), #qbisi (FindMUMPS.cmake fix, #3899), @nim65s (Guilhem Saurel - a missing include, #4192), @jarsarasty (HiGHS v1.13.1 upgrade, #4299), @billtubbs (Bill Tubbs - Python semicolons and asserts, #3968), @adrian-nilsson-fcc (Adrian Nilsson - FMU demo notebook, #3900), and @josipkh (Josip Kir Hromatko - typo fixes, #3848).
The full list of closed issues for this release is available on the 3.8 milestone.
Windows Linux Mac classic (High Sierra or above) Mac M1
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-osx_arm64-matlab2018b.zip">R2023b</a> or later (Apple Silicon)<br/><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-osx64-matlab2018b.zip">R2018b</a> or later (Rosetta)</td> </tr> <tr> <th>Octave (<10)</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.2/casadi-3.7.2-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.7.2-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.A uniform sum operation is now exposed to the user, next to existing sum1/sum2. In Python, it behaves exactly like np.sum. In Matlab, it follows the conventions of the builtin Matlab sum. breaking If you have been doing from casadi import *, you'll find that sum no longer refers to the builtin Python sum. You may use import builtins;builtins.sum to access that variant.
You can now put Function calls (e.g. bsplines/lookup tables, Callbacks) into SX graphs. Consequently, you can more often perform expand on an MX graph (still it may not always be a good idea). You can force Functions to end up as SX call nodes with option never_inline true.
You can now make call SX Functions with MX in an inlining fashion, y setting always_inline true.
New functionality extract_parametric. The purpose of extract_parametric is ultimately to save on evaluation time of an expression, by extracting out the parts that are only solely dependent on parameters.
Here is an example of CasADi Function with a contraction of a 100-by-100 input in its graph, dependent only on parameters:
x = MX.sym('x');
p = MX.sym('p',100,100);
q = MX.sym('q');
expr = sin(x*sumsqr(p))*q;
f = Function('f',{x,p,q},{expr}) % f:(i0,i1[100x100],i2)->(o0) MXFunction
% Suppose we call this Function a lot of times with different values for x but equal values for p and q
% Recomputing sumsqr(p) every time would be a waste.
% Distill out the parts of the expression that only dependent on parameters p and q.
[expr_ret, symbols, parametric] = extract_parametric(expr, {p,q}, struct('extract_trivial', true));
% Construct now a hot function, called every time
f_compact = Function('f_compact',[{x} symbols],{expr_ret}) % f_compact:(i0,i1,i2)->(o0) MXFunction
% And a precompute that can be evaluated at initalization / outside a hot loop.
f_precompute = Function('f_precompute',{p,q},parametric) % f_precompute:(i0[100x100],i1)->(o0,o1) MXFunction
% Numerical check
rng(1)
x_num = rand(1);
p_num = rand(100,100);
q_num = rand(1);
[e_0, e_1] = f_precompute(p_num,q_num);
f_compact(x_num,e_0,e_1) % -0.116384
f(x_num,p_num,q_num) % -0.116384
separate_linear. The purpose is to separate out parts of an expression graph that are constant or linear. Note that the partitioning is done with a straightforward pass through the graph. There are no computer-algebra-system type of transformations performed to influence the partitioning.[expr_const,expr_lin,expr_nonlin] = separate_linear(cos(p)+7*x+x*y, [x,y], p)
expr_const: cos(p)
expr_lin: 7*x
expr_nonlin: x*y
Several bugfixes related to arguments shaped (0-by-n) or (n-by-0). breaking Your code may be relying on broken implementations of diagcat and jtimes.
A bug was fixed related to 0^0 in MX.
breaking The fix may impact you if you used **(-1) (Python) or .^(-1) (Matlab) (element-wise power) on sparse matrices, e.g. for scaling matrices.
v = DM.rand(10,1)
print(diag(v)) # Sparse matrix with only diagonal entries
# Used to return a sparse matrix with diagonal entries inverted
# Now returns a dense matrix full of infs on the off-diagonals.
print(diag(v)**(-1))
# If you had this use case before, you can do the element-wise power on the vector progenitor:
print(diag(v**(-1)))
# Or use matrix-wise operations
print(inv(diag(v)))
print(mpower(diag(v),-1))
calc_lam_p and no_nlp_grad for nlpsol have now been made false and true respectively, eliminating that overhead.GlobalOptions's setCopyElisionMinSize.force_canonical true to revert to old behaviour.rfp = ca.Function('rfp', [X_unknown, X[0], U], [g], ['V0', 'X0', 'U'], ['V'])
ca.rootfinder('ifcn', 'kinsol', rfp) # output (V0[6],X0[2],U)->(V[6])
Should be adapted to:
# For the unknown, drop the trailing '0' from the label
# For the residual output, pick anything as long as there is no name collision
rfp = ca.Function('rfp', [X_unknown, X[0], U], [g], ['V', 'X0', 'U'], ['res'])
ca.rootfinder('ifcn', 'kinsol', rfp) # still outputs (V0[6],X0[2],U)->(V[6])
set_linear_scale syntax for decision variables, and a linear_scale argument to subject_to.show_infeasibilities is now easier to interpret when detect_simple_bounds is active.dump dump_in dump_out options now create directories when needed.find_package(casadi CONFIG REQUIRED)
add_executable(casadi_demo casadi_demo.cpp)
target_link_libraries(casadi_demo casadi::casadi)
The integrator class has been extended to support state events. This is a prototype implementation, currently only tested with Sundials/CVODES. First order analytic sensitivity calculations (but not yet other forms of sensitivity analysis) is possible for systems with events, including propagation of sensitivities through zero-crossing functions and events dynamics. The approach is compatible with when equations formulated in DaeBuilder (see above), but can also be used stand-alone. For details, see the implementation paper.
Windows Linux Mac classic (High Sierra or above) Mac M1
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-osx_arm64-matlab2018b.zip">R2023b</a> or later (Apple Silicon)<br/><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-osx64-matlab2018b.zip">R2018b</a> or later (Rosetta)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.1/casadi-3.7.1-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.7.1-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.A uniform sum operation is now exposed to the user, next to existing sum1/sum2. In Python, it behaves exactly like np.sum. In Matlab, it follows the conventions of the builtin Matlab sum. breaking If you have been doing from casadi import *, you'll find that sum no longer refers to the builtin Python sum. You may use import builtins;builtins.sum to access that variant.
You can now put Function calls (e.g. bsplines/lookup tables, Callbacks) into SX graphs. Consequently, you can more often perform expand on an MX graph (still it may not always be a good idea). You can force Functions to end up as SX call nodes with option never_inline true.
You can now make call SX Functions with MX in an inlining fashion, y setting always_inline true.
New functionality extract_parametric. The purpose of extract_parametric is ultimately to save on evaluation time of an expression, by extracting out the parts that are only solely dependent on parameters.
Here is an example of CasADi Function with a contraction of a 100-by-100 input in its graph, dependent only on parameters:
x = MX.sym('x');
p = MX.sym('p',100,100);
q = MX.sym('q');
expr = sin(x*sumsqr(p))*q;
f = Function('f',{x,p,q},{expr}) % f:(i0,i1[100x100],i2)->(o0) MXFunction
% Suppose we call this Function a lot of times with different values for x but equal values for p and q
% Recomputing sumsqr(p) every time would be a waste.
% Distill out the parts of the expression that only dependent on parameters p and q.
[expr_ret, symbols, parametric] = extract_parametric(expr, {p,q}, struct('extract_trivial', true));
% Construct now a hot function, called every time
f_compact = Function('f_compact',[{x} symbols],{expr_ret}) % f_compact:(i0,i1,i2)->(o0) MXFunction
% And a precompute that can be evaluated at initalization / outside a hot loop.
f_precompute = Function('f_precompute',{p,q},parametric) % f_precompute:(i0[100x100],i1)->(o0,o1) MXFunction
% Numerical check
rng(1)
x_num = rand(1);
p_num = rand(100,100);
q_num = rand(1);
[e_0, e_1] = f_precompute(p_num,q_num);
f_compact(x_num,e_0,e_1) % -0.116384
f(x_num,p_num,q_num) % -0.116384
separate_linear. The purpose is to separate out parts of an expression graph that are constant or linear. Note that the partitioning is done with a straightforward pass through the graph. There are no computer-algebra-system type of transformations performed to influence the partitioning.[expr_const,expr_lin,expr_nonlin] = separate_linear(cos(p)+7*x+x*y, [x,y], p)
expr_const: cos(p)
expr_lin: 7*x
expr_nonlin: x*y
Several bugfixes related to arguments shaped (0-by-n) or (n-by-0). breaking Your code may be relying on broken implementations of diagcat and jtimes.
A bug was fixed related to 0^0 in MX.
breaking The fix may impact you if you used **(-1) (Python) or .^(-1) (Matlab) (element-wise power) on sparse matrices, e.g. for scaling matrices.
v = DM.rand(10,1)
print(diag(v)) # Sparse matrix with only diagonal entries
# Used to return a sparse matrix with diagonal entries inverted
# Now returns a dense matrix full of infs on the off-diagonals.
print(diag(v)**(-1))
# If you had this use case before, you can do the element-wise power on the vector progenitor:
print(diag(v**(-1)))
# Or use matrix-wise operations
print(inv(diag(v)))
print(mpower(diag(v),-1))
calc_lam_p and no_nlp_grad for nlpsol have now been made false and true respectively, eliminating that overhead.GlobalOptions's setCopyElisionMinSize.force_canonical true to revert to old behaviour.rfp = ca.Function('rfp', [X_unknown, X[0], U], [g], ['V0', 'X0', 'U'], ['V'])
ca.rootfinder('ifcn', 'kinsol', rfp) # output (V0[6],X0[2],U)->(V[6])
Should be adapted to:
# For the unknown, drop the trailing '0' from the label
# For the residual output, pick anything as long as there is no name collision
rfp = ca.Function('rfp', [X_unknown, X[0], U], [g], ['V', 'X0', 'U'], ['res'])
ca.rootfinder('ifcn', 'kinsol', rfp) # still outputs (V0[6],X0[2],U)->(V[6])
set_linear_scale syntax for decision variables, and a linear_scale argument to subject_to.show_infeasibilities is now easier to interpret when detect_simple_bounds is active.dump dump_in dump_out options now create directories when needed.find_package(casadi CONFIG REQUIRED)
add_executable(casadi_demo casadi_demo.cpp)
target_link_libraries(casadi_demo casadi::casadi)
The integrator class has been extended to support state events. This is a prototype implementation, currently only tested with Sundials/CVODES. First order analytic sensitivity calculations (but not yet other forms of sensitivity analysis) is possible for systems with events, including propagation of sensitivities through zero-crossing functions and events dynamics. The approach is compatible with when equations formulated in DaeBuilder (see above), but can also be used stand-alone. For details, see the implementation paper.
Windows Linux Mac classic (High Sierra or above) Mac M1
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-osx_arm64-matlab2018b.zip">R2023b</a> or later (Apple Silicon)<br/><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-osx64-matlab2018b.zip">R2018b</a> or later (Rosetta)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.7.0/casadi-3.7.0-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.7.0-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.A uniform sum operation is now exposed to the user, next to existing sum1/sum2. In Python, it behaves exactly like np.sum. In Matlab, it follows the conventions of the builtin Matlab sum. breaking If you have been doing from casadi import *, you'll find that sum no longer refers to the builtin Python sum. You may use import builtins;builtins.sum to access that variant.
You can now put Function calls (e.g. bsplines/lookup tables, Callbacks) into SX graphs. Consequently, you can more often perform expand on an MX graph (still it may not always be a good idea). You can force Functions to end up as SX call nodes with option never_inline true.
You can now make call SX Functions with MX in an inlining fashion, y setting always_inline true.
New functionality extract_parametric. The purpose of extract_parametric is ultimately to save on evaluation time of an expression, by extracting out the parts that are only solely dependent on parameters.
Here is an example of CasADi Function with a contraction of a 100-by-100 input in its graph, dependent only on parameters:
x = MX.sym('x');
p = MX.sym('p',100,100);
q = MX.sym('q');
expr = sin(x*sumsqr(p))*q;
f = Function('f',{x,p,q},{expr}) % f:(i0,i1[100x100],i2)->(o0) MXFunction
% Suppose we call this Function a lot of times with different values for x but equal values for p and q
% Recomputing sumsqr(p) every time would be a waste.
% Distill out the parts of the expression that only dependent on parameters p and q.
[expr_ret, symbols, parametric] = extract_parametric(expr, {p,q}, struct('extract_trivial', true));
% Construct now a hot function, called every time
f_compact = Function('f_compact',[{x} symbols],{expr_ret}) % f_compact:(i0,i1,i2)->(o0) MXFunction
% And a precompute that can be evaluated at initalization / outside a hot loop.
f_precompute = Function('f_precompute',{p,q},parametric) % f_precompute:(i0[100x100],i1)->(o0,o1) MXFunction
% Numerical check
rng(1)
x_num = rand(1);
p_num = rand(100,100);
q_num = rand(1);
[e_0, e_1] = f_precompute(p_num,q_num);
f_compact(x_num,e_0,e_1) % -0.116384
f(x_num,p_num,q_num) % -0.116384
separate_linear. The purpose is to separate out parts of an expression graph that are constant or linear. Note that the partitioning is done with a straightforward pass through the graph. There are no computer-algebra-system type of transformations performed to influence the partitioning.[expr_const,expr_lin,expr_nonlin] = separate_linear(cos(p)+7*x+x*y, [x,y], p)
expr_const: cos(p)
expr_lin: 7*x
expr_nonlin: x*y
Several bugfixes related to arguments shaped (0-by-n) or (n-by-0). breaking Your code may be relying on broken implementations of diagcat and jtimes.
A bug was fixed related to 0^0 in MX.
breaking The fix may impact you if you used **(-1) (Python) or .^(-1) (Matlab) (element-wise power) on sparse matrices, e.g. for scaling matrices.
v = DM.rand(10,1)
print(diag(v)) # Sparse matrix with only diagonal entries
# Used to return a sparse matrix with diagonal entries inverted
# Now returns a dense matrix full of infs on the off-diagonals.
print(diag(v)**(-1))
# If you had this use case before, you can do the element-wise power on the vector progenitor:
print(diag(v**(-1)))
# Or use matrix-wise operations
print(inv(diag(v)))
print(mpower(diag(v),-1))
calc_lam_p and no_nlp_grad for nlpsol have now been made false and true respectively, eliminating that overhead.GlobalOptions's setCopyElisionMinSize.force_canonical true to revert to old behaviour.rfp = ca.Function('rfp', [X_unknown, X[0], U], [g], ['V0', 'X0', 'U'], ['V'])
ca.rootfinder('ifcn', 'kinsol', rfp) # output (V0[6],X0[2],U)->(V[6])
Should be adapted to:
# For the unknown, drop the trailing '0' from the label
# For the residual output, pick anything as long as there is no name collision
rfp = ca.Function('rfp', [X_unknown, X[0], U], [g], ['V', 'X0', 'U'], ['res'])
ca.rootfinder('ifcn', 'kinsol', rfp) # still outputs (V0[6],X0[2],U)->(V[6])
set_linear_scale syntax for decision variables, and a linear_scale argument to subject_to.show_infeasibilities is now easier to interpret when detect_simple_bounds is active.dump dump_in dump_out options now create directories when needed.find_package(casadi CONFIG REQUIRED)
add_executable(casadi_demo casadi_demo.cpp)
target_link_libraries(casadi_demo casadi::casadi)
The integrator class has been extended to support state events. This is a prototype implementation, currently only tested with Sundials/CVODES. First order analytic sensitivity calculations (but not yet other forms of sensitivity analysis) is possible for systems with events, including propagation of sensitivities through zero-crossing functions and events dynamics. The approach is compatible with when equations formulated in DaeBuilder (see above), but can also be used stand-alone. For details, see the implementation paper.
breaking Changed API part for Jacobian sparsity (relevant for advanced use through external or Callback) `cpp bool has_jac_sparsity(casadi_int oind, c…
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-osx_arm64-matlab2018b.zip">R2023b</a> or later (Apple Silicon)<br/><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-osx64-matlab2018b.zip">R2018b</a> or later (Rosetta)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.7/casadi-3.6.7-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.6.7-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.hypot(x,y) = sqrt(x*x+y*y)log1p(x) = log(1+x)expm1(x) = exp(x-1)remainder with the semantics of the C operationfmin/fmax` is now symmetric:
jacobian(fmin(x,y),vertcat(x,y)) used to be [1 0] for x==y. Now yields [0.5 0.5].mmin/mmaxlogsumexp which behaves like log(sum(exp(x))) but is numerically more accurate (and no overflow issues).vertcat/vcat,horzcat/hcat, etc now return a DM type instead of a Sparsity type #2549mod has been renamed to rem, because its numerical behaviour is like the builtin-Matlab rem. The builtin-Matlab mod has no CasADi counterpart. CasADi-Python mod has been removed, because its numerical behaviour is not like numpy.mod. #2767. numpy.mod has no counterpart in CasADi; only fmod is equivalent.Before, CasADi internals would avoid introducing redundant nodes during operations on a given expression, but the user was responsible to avoid duplication when constructing that expression.
There is a function cse() that you may apply to expressions:
x = MX.sym('x')
# User responsibility
sx = sin(x)
y = sqrt(sx)+sx # MX(@1=sin(x), (sqrt(@1)+@1))
# cse
y = sqrt(sin(x))+sin(x) # MX((sqrt(sin(x))+sin(x)))
y = cse(y) # MX(@1=sin(x), (sqrt(@1)+@1))
There is a boolean option cse that may be used when constructing a Function:
x = MX.sym('x')
f = Function('f',[x],[sqrt(sin(x))+sin(x)],{"cse":True})
f.disp(True)
f:(i0)->(o0) MXFunction
Algorithm:
@0 = input[0][0]
@0 = sin(@0)
@1 = sqrt(@0)
@1 = (@1+@0)
output[0][0] = @1
The technique scales favorably for large graphs.
MX how has atomic support for solving upper and lower triangular linear systems without allocating any linear solver instance. The operation handles the case with unity diagonal separately for efficiency and supports C code generation. To use the feature, call casadi.solve(A, b) (Python or MATLAB/Octave)
# Python
import casadi
A = casadi.MX.sym('A', casadi.Sparsity.upper(2))
b = casadi.MX.sym('b', 2)
x = casadi.solve(A, b)
// C++
casadi::MX A = casadi::MX::sym("A", casadi::Sparsity::upper(2));
casadi::MX b = casadi::MX::sym("b", 2);
casadi::MX x = solve(A, b); // for argument-dependent lookup, alternatively casadi::MX::solve(A, b) for static function
Cf. #2688.
SX/MX Function construction with free variables (i.e. symbols used in the output expressions that are not declared as inputs) now fails immediately unless the allow_free option is used.SX/MX Function construction now fails if there are duplicates in input names or output names, unless the allow_duplicate_io_names option is used #2604.custom_jacobian semantics changed. The Function must now return individual blocks (Jacobian of an output w.r.t. to an input)external or Callback)bool has_jac_sparsity(casadi_int oind, casadi_int iind) const override;
Sparsity get_jac_sparsity(casadi_int oind, casadi_int iind, bool symmetric) const override;
Function.find_function Can be used to retrieve Functions in a hierarchy.dump_in option ) as nan instead of earlier 0. E.g. Ipopt nlp_grad_f has two outputs, f and grad_f_x. The f output is not used internally, so will be logged as nan.Function objects with an external call can now be codegenerated.mmin/mmax now support codegenerationnlpsol/Opti.solver can now take an option 'detect_simple_bounds' (default False) that will promote general constraints to simple bounds (lbx/ubx).libcplex<CPLEX_VERSION>, where CPLEX_VERSION is read from environmental variables. Same strategy for Gurobi.The Integrator class, which solves initial-value problems in ODEs and DAEs has been thoroughly refactored. Changes include:
integrator constructor. Unlike before, this support should now work in combination with forward/adjoint sensitivity analysis (to any order) and sparsity pattern calculations. Cf. #2823.u). The interface will keep track of changes to u and avoid integrating past such changes; for the Sundials (CVODES/IDAS) interfaces by setting a "stop time", for fixed step integrators by aligning the integration points with the grid points. Cf. #3025. Development versions of CasADi included support for this in a dedicated class, called Simulator, but this class has now been removed (breaking) and the functionality has been ported to the Integrator class.
If you had code looking like cs.integrator('sim_function', 'cvodes', dae, tgrid, opts), you may replace it by cs.integrator('sim_function', 'cvodes', dae, 0, tgrid[1:], opts).Function class for derivative calculations - this makes the class now more efficient for use with non-symbolic DAEs, including FMUs or other external models.t0, tf, output_t0 and grid have been deprecated and will result in a warning if used. Instead, the user can provide equivalent information via the integrator constructor, cf. previous point.backward states are no longer part of the DAE formulation. They are now derived from a user specified number of sensitivity equations (nadj). This is a slight restriction in the possible problem formulations, but on the other hand allows for a much better exploitation of adjoint sensitivity structure. The the backward states remain in the integrator class function inputs and outputs, but have now been renamed to align with their meaning; adj_xf means the adjoint seeds corresponding to xf (before they were called rx0), adj_p are the adjoint sensitivities corresponding to p (before called rqf and so on.scale_abstol has been added to the Sundials integrators. If this is set to true, nominal values for the differential state and algebraic variables will be passed on to the solver. Cf. #3046See "multipoint_simulation" in the example pack for a good starting point.
triu: to get the old behavior.d and local dependent variables w have been replaced by the single dependent variables v.octaveinterp version, such that the new binaries work with future releases of Octave that increment the octaveinterp ABI version number.casadi-cli. At the moment, functionality is very limited, just eval_dump, to evaluate Function that have been dumped to the disk (options dump,dump_in)-DWITH_IPOPT=ON -DWITH_BUILD_REQUIRED=ON-DWITH_CPLEX=ON -DWITH_MOCKUP_CPLEX=ONpip are now availablemaster branch has been renamed to main, and has different semantics: it will be the branch where new features are added regularly before they become an official release. Latest official release is available as latest branch.opti.set_domain(x,'integer')breaking Changed API part for Jacobian sparsity (relevant for advanced use through external or Callback) `cpp bool has_jac_sparsity(casadi_int oind, c…
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-osx64-matlab2018b.zip">R2020b</a> or later (normal Matlab)<br/><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-osx_arm64-matlab2018b.zip">R2018b</a> or later (<a href="https://nl.mathworks.com/support/apple-silicon-r2022b-beta.html">Open Beta/M1</a>)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.6.6-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.hypot(x,y) = sqrt(x*x+y*y)log1p(x) = log(1+x)expm1(x) = exp(x-1)remainder with the semantics of the C operationfmin/fmax` is now symmetric:
jacobian(fmin(x,y),vertcat(x,y)) used to be [1 0] for x==y. Now yields [0.5 0.5].mmin/mmaxlogsumexp which behaves like log(sum(exp(x))) but is numerically more accurate (and no overflow issues).vertcat/vcat,horzcat/hcat, etc now return a DM type instead of a Sparsity type #2549mod has been renamed to rem, because its numerical behaviour is like the builtin-Matlab rem. The builtin-Matlab mod has no CasADi counterpart. CasADi-Python mod has been removed, because its numerical behaviour is not like numpy.mod. #2767. numpy.mod has no counterpart in CasADi; only fmod is equivalent.Before, CasADi internals would avoid introducing redundant nodes during operations on a given expression, but the user was responsible to avoid duplication when constructing that expression.
There is a function cse() that you may apply to expressions:
x = MX.sym('x')
# User responsibility
sx = sin(x)
y = sqrt(sx)+sx # MX(@1=sin(x), (sqrt(@1)+@1))
# cse
y = sqrt(sin(x))+sin(x) # MX((sqrt(sin(x))+sin(x)))
y = cse(y) # MX(@1=sin(x), (sqrt(@1)+@1))
There is a boolean option cse that may be used when constructing a Function:
x = MX.sym('x')
f = Function('f',[x],[sqrt(sin(x))+sin(x)],{"cse":True})
f.disp(True)
f:(i0)->(o0) MXFunction
Algorithm:
@0 = input[0][0]
@0 = sin(@0)
@1 = sqrt(@0)
@1 = (@1+@0)
output[0][0] = @1
The technique scales favorably for large graphs.
MX how has atomic support for solving upper and lower triangular linear systems without allocating any linear solver instance. The operation handles the case with unity diagonal separately for efficiency and supports C code generation. To use the feature, call casadi.solve(A, b) (Python or MATLAB/Octave)
# Python
import casadi
A = casadi.MX.sym('A', casadi.Sparsity.upper(2))
b = casadi.MX.sym('b', 2)
x = casadi.solve(A, b)
// C++
casadi::MX A = casadi::MX::sym("A", casadi::Sparsity::upper(2));
casadi::MX b = casadi::MX::sym("b", 2);
casadi::MX x = solve(A, b); // for argument-dependent lookup, alternatively casadi::MX::solve(A, b) for static function
Cf. #2688.
SX/MX Function construction with free variables (i.e. symbols used in the output expressions that are not declared as inputs) now fails immediately unless the allow_free option is used.SX/MX Function construction now fails if there are duplicates in input names or output names, unless the allow_duplicate_io_names option is used #2604.custom_jacobian semantics changed. The Function must now return individual blocks (Jacobian of an output w.r.t. to an input)external or Callback)bool has_jac_sparsity(casadi_int oind, casadi_int iind) const override;
Sparsity get_jac_sparsity(casadi_int oind, casadi_int iind, bool symmetric) const override;
Function.find_function Can be used to retrieve Functions in a hierarchy.dump_in option ) as nan instead of earlier 0. E.g. Ipopt nlp_grad_f has two outputs, f and grad_f_x. The f output is not used internally, so will be logged as nan.Function objects with an external call can now be codegenerated.mmin/mmax now support codegenerationnlpsol/Opti.solver can now take an option 'detect_simple_bounds' (default False) that will promote general constraints to simple bounds (lbx/ubx).libcplex<CPLEX_VERSION>, where CPLEX_VERSION is read from environmental variables. Same strategy for Gurobi.The Integrator class, which solves initial-value problems in ODEs and DAEs has been thoroughly refactored. Changes include:
integrator constructor. Unlike before, this support should now work in combination with forward/adjoint sensitivity analysis (to any order) and sparsity pattern calculations. Cf. #2823.u). The interface will keep track of changes to u and avoid integrating past such changes; for the Sundials (CVODES/IDAS) interfaces by setting a "stop time", for fixed step integrators by aligning the integration points with the grid points. Cf. #3025. Development versions of CasADi included support for this in a dedicated class, called Simulator, but this class has now been removed (breaking) and the functionality has been ported to the Integrator class.
If you had code looking like cs.integrator('sim_function', 'cvodes', dae, tgrid, opts), you may replace it by cs.integrator('sim_function', 'cvodes', dae, 0, tgrid[1:], opts).Function class for derivative calculations - this makes the class now more efficient for use with non-symbolic DAEs, including FMUs or other external models.t0, tf, output_t0 and grid have been deprecated and will result in a warning if used. Instead, the user can provide equivalent information via the integrator constructor, cf. previous point.backward states are no longer part of the DAE formulation. They are now derived from a user specified number of sensitivity equations (nadj). This is a slight restriction in the possible problem formulations, but on the other hand allows for a much better exploitation of adjoint sensitivity structure. The the backward states remain in the integrator class function inputs and outputs, but have now been renamed to align with their meaning; adj_xf means the adjoint seeds corresponding to xf (before they were called rx0), adj_p are the adjoint sensitivities corresponding to p (before called rqf and so on.scale_abstol has been added to the Sundials integrators. If this is set to true, nominal values for the differential state and algebraic variables will be passed on to the solver. Cf. #3046See "multipoint_simulation" in the example pack for a good starting point.
triu: to get the old behavior.d and local dependent variables w have been replaced by the single dependent variables v.octaveinterp version, such that the new binaries work with future releases of Octave that increment the octaveinterp ABI version number.casadi-cli. At the moment, functionality is very limited, just eval_dump, to evaluate Function that have been dumped to the disk (options dump,dump_in)-DWITH_IPOPT=ON -DWITH_BUILD_REQUIRED=ON-DWITH_CPLEX=ON -DWITH_MOCKUP_CPLEX=ONpip are now availablemaster branch has been renamed to main, and has different semantics: it will be the branch where new features are added regularly before they become an official release. Latest official release is available as latest branch.opti.set_domain(x,'integer')breaking Changed API part for Jacobian sparsity (relevant for advanced use through external or Callback) `cpp bool has_jac_sparsity(casadi_int oind, c…
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-osx64-matlab2018b.zip">R2020b</a> or later (normal Matlab)<br/><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-osx_arm64-matlab2018b.zip">R2018b</a> or later (<a href="https://nl.mathworks.com/support/apple-silicon-r2022b-beta.html">Open Beta/M1</a>)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.5/casadi-3.6.5-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.6.5-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.hypot(x,y) = sqrt(x*x+y*y)log1p(x) = log(1+x)expm1(x) = exp(x-1)remainder with the semantics of the C operationfmin/fmax` is now symmetric:
jacobian(fmin(x,y),vertcat(x,y)) used to be [1 0] for x==y. Now yields [0.5 0.5].mmin/mmaxlogsumexp which behaves like log(sum(exp(x))) but is numerically more accurate (and no overflow issues).vertcat/vcat,horzcat/hcat, etc now return a DM type instead of a Sparsity type #2549mod has been renamed to rem, because its numerical behaviour is like the builtin-Matlab rem. The builtin-Matlab mod has no CasADi counterpart. CasADi-Python mod has been removed, because its numerical behaviour is not like numpy.mod. #2767. numpy.mod has no counterpart in CasADi; only fmod is equivalent.Before, CasADi internals would avoid introducing redundant nodes during operations on a given expression, but the user was responsible to avoid duplication when constructing that expression.
There is a function cse() that you may apply to expressions:
x = MX.sym('x')
# User responsibility
sx = sin(x)
y = sqrt(sx)+sx # MX(@1=sin(x), (sqrt(@1)+@1))
# cse
y = sqrt(sin(x))+sin(x) # MX((sqrt(sin(x))+sin(x)))
y = cse(y) # MX(@1=sin(x), (sqrt(@1)+@1))
There is a boolean option cse that may be used when constructing a Function:
x = MX.sym('x')
f = Function('f',[x],[sqrt(sin(x))+sin(x)],{"cse":True})
f.disp(True)
f:(i0)->(o0) MXFunction
Algorithm:
@0 = input[0][0]
@0 = sin(@0)
@1 = sqrt(@0)
@1 = (@1+@0)
output[0][0] = @1
The technique scales favorably for large graphs.
MX how has atomic support for solving upper and lower triangular linear systems without allocating any linear solver instance. The operation handles the case with unity diagonal separately for efficiency and supports C code generation. To use the feature, call casadi.solve(A, b) (Python or MATLAB/Octave)
# Python
import casadi
A = casadi.MX.sym('A', casadi.Sparsity.upper(2))
b = casadi.MX.sym('b', 2)
x = casadi.solve(A, b)
// C++
casadi::MX A = casadi::MX::sym("A", casadi::Sparsity::upper(2));
casadi::MX b = casadi::MX::sym("b", 2);
casadi::MX x = solve(A, b); // for argument-dependent lookup, alternatively casadi::MX::solve(A, b) for static function
Cf. #2688.
SX/MX Function construction with free variables (i.e. symbols used in the output expressions that are not declared as inputs) now fails immediately unless the allow_free option is used.SX/MX Function construction now fails if there are duplicates in input names or output names, unless the allow_duplicate_io_names option is used #2604.custom_jacobian semantics changed. The Function must now return individual blocks (Jacobian of an output w.r.t. to an input)external or Callback)bool has_jac_sparsity(casadi_int oind, casadi_int iind) const override;
Sparsity get_jac_sparsity(casadi_int oind, casadi_int iind, bool symmetric) const override;
Function.find_function Can be used to retrieve Functions in a hierarchy.dump_in option ) as nan instead of earlier 0. E.g. Ipopt nlp_grad_f has two outputs, f and grad_f_x. The f output is not used internally, so will be logged as nan.Function objects with an external call can now be codegenerated.mmin/mmax now support codegenerationnlpsol/Opti.solver can now take an option 'detect_simple_bounds' (default False) that will promote general constraints to simple bounds (lbx/ubx).libcplex<CPLEX_VERSION>, where CPLEX_VERSION is read from environmental variables. Same strategy for Gurobi.The Integrator class, which solves initial-value problems in ODEs and DAEs has been thoroughly refactored. Changes include:
integrator constructor. Unlike before, this support should now work in combination with forward/adjoint sensitivity analysis (to any order) and sparsity pattern calculations. Cf. #2823.u). The interface will keep track of changes to u and avoid integrating past such changes; for the Sundials (CVODES/IDAS) interfaces by setting a "stop time", for fixed step integrators by aligning the integration points with the grid points. Cf. #3025. Development versions of CasADi included support for this in a dedicated class, called Simulator, but this class has now been removed (breaking) and the functionality has been ported to the Integrator class.
If you had code looking like cs.integrator('sim_function', 'cvodes', dae, tgrid, opts), you may replace it by cs.integrator('sim_function', 'cvodes', dae, 0, tgrid[1:], opts).Function class for derivative calculations - this makes the class now more efficient for use with non-symbolic DAEs, including FMUs or other external models.t0, tf, output_t0 and grid have been deprecated and will result in a warning if used. Instead, the user can provide equivalent information via the integrator constructor, cf. previous point.backward states are no longer part of the DAE formulation. They are now derived from a user specified number of sensitivity equations (nadj). This is a slight restriction in the possible problem formulations, but on the other hand allows for a much better exploitation of adjoint sensitivity structure. The the backward states remain in the integrator class function inputs and outputs, but have now been renamed to align with their meaning; adj_xf means the adjoint seeds corresponding to xf (before they were called rx0), adj_p are the adjoint sensitivities corresponding to p (before called rqf and so on.scale_abstol has been added to the Sundials integrators. If this is set to true, nominal values for the differential state and algebraic variables will be passed on to the solver. Cf. #3046See "multipoint_simulation" in the example pack for a good starting point.
triu: to get the old behavior.d and local dependent variables w have been replaced by the single dependent variables v.octaveinterp version, such that the new binaries work with future releases of Octave that increment the octaveinterp ABI version number.casadi-cli. At the moment, functionality is very limited, just eval_dump, to evaluate Function that have been dumped to the disk (options dump,dump_in)-DWITH_IPOPT=ON -DWITH_BUILD_REQUIRED=ON-DWITH_CPLEX=ON -DWITH_MOCKUP_CPLEX=ONpip are now availablemaster branch has been renamed to main, and has different semantics: it will be the branch where new features are added regularly before they become an official release. Latest official release is available as latest branch.Nothing published for this version
breaking Changed API part for Jacobian sparsity (relevant for advanced use through external or Callback) `cpp bool has_jac_sparsity(casadi_int oind, c…
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-osx64-matlab2018b.zip">R2020b</a> or later (normal Matlab)<br/><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-osx_arm64-matlab2018b.zip">R2018b</a> or later (<a href="https://nl.mathworks.com/support/apple-silicon-r2022b-beta.html">Open Beta</a>)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.6.4-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.hypot(x,y) = sqrt(x*x+y*y)log1p(x) = log(1+x)expm1(x) = exp(x-1)remainder with the semantics of the C operationfmin/fmax` is now symmetric:
jacobian(fmin(x,y),vertcat(x,y)) used to be [1 0] for x==y. Now yields [0.5 0.5].mmin/mmaxlogsumexp which behaves like log(sum(exp(x))) but is numerically more accurate (and no overflow issues).vertcat/vcat,horzcat/hcat, etc now return a DM type instead of a Sparsity type #2549mod has been renamed to rem, because its numerical behaviour is like the builtin-Matlab rem. The builtin-Matlab mod has no CasADi counterpart. CasADi-Python mod has been removed, because its numerical behaviour is not like numpy.mod. #2767. numpy.mod has no counterpart in CasADi; only fmod is equivalent.Before, CasADi internals would avoid introducing redundant nodes during operations on a given expression, but the user was responsible to avoid duplication when constructing that expression.
There is a function cse() that you may apply to expressions:
x = MX.sym('x')
# User responsibility
sx = sin(x)
y = sqrt(sx)+sx # MX(@1=sin(x), (sqrt(@1)+@1))
# cse
y = sqrt(sin(x))+sin(x) # MX((sqrt(sin(x))+sin(x)))
y = cse(y) # MX(@1=sin(x), (sqrt(@1)+@1))
There is a boolean option cse that may be used when constructing a Function:
x = MX.sym('x')
f = Function('f',[x],[sqrt(sin(x))+sin(x)],{"cse":True})
f.disp(True)
f:(i0)->(o0) MXFunction
Algorithm:
@0 = input[0][0]
@0 = sin(@0)
@1 = sqrt(@0)
@1 = (@1+@0)
output[0][0] = @1
The technique scales favorably for large graphs.
MX how has atomic support for solving upper and lower triangular linear systems without allocating any linear solver instance. The operation handles the case with unity diagonal separately for efficiency and supports C code generation. To use the feature, call casadi.solve(A, b) (Python or MATLAB/Octave)
# Python
import casadi
A = casadi.MX.sym('A', casadi.Sparsity.upper(2))
b = casadi.MX.sym('b', 2)
x = casadi.solve(A, b)
// C++
casadi::MX A = casadi::MX::sym("A", casadi::Sparsity::upper(2));
casadi::MX b = casadi::MX::sym("b", 2);
casadi::MX x = solve(A, b); // for argument-dependent lookup, alternatively casadi::MX::solve(A, b) for static function
Cf. #2688.
SX/MX Function construction with free variables (i.e. symbols used in the output expressions that are not declared as inputs) now fails immediately unless the allow_free option is used.SX/MX Function construction now fails if there are duplicates in input names or output names, unless the allow_duplicate_io_names option is used #2604.custom_jacobian semantics changed. The Function must now return individual blocks (Jacobian of an output w.r.t. to an input)external or Callback)bool has_jac_sparsity(casadi_int oind, casadi_int iind) const override;
Sparsity get_jac_sparsity(casadi_int oind, casadi_int iind, bool symmetric) const override;
Function.find_function Can be used to retrieve Functions in a hierarchy.dump_in option ) as nan instead of earlier 0. E.g. Ipopt nlp_grad_f has two outputs, f and grad_f_x. The f output is not used internally, so will be logged as nan.Function objects with an external call can now be codegenerated.mmin/mmax now support codegenerationnlpsol/Opti.solver can now take an option 'detect_simple_bounds' (default False) that will promote general constraints to simple bounds (lbx/ubx).libcplex<CPLEX_VERSION>, where CPLEX_VERSION is read from environmental variables. Same strategy for Gurobi.The Integrator class, which solves initial-value problems in ODEs and DAEs has been thoroughly refactored. Changes include:
integrator constructor. Unlike before, this support should now work in combination with forward/adjoint sensitivity analysis (to any order) and sparsity pattern calculations. Cf. #2823.u). The interface will keep track of changes to u and avoid integrating past such changes; for the Sundials (CVODES/IDAS) interfaces by setting a "stop time", for fixed step integrators by aligning the integration points with the grid points. Cf. #3025. Development versions of CasADi included support for this in a dedicated class, called Simulator, but this class has now been removed (breaking) and the functionality has been ported to the Integrator class.
If you had code looking like cs.integrator('sim_function', 'cvodes', dae, tgrid, opts), you may replace it by cs.integrator('sim_function', 'cvodes', dae, 0, tgrid[1:], opts).Function class for derivative calculations - this makes the class now more efficient for use with non-symbolic DAEs, including FMUs or other external models.t0, tf, output_t0 and grid have been deprecated and will result in a warning if used. Instead, the user can provide equivalent information via the integrator constructor, cf. previous point.backward states are no longer part of the DAE formulation. They are now derived from a user specified number of sensitivity equations (nadj). This is a slight restriction in the possible problem formulations, but on the other hand allows for a much better exploitation of adjoint sensitivity structure. The the backward states remain in the integrator class function inputs and outputs, but have now been renamed to align with their meaning; adj_xf means the adjoint seeds corresponding to xf (before they were called rx0), adj_p are the adjoint sensitivities corresponding to p (before called rqf and so on.scale_abstol has been added to the Sundials integrators. If this is set to true, nominal values for the differential state and algebraic variables will be passed on to the solver. Cf. #3046See "multipoint_simulation" in the example pack for a good starting point.
triu: to get the old behavior.d and local dependent variables w have been replaced by the single dependent variables v.octaveinterp version, such that the new binaries work with future releases of Octave that increment the octaveinterp ABI version number.casadi-cli. At the moment, functionality is very limited, just eval_dump, to evaluate Function that have been dumped to the disk (options dump,dump_in)-DWITH_IPOPT=ON -DWITH_BUILD_REQUIRED=ON-DWITH_CPLEX=ON -DWITH_MOCKUP_CPLEX=ONpip are now availablemaster branch has been renamed to main, and has different semantics: it will be the branch where new features are added regularly before they become an official release. Latest official release is available as latest branch.breaking Changed API part for Jacobian sparsity (relevant for advanced use through external or Callback) `cpp bool has_jac_sparsity(casadi_int oind, c…
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-osx64-matlab2018b.zip">R2020b</a> or later (normal Matlab)<br/><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-osx_arm64-matlab2018b.zip">R2018b</a> or later (<a href="https://nl.mathworks.com/support/apple-silicon-r2022b-beta.html">Open Beta</a>)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.3/casadi-3.6.3-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.6.3-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.hypot(x,y) = sqrt(x*x+y*y)log1p(x) = log(1+x)expm1(x) = exp(x-1)remainder with the semantics of the C operationfmin/fmax` is now symmetric:
jacobian(fmin(x,y),vertcat(x,y)) used to be [1 0] for x==y. Now yields [0.5 0.5].mmin/mmaxlogsumexp which behaves like log(sum(exp(x))) but is numerically more accurate (and no overflow issues).vertcat/vcat,horzcat/hcat, etc now return a DM type instead of a Sparsity type #2549mod has been renamed to rem, because its numerical behaviour is like the builtin-Matlab rem. The builtin-Matlab mod has no CasADi counterpart. CasADi-Python mod has been removed, because its numerical behaviour is not like numpy.mod. #2767. numpy.mod has no counterpart in CasADi; only fmod is equivalent.Before, CasADi internals would avoid introducing redundant nodes during operations on a given expression, but the user was responsible to avoid duplication when constructing that expression.
There is a function cse() that you may apply to expressions:
x = MX.sym('x')
# User responsibility
sx = sin(x)
y = sqrt(sx)+sx # MX(@1=sin(x), (sqrt(@1)+@1))
# cse
y = sqrt(sin(x))+sin(x) # MX((sqrt(sin(x))+sin(x)))
y = cse(y) # MX(@1=sin(x), (sqrt(@1)+@1))
There is a boolean option cse that may be used when constructing a Function:
x = MX.sym('x')
f = Function('f',[x],[sqrt(sin(x))+sin(x)],{"cse":True})
f.disp(True)
f:(i0)->(o0) MXFunction
Algorithm:
@0 = input[0][0]
@0 = sin(@0)
@1 = sqrt(@0)
@1 = (@1+@0)
output[0][0] = @1
The technique scales favorably for large graphs.
MX how has atomic support for solving upper and lower triangular linear systems without allocating any linear solver instance. The operation handles the case with unity diagonal separately for efficiency and supports C code generation. To use the feature, call casadi.solve(A, b) (Python or MATLAB/Octave)
# Python
import casadi
A = casadi.MX.sym('A', casadi.Sparsity.upper(2))
b = casadi.MX.sym('b', 2)
x = casadi.solve(A, b)
// C++
casadi::MX A = casadi::MX::sym("A", casadi::Sparsity::upper(2));
casadi::MX b = casadi::MX::sym("b", 2);
casadi::MX x = solve(A, b); // for argument-dependent lookup, alternatively casadi::MX::solve(A, b) for static function
Cf. #2688.
SX/MX Function construction with free variables (i.e. symbols used in the output expressions that are not declared as inputs) now fails immediately unless the allow_free option is used.SX/MX Function construction now fails if there are duplicates in input names or output names, unless the allow_duplicate_io_names option is used #2604.custom_jacobian semantics changed. The Function must now return individual blocks (Jacobian of an output w.r.t. to an input)external or Callback)bool has_jac_sparsity(casadi_int oind, casadi_int iind) const override;
Sparsity get_jac_sparsity(casadi_int oind, casadi_int iind, bool symmetric) const override;
Function.find_function Can be used to retrieve Functions in a hierarchy.dump_in option ) as nan instead of earlier 0. E.g. Ipopt nlp_grad_f has two outputs, f and grad_f_x. The f output is not used internally, so will be logged as nan.Function objects with an external call can now be codegenerated.mmin/mmax now support codegenerationnlpsol/Opti.solver can now take an option 'detect_simple_bounds' (default False) that will promote general constraints to simple bounds (lbx/ubx).libcplex<CPLEX_VERSION>, where CPLEX_VERSION is read from environmental variables. Same strategy for Gurobi.The Integrator class, which solves initial-value problems in ODEs and DAEs has been thoroughly refactored. Changes include:
integrator constructor. Unlike before, this support should now work in combination with forward/adjoint sensitivity analysis (to any order) and sparsity pattern calculations. Cf. #2823.u). The interface will keep track of changes to u and avoid integrating past such changes; for the Sundials (CVODES/IDAS) interfaces by setting a "stop time", for fixed step integrators by aligning the integration points with the grid points. Cf. #3025. Development versions of CasADi included support for this in a dedicated class, called Simulator, but this class has now been removed (breaking) and the functionality has been ported to the Integrator class.
If you had code looking like cs.integrator('sim_function', 'cvodes', dae, tgrid, opts), you may replace it by cs.integrator('sim_function', 'cvodes', dae, 0, tgrid[1:], opts).Function class for derivative calculations - this makes the class now more efficient for use with non-symbolic DAEs, including FMUs or other external models.t0, tf, output_t0 and grid have been deprecated and will result in a warning if used. Instead, the user can provide equivalent information via the integrator constructor, cf. previous point.backward states are no longer part of the DAE formulation. They are now derived from a user specified number of sensitivity equations (nadj). This is a slight restriction in the possible problem formulations, but on the other hand allows for a much better exploitation of adjoint sensitivity structure. The the backward states remain in the integrator class function inputs and outputs, but have now been renamed to align with their meaning; adj_xf means the adjoint seeds corresponding to xf (before they were called rx0), adj_p are the adjoint sensitivities corresponding to p (before called rqf and so on.scale_abstol has been added to the Sundials integrators. If this is set to true, nominal values for the differential state and algebraic variables will be passed on to the solver. Cf. #3046See "multipoint_simulation" in the example pack for a good starting point.
triu: to get the old behavior.d and local dependent variables w have been replaced by the single dependent variables v.octaveinterp version, such that the new binaries work with future releases of Octave that increment the octaveinterp ABI version number.casadi-cli. At the moment, functionality is very limited, just eval_dump, to evaluate Function that have been dumped to the disk (options dump,dump_in)-DWITH_IPOPT=ON -DWITH_BUILD_REQUIRED=ON-DWITH_CPLEX=ON -DWITH_MOCKUP_CPLEX=ONpip are now availablemaster branch has been renamed to main, and has different semantics: it will be the branch where new features are added regularly before they become an official release. Latest official release is available as latest branch.breaking Changed API part for Jacobian sparsity (relevant for advanced use through external or Callback) `cpp bool has_jac_sparsity(casadi_int oind, c…
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-osx64-matlab2018b.zip">R2020b</a> or later (normal Matlab)<br/><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-osx_arm64-matlab2018b.zip">R2018b</a> or later (<a href="https://nl.mathworks.com/support/apple-silicon-r2022b-beta.html">Open Beta</>)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.2/casadi-3.6.2-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.6.2-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.hypot(x,y) = sqrt(x*x+y*y)log1p(x) = log(1+x)expm1(x) = exp(x-1)remainder with the semantics of the C operationfmin/fmax` is now symmetric:
jacobian(fmin(x,y),vertcat(x,y)) used to be [1 0] for x==y. Now yields [0.5 0.5].mmin/mmaxlogsumexp which behaves like log(sum(exp(x))) but is numerically more accurate (and no overflow issues).vertcat/vcat,horzcat/hcat, etc now return a DM type instead of a Sparsity type #2549mod has been renamed to rem, because its numerical behaviour is like the builtin-Matlab rem. The builtin-Matlab mod has no CasADi counterpart. CasADi-Python mod has been removed, because its numerical behaviour is not like numpy.mod. #2767. numpy.mod has no counterpart in CasADi; only fmod is equivalent.Before, CasADi internals would avoid introducing redundant nodes during operations on a given expression, but the user was responsible to avoid duplication when constructing that expression.
There is a function cse() that you may apply to expressions:
x = MX.sym('x')
# User responsibility
sx = sin(x)
y = sqrt(sx)+sx # MX(@1=sin(x), (sqrt(@1)+@1))
# cse
y = sqrt(sin(x))+sin(x) # MX((sqrt(sin(x))+sin(x)))
y = cse(y) # MX(@1=sin(x), (sqrt(@1)+@1))
There is a boolean option cse that may be used when constructing a Function:
x = MX.sym('x')
f = Function('f',[x],[sqrt(sin(x))+sin(x)],{"cse":True})
f.disp(True)
f:(i0)->(o0) MXFunction
Algorithm:
@0 = input[0][0]
@0 = sin(@0)
@1 = sqrt(@0)
@1 = (@1+@0)
output[0][0] = @1
The technique scales favorably for large graphs.
MX how has atomic support for solving upper and lower triangular linear systems without allocating any linear solver instance. The operation handles the case with unity diagonal separately for efficiency and supports C code generation. To use the feature, call casadi.solve(A, b) (Python or MATLAB/Octave)
# Python
import casadi
A = casadi.MX.sym('A', casadi.Sparsity.upper(2))
b = casadi.MX.sym('b', 2)
x = casadi.solve(A, b)
// C++
casadi::MX A = casadi::MX::sym("A", casadi::Sparsity::upper(2));
casadi::MX b = casadi::MX::sym("b", 2);
casadi::MX x = solve(A, b); // for argument-dependent lookup, alternatively casadi::MX::solve(A, b) for static function
Cf. #2688.
SX/MX Function construction with free variables (i.e. symbols used in the output expressions that are not declared as inputs) now fails immediately unless the allow_free option is used.SX/MX Function construction now fails if there are duplicates in input names or output names, unless the allow_duplicate_io_names option is used #2604.custom_jacobian semantics changed. The Function must now return individual blocks (Jacobian of an output w.r.t. to an input)external or Callback)bool has_jac_sparsity(casadi_int oind, casadi_int iind) const override;
Sparsity get_jac_sparsity(casadi_int oind, casadi_int iind, bool symmetric) const override;
Function.find_function Can be used to retrieve Functions in a hierarchy.dump_in option ) as nan instead of earlier 0. E.g. Ipopt nlp_grad_f has two outputs, f and grad_f_x. The f output is not used internally, so will be logged as nan.Function objects with an external call can now be codegenerated.mmin/mmax now support codegenerationnlpsol/Opti.solver can now take an option 'detect_simple_bounds' (default False) that will promote general constraints to simple bounds (lbx/ubx).libcplex<CPLEX_VERSION>, where CPLEX_VERSION is read from environmental variables. Same strategy for Gurobi.The Integrator class, which solves initial-value problems in ODEs and DAEs has been thoroughly refactored. Changes include:
integrator constructor. Unlike before, this support should now work in combination with forward/adjoint sensitivity analysis (to any order) and sparsity pattern calculations. Cf. #2823.u). The interface will keep track of changes to u and avoid integrating past such changes; for the Sundials (CVODES/IDAS) interfaces by setting a "stop time", for fixed step integrators by aligning the integration points with the grid points. Cf. #3025. Development versions of CasADi included support for this in a dedicated class, called Simulator, but this class has now been removed and the functionality has been ported to the Integrator class.Function class for derivative calculations - this makes the class now more efficient for use with non-symbolic DAEs, including FMUs or other external models.t0, tf, output_t0 and grid have been deprecated and will result in a warning if used. Instead, the user can provide equivalent information via the integrator constructor, cf. previous point.backward states are no longer part of the DAE formulation. They are now derived from a user specified number of sensitivity equations (nadj). This is a slight restriction in the possible problem formulations, but on the other hand allows for a much better exploitation of adjoint sensitivity structure. The the backward states remain in the integrator class function inputs and outputs, but have now been renamed to align with their meaning; adj_xf means the adjoint seeds corresponding to xf (before they were called rx0), adj_p are the adjoint sensitivities corresponding to p (before called rqf and so on.scale_abstol has been added to the Sundials integrators. If this is set to true, nominal values for the differential state and algebraic variables will be passed on to the solver. Cf. #3046See "multipoint_simulation" in the example pack for a good starting point.
triu: to get the old behavior.d and local dependent variables w have been replaced by the single dependent variables v.octaveinterp version, such that the new binaries work with future releases of Octave that increment the octaveinterp ABI version number.casadi-cli. At the moment, functionality is very limited, just eval_dump, to evaluate Function that have been dumped to the disk (options dump,dump_in)-DWITH_IPOPT=ON -DWITH_BUILD_REQUIRED=ON-DWITH_CPLEX=ON -DWITH_MOCKUP_CPLEX=ONpip are now availablemaster branch has been renamed to main, and has different semantics: it will be the branch where new features are added regularly before they become an official release. Latest official release is available as latest branch.breaking Changed API part for Jacobian sparsity (relevant for advanced use through external or Callback) `cpp bool has_jac_sparsity(casadi_int oind, c…
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-osx64-matlab2018b.zip">R2020b</a> or later (normal Matlab)<br/><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-osx_arm64-matlab2018b.zip">R2018b</a> or later (<a href="https://nl.mathworks.com/support/apple-silicon-r2022b-beta.html">Open Beta</>)</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.1/casadi-3.6.1-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.6.1-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.hypot(x,y) = sqrt(x*x+y*y)log1p(x) = log(1+x)expm1(x) = exp(x-1)remainder with the semantics of the C operationfmin/fmax` is now symmetric:
jacobian(fmin(x,y),vertcat(x,y)) used to be [1 0] for x==y. Now yields [0.5 0.5].mmin/mmaxlogsumexp which behaves like log(sum(exp(x))) but is numerically more accurate (and no overflow issues).vertcat/vcat,horzcat/hcat, etc now return a DM type instead of a Sparsity type #2549mod has been renamed to rem, because its numerical behaviour is like the builtin-Matlab rem. The builtin-Matlab mod has no CasADi counterpart. CasADi-Python mod has been removed, because its numerical behaviour is not like numpy.mod. #2767. numpy.mod has no counterpart in CasADi; only fmod is equivalent.Before, CasADi internals would avoid introducing redundant nodes during operations on a given expression, but the user was responsible to avoid duplication when constructing that expression.
There is a function cse() that you may apply to expressions:
x = MX.sym('x')
# User responsibility
sx = sin(x)
y = sqrt(sx)+sx # MX(@1=sin(x), (sqrt(@1)+@1))
# cse
y = sqrt(sin(x))+sin(x) # MX((sqrt(sin(x))+sin(x)))
y = cse(y) # MX(@1=sin(x), (sqrt(@1)+@1))
There is a boolean option cse that may be used when constructing a Function:
x = MX.sym('x')
f = Function('f',[x],[sqrt(sin(x))+sin(x)],{"cse":True})
f.disp(True)
f:(i0)->(o0) MXFunction
Algorithm:
@0 = input[0][0]
@0 = sin(@0)
@1 = sqrt(@0)
@1 = (@1+@0)
output[0][0] = @1
The technique scales favorably for large graphs.
MX how has atomic support for solving upper and lower triangular linear systems without allocating any linear solver instance. The operation handles the case with unity diagonal separately for efficiency and supports C code generation. To use the feature, call casadi.solve(A, b) (Python or MATLAB/Octave)
# Python
import casadi
A = casadi.MX.sym('A', casadi.Sparsity.upper(2))
b = casadi.MX.sym('b', 2)
x = casadi.solve(A, b)
// C++
casadi::MX A = casadi::MX::sym("A", casadi::Sparsity::upper(2));
casadi::MX b = casadi::MX::sym("b", 2);
casadi::MX x = solve(A, b); // for argument-dependent lookup, alternatively casadi::MX::solve(A, b) for static function
Cf. #2688.
SX/MX Function construction with free variables (i.e. symbols used in the output expressions that are not declared as inputs) now fails immediately unless the allow_free option is used.SX/MX Function construction now fails if there are duplicates in input names or output names, unless the allow_duplicate_io_names option is used #2604.custom_jacobian semantics changed. The Function must now return individual blocks (Jacobian of an output w.r.t. to an input)external or Callback)bool has_jac_sparsity(casadi_int oind, casadi_int iind) const override;
Sparsity get_jac_sparsity(casadi_int oind, casadi_int iind, bool symmetric) const override;
Function.find_function Can be used to retrieve Functions in a hierarchy.dump_in option ) as nan instead of earlier 0. E.g. Ipopt nlp_grad_f has two outputs, f and grad_f_x. The f output is not used internally, so will be logged as nan.Function objects with an external call can now be codegenerated.mmin/mmax now support codegenerationnlpsol/Opti.solver can now take an option 'detect_simple_bounds' (default False) that will promote general constraints to simple bounds (lbx/ubx).libcplex<CPLEX_VERSION>, where CPLEX_VERSION is read from environmental variables. Same strategy for Gurobi.The Integrator class, which solves initial-value problems in ODEs and DAEs has been thoroughly refactored. Changes include:
integrator constructor. Unlike before, this support should now work in combination with forward/adjoint sensitivity analysis (to any order) and sparsity pattern calculations. Cf. #2823.u). The interface will keep track of changes to u and avoid integrating past such changes; for the Sundials (CVODES/IDAS) interfaces by setting a "stop time", for fixed step integrators by aligning the integration points with the grid points. Cf. #3025. Development versions of CasADi included support for this in a dedicated class, called Simulator, but this class has now been removed and the functionality has been ported to the Integrator class.Function class for derivative calculations - this makes the class now more efficient for use with non-symbolic DAEs, including FMUs or other external models.t0, tf, output_t0 and grid have been deprecated and will result in a warning if used. Instead, the user can provide equivalent information via the integrator constructor, cf. previous point.backward states are no longer part of the DAE formulation. They are now derived from a user specified number of sensitivity equations (nadj). This is a slight restriction in the possible problem formulations, but on the other hand allows for a much better exploitation of adjoint sensitivity structure. The the backward states remain in the integrator class function inputs and outputs, but have now been renamed to align with their meaning; adj_xf means the adjoint seeds corresponding to xf (before they were called rx0), adj_p are the adjoint sensitivities corresponding to p (before called rqf and so on.scale_abstol has been added to the Sundials integrators. If this is set to true, nominal values for the differential state and algebraic variables will be passed on to the solver. Cf. #3046See "multipoint_simulation" in the example pack for a good starting point.
triu: to get the old behavior.d and local dependent variables w have been replaced by the single dependent variables v.octaveinterp version, such that the new binaries work with future releases of Octave that increment the octaveinterp ABI version number.casadi-cli. At the moment, functionality is very limited, just eval_dump, to evaluate Function that have been dumped to the disk (options dump,dump_in)-DWITH_IPOPT=ON -DWITH_BUILD_REQUIRED=ON-DWITH_CPLEX=ON -DWITH_MOCKUP_CPLEX=ONpip are now availablemaster branch has been renamed to main, and has different semantics: it will be the branch where new features are added regularly before they become an official release. Latest official release is available as latest branch.breaking Changed API part for Jacobian sparsity (relevant for advanced use through external or Callback) `cpp bool has_jac_sparsity(casadi_int oind, c…
Grab a binary from the table: <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac classic (High Sierra or above)</th><th>Mac M1</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.0/casadi-3.6.0-windows64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.0/casadi-3.6.0-linux64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.0/casadi-3.6.0-osx64-matlab2018b.zip">R2018b</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.0/casadi-3.6.0-osx_arm64-matlab2018b.zip">R2018b</a> or later</td> </tr> <tr> <th>Octave</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.0/casadi-3.6.0-windows64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.0/casadi-3.6.0-linux64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.0/casadi-3.6.0-osx64-octave7.3.0.zip">6.2.0</a> or later</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.6.0/casadi-3.6.0-osx_arm64-octave7.3.0.zip">6.2.0</a> or later</td> </tr> <tr> <th>Python</th> <td colspan="4"><code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
For Matlab/Octave, unzip in your home directory and adapt the path: <pre> <code> addpath('<yourpath>/casadi-3.6.0-windows64-matlab2018b') </code> </pre>
Check your installation: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.
LD_PRELOAD=<knitro_lin_path>/libiomp5.so.hypot(x,y) = sqrt(x*x+y*y)log1p(x) = log(1+x)expm1(x) = exp(x-1)remainder with the semantics of the C operationfmin/fmax` is now symmetric:
jacobian(fmin(x,y),vertcat(x,y)) used to be [1 0] for x==y. Now yields [0.5 0.5].mmin/mmaxlogsumexp which behaves like log(sum(exp(x))) but is numerically more accurate (and no overflow issues).vertcat/vcat,horzcat/hcat, etc now return a DM type instead of a Sparsity type #2549mod has been renamed to rem, because its numerical behaviour is like the builtin-Matlab rem. The builtin-Matlab mod has no CasADi counterpart. CasADi-Python mod has been removed, because its numerical behaviour is not like numpy.mod. #2767. numpy.mod has no counterpart in CasADi; only fmod is equivalent.Before, CasADi internals would avoid introducing redundant nodes during operations on a given expression, but the user was responsible to avoid duplication when constructing that expression.
There is a function cse() that you may apply to expressions:
x = MX.sym('x')
# User responsibility
sx = sin(x)
y = sqrt(sx)+sx # MX(@1=sin(x), (sqrt(@1)+@1))
# cse
y = sqrt(sin(x))+sin(x) # MX((sqrt(sin(x))+sin(x)))
y = cse(y) # MX(@1=sin(x), (sqrt(@1)+@1))
There is a boolean option cse that may be used when constructing a Function:
x = MX.sym('x')
f = Function('f',[x],[sqrt(sin(x))+sin(x)],{"cse":True})
f.disp(True)
f:(i0)->(o0) MXFunction
Algorithm:
@0 = input[0][0]
@0 = sin(@0)
@1 = sqrt(@0)
@1 = (@1+@0)
output[0][0] = @1
The technique scales favorably for large graphs.
MX how has atomic support for solving upper and lower triangular linear systems without allocating any linear solver instance. The operation handles the case with unity diagonal separately for efficiency and supports C code generation. To use the feature, call casadi.solve(A, b) (Python or MATLAB/Octave)
# Python
import casadi
A = casadi.MX.sym('A', casadi.Sparsity.upper(2))
b = casadi.MX.sym('b', 2)
x = casadi.solve(A, b)
// C++
casadi::MX A = casadi::MX::sym("A", casadi::Sparsity::upper(2));
casadi::MX b = casadi::MX::sym("b", 2);
casadi::MX x = solve(A, b); // for argument-dependent lookup, alternatively casadi::MX::solve(A, b) for static function
Cf. #2688.
SX/MX Function construction with free variables (i.e. symbols used in the output expressions that are not declared as inputs) now fails immediately unless the allow_free option is used.SX/MX Function construction now fails if there are duplicates in input names or output names, unless the allow_duplicate_io_names option is used #2604.custom_jacobian semantics changed. The Function must now return individual blocks (Jacobian of an output w.r.t. to an input)external or Callback)bool has_jac_sparsity(casadi_int oind, casadi_int iind) const override;
Sparsity get_jac_sparsity(casadi_int oind, casadi_int iind, bool symmetric) const override;
Function.find_function Can be used to retrieve Functions in a hierarchy.Function objects with an external call can now be codegenerated.mmin/mmax now support codegenerationnlpsol/Opti.solver can now take an option 'detect_simple_bounds' (default False) that will promote general constraints to simple bounds (lbx/ubx).libcplex<CPLEX_VERSION>, where CPLEX_VERSION is read from environmental variables. Same strategy for Gurobi.The Integrator class, which solves initial-value problems in ODEs and DAEs has been thoroughly refactored. Changes include:
integrator constructor. Unlike before, this support should now work in combination with forward/adjoint sensitivity analysis (to any order) and sparsity pattern calculations. Cf. #2823.u). The interface will keep track of changes to u and avoid integrating past such changes; for the Sundials (CVODES/IDAS) interfaces by setting a "stop time", for fixed step integrators by aligning the integration points with the grid points. Cf. #3025. Development versions of CasADi included support for this in a dedicated class, called Simulator, but this class has now been removed and the functionality has been ported to the Integrator class.Function class for derivative calculations - this makes the class now more efficient for use with non-symbolic DAEs, including FMUs or other external models.t0, tf, output_t0 and grid have been deprecated and will result in a warning if used. Instead, the user can provide equivalent information via the integrator constructor, cf. previous point.backward states are no longer part of the DAE formulation. They are now derived from a user specified number of sensitivity equations (nadj). This is a slight restriction in the possible problem formulations, but on the other hand allows for a much better exploitation of adjoint sensitivity structure. The the backward states remain in the integrator class function inputs and outputs, but have now been renamed to align with their meaning; adj_xf means the adjoint seeds corresponding to xf (before they were called rx0), adj_p are the adjoint sensitivities corresponding to p (before called rqf and so on.scale_abstol has been added to the Sundials integrators. If this is set to true, nominal values for the differential state and algebraic variables will be passed on to the solver. Cf. #3046See "multipoint_simulation" in the example pack for a good starting point.
triu: to get the old behavior.d and local dependent variables w have been replaced by the single dependent variables v.octaveinterp version, such that the new binaries work with future releases of Octave that increment the octaveinterp ABI version number.casadi-cli. At the moment, functionality is very limited, just eval_dump, to evaluate Function that have been dumped to the disk (options dump,dump_in)-DWITH_IPOPT=ON -DWITH_BUILD_REQUIRED=ON-DWITH_CPLEX=ON -DWITH_MOCKUP_CPLEX=ONpip are now availableNothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Grab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below): <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac (High Sierra or above)</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-matlabR2016a-v3.5.5.zip">R2016a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-matlabR2014b-v3.5.5.zip">R2014b</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-matlabR2014a-v3.5.5.zip">R2014a</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-matlabR2013a-v3.5.5.zip">R2013a</a> or R2013b</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-matlabR2014b-v3.5.5.tar.gz">R2014b</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-matlabR2014a-v3.5.5.tar.gz">R2014a</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-matlabR2015a-v3.5.5.tar.gz">R2015a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-matlabR2014b-v3.5.5.tar.gz">R2014b</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-matlabR2014a-v3.5.5.tar.gz">R2014a</a></td> </tr> <tr> <th>Octave</th> <td> 4.4.1 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-4.4.1-w32-v3.5.5.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-4.4.1-w64-v3.5.5.zip">64bit</a>), <br /> 4.4.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-4.4.0-w32-v3.5.5.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-4.4.0-w64-v3.5.5.zip">64bit</a>), <br /> 5.1.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-5.1.0-w32-v3.5.5.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-5.1.0-w64-v3.5.5.zip">64bit</a>), <br /> 5.2.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-5.2.0-w32-v3.5.5.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-5.2.0-w64-v3.5.5.zip">64bit</a>), <br /> 6.1.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-6.1.0-w32-v3.5.5.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-octave-6.1.0-w64-v3.5.5.zip">64bit</a>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-octave-4.4.1-v3.5.5.tar.gz">4.4.1</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-octave-5.1.0-v3.5.5.tar.gz">5.1.0</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-octave-5.2.0-v3.5.5.tar.gz">5.2.0</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-octave-6.1.0-v3.5.5.tar.gz">6.1.0</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-octave-5.2.0-v3.5.5.tar.gz">5.2.0</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-octave-6.1.0-v3.5.5.tar.gz">6.1.0</a>(Mojave or higher)</td> </tr> <tr> <th rowspan="2">Python</th> <td>Py27 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py27-v3.5.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py27-v3.5.5-64bit.zip">64bit</a><sup></sup>),<br /> Py35 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py35-v3.5.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py35-v3.5.5-64bit.zip">64bit</a><sup></sup>),<br /> Py36 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py36-v3.5.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py36-v3.5.5-64bit.zip">64bit</a><sup></sup>),<br /> Py37 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py37-v3.5.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py37-v3.5.5-64bit.zip">64bit</a><sup></sup>),<br /> Py38 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py38-v3.5.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py38-v3.5.5-64bit.zip">64bit</a><sup></sup>)<br /> Py39 (<a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py39-v3.5.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-windows-py39-v3.5.5-64bit.zip">64bit</a><sup></sup>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-py27-v3.5.5-64bit.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-py35-v3.5.5-64bit.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-py36-v3.5.5-64bit.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-py37-v3.5.5-64bit.tar.gz">Py37</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-py38-v3.5.5-64bit.tar.gz">Py38</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-linux-py39-v3.5.5-64bit.tar.gz">Py39</a></td> <td> <a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-py27-v3.5.5.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-py35-v3.5.5.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-py36-v3.5.5.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-py37-v3.5.5.tar.gz">Py37</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-py38-v3.5.5.tar.gz">Py38</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.5/casadi-osx-py39-v3.5.5.tar.gz">Py39</a></td> </tr> <tr> <td colspan="3">or just <code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
(<sup>*</sup>) 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: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> addpath('<yourpath>/casadi-matlabR2014a-v3.5.5') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from sys import path path.append(r"<yourpath>/casadi-py27-v3.5.5") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack.
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.
print_time, default true for QP and NLP solvers). Use record_time to make timings available through f.stats() without printing them.map with reduce arguments now has an efficient implementation (no copying/repmat)eval_bufferFunctionInternal::finalize no longer takes options dict.always_inline and never_inline were addedis_diff_in and is_diff_out were addedhas_jacobian_sparsity/get_jacobian_sparsityIM type is removed from public API (was used to represent integer sparse matrices). Use DM instead.linspace(0,1,3) and linspace(0.0,1,3) now both return [0 0.5 1] instead of [0 0 1] for the formerMX supports slicing with MX now (symbolic indexing).veccat of an empty list now returns 0-by-1 instead of 0-by-0.jtimes output dimensions have changed when any of the arguments is empty.0-by-1 in case of missing parameters.cosh derivativeconvexify was addedinterpolant, new constructors where added that takes dimensions instead of concrete vectorsinline option to true).a(:)=b now behaves like Matlab builtin matrices when a is a CasADi matrix. Before, only the first column of a would be touched by this statement. (#2363)MX constructor treated a numeric row vector as column vector. Now size(MX(ones(1,4))) returns (1,4) as expected. (#2366)DM,MX,SXOpti('conic')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
max_iter is more natural now: use solve_limited() to avoid exceptions to be raised when iterations or time runs out. No need to try/catch.external now looks for a .dylib file, not .so for macvoid* mem changed to int memalloc_mem, init_mem, free_mem have been purged. checkout and release replace them. int mem = checkout();
eval(arg, res, iw, w, mem);
release(mem);
mem.h regressionmain and mex-related functions c89-compliantbreaking: 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 default off
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_margin option was addedregularize (bool) option was removed. To get the effect of regularize=true, specify convexify_strategy='regularize'. Other strategies include clipping eigenvalues.CPLEX and Gurobi got support for sos constraints
Conic/qpsol interface extended for semidefinite programming and SOCP
Gurobi, SuperSCS, CPLEXbreaking: Newton Rootfinder now supports a line_search option (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
print_in/print_in print inputs/outputs when numerically evaluating a functiondump_in/dump_out dumps to the file systemdump dumps the function itself (loadable with Function.load)DM.from_file and DM.to_file with a MatrixMarket and txt supportmain=true: Function.generate_in/Function.nz_from_in/Function.nz_to_in to help creating input text files.Function.convert_in/Function.convert_out to switch between list and dictionary arguments/resultsVersions used in binaries ( see FAQ ):
<table> <tr><th>software</th><th>version</th> <th>library</th> <th>license env </th><th>build env </th></tr> <tr><td> IPOPT </td><td> 3.12.3 </td><td> shipped </td><td> /</td><td> / </td></tr> <tr><td> SNOPT </td><td> 7.7 </td><td> libsnopt7.so/snopt7.dll</td><td> SNOPT_LICENSE </td><td> SNOPT</td></tr> <tr><td> WORHP </td><td> 1.13</td><td> libworhp.so/worhp.dll </td><td> WORHP_LICENSE_FILE</td><td> WORHP</td></tr> <tr><td> KNITRO </td><td> 10.3 </td><td> libknitro1030.so/knitro1032.dll </td><td> / </td><td> KNITRO </td></tr> <tr><td> CPLEX </td><td> windows/mac: 12.8.0, linux:12.6.3 </td><td> libcplex1263.so / libcplex1280.dll </td><td> ILOG_LICENSE_FILE </td><td> CPLEX </td></tr> <tr><td> GUROBI </td><td> 6.5.0 </td><td> libgurobi65.so/gurobi65.dll </td><td> GRB_LICENSE_FILE </td><td> GUROBI_HOME</td></tr> </table>
Grab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below): <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac (High Sierra or above)</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-matlabR2016a-v3.5.4.zip">R2016a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-matlabR2014b-v3.5.4.zip">R2014b</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-matlabR2014a-v3.5.4.zip">R2014a</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-matlabR2013a-v3.5.4.zip">R2013a</a> or R2013b</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-matlabR2014b-v3.5.4.tar.gz">R2014b</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-matlabR2014a-v3.5.4.tar.gz">R2014a</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-matlabR2015a-v3.5.4.tar.gz">R2015a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-matlabR2014b-v3.5.4.tar.gz">R2014b</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-matlabR2014a-v3.5.4.tar.gz">R2014a</a></td> </tr> <tr> <th>Octave</th> <td> 4.4.1 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-octave-4.4.1-w32-v3.5.4.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-octave-4.4.1-w64-v3.5.4.zip">64bit</a>), <br /> 4.4.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-octave-4.4.0-w32-v3.5.4.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-octave-4.4.0-w64-v3.5.4.zip">64bit</a>), <br /> 5.1.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-octave-5.1.0-w32-v3.5.4.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-octave-5.1.0-w64-v3.5.4.zip">64bit</a>), <br /> 5.2.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-octave-5.2.0-w32-v3.5.4.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-octave-5.2.0-w64-v3.5.4.zip">64bit</a>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-octave-4.4.1-v3.5.4.tar.gz">4.4.1</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-octave-4.2.2-v3.5.4.tar.gz">4.2.2</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-octave-5.1.0-v3.5.4.tar.gz">5.1.0</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-octave-5.2.0-v3.5.4.tar.gz">5.2.0</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-octave-5.2.0-v3.5.4.tar.gz">5.2.0</a></td> </tr> <tr> <th rowspan="2">Python</th> <td>Py27 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py27-v3.5.4.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py27-v3.5.4-64bit.zip">64bit</a><sup></sup>),<br /> Py35 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py35-v3.5.4.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py35-v3.5.4-64bit.zip">64bit</a><sup></sup>),<br /> Py36 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py36-v3.5.4.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py36-v3.5.4-64bit.zip">64bit</a><sup></sup>),<br /> Py37 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py37-v3.5.4.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py37-v3.5.4-64bit.zip">64bit</a><sup></sup>),<br /> Py38 (<a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py38-v3.5.4.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-windows-py38-v3.5.4-64bit.zip">64bit</a><sup></sup>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-py27-v3.5.4-64bit.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-py35-v3.5.4-64bit.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-py36-v3.5.4-64bit.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-py37-v3.5.4-64bit.tar.gz">Py37</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-linux-py38-v3.5.4-64bit.tar.gz">Py38</a></td> <td> <a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-py27-v3.5.4.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-py35-v3.5.4.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-py36-v3.5.4.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-py37-v3.5.4.tar.gz">Py37</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.4/casadi-osx-py38-v3.5.4.tar.gz">Py38</a></td> </tr> <tr> <td colspan="3">or just <code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
(<sup>*</sup>) 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: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> addpath('<yourpath>/casadi-matlabR2014a-v3.5.4') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from sys import path path.append(r"<yourpath>/casadi-py27-v3.5.4") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack.
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.
print_time, default true for QP and NLP solvers). Use record_time to make timings available through f.stats() without printing them.map with reduce arguments now has an efficient implementation (no copying/repmat)eval_bufferFunctionInternal::finalize no longer takes options dict.always_inline and never_inline were addedis_diff_in and is_diff_out were addedhas_jacobian_sparsity/get_jacobian_sparsityIM type is removed from public API (was used to represent integer sparse matrices). Use DM instead.linspace(0,1,3) and linspace(0.0,1,3) now both return [0 0.5 1] instead of [0 0 1] for the formerMX supports slicing with MX now (symbolic indexing).veccat of an empty list now returns 0-by-1 instead of 0-by-0.jtimes output dimensions have changed when any of the arguments is empty.0-by-1 in case of missing parameters.cosh derivativeconvexify was addedinterpolant, new constructors where added that takes dimensions instead of concrete vectorsinline option to true).a(:)=b now behaves like Matlab builtin matrices when a is a CasADi matrix. Before, only the first column of a would be touched by this statement. (#2363)MX constructor treated a numeric row vector as column vector. Now size(MX(ones(1,4))) returns (1,4) as expected. (#2366)DM,MX,SXOpti('conic')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
max_iter is more natural now: use solve_limited() to avoid exceptions to be raised when iterations or time runs out. No need to try/catch.external now looks for a .dylib file, not .so for macvoid* mem changed to int memalloc_mem, init_mem, free_mem have been purged. checkout and release replace them. int mem = checkout();
eval(arg, res, iw, w, mem);
release(mem);
mem.h regressionmain and mex-related functions c89-compliantbreaking: 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 default off
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_margin option was addedregularize (bool) option was removed. To get the effect of regularize=true, specify convexify_strategy='regularize'. Other strategies include clipping eigenvalues.CPLEX and Gurobi got support for sos constraints
Conic/qpsol interface extended for semidefinite programming and SOCP
Gurobi, SuperSCS, CPLEXbreaking: Newton Rootfinder now supports a line_search option (default true)
Rootfinder now throws an exception by default ('error_on_fail' option true) when failing to converge
print_in/print_in print inputs/outputs when numerically evaluating a functiondump_in/dump_out dumps to the file systemdump dumps the function itself (loadable with Function.load)DM.from_file and DM.to_file with a MatrixMarket and txt supportmain=true: Function.generate_in/Function.nz_from_in/Function.nz_to_in to help creating input text files.Function.convert_in/Function.convert_out to switch between list and dictionary arguments/resultsGrab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below): <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-matlabR2016a-v3.5.3.zip">R2016a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-matlabR2014b-v3.5.3.zip">R2014b</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-matlabR2014a-v3.5.3.zip">R2014a</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-matlabR2013a-v3.5.3.zip">R2013a</a> or R2013b</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-matlabR2014b-v3.5.3.tar.gz">R2014b</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-matlabR2014a-v3.5.3.tar.gz">R2014a</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-matlabR2015a-v3.5.3.tar.gz">R2015a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-matlabR2014b-v3.5.3.tar.gz">R2014b</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-matlabR2014a-v3.5.3.tar.gz">R2014a</a></td> </tr> <tr> <th>Octave</th> <td> 4.4.1 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-octave-4.4.1-w32-v3.5.3.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-octave-4.4.1-w64-v3.5.3.zip">64bit</a>), <br /> 4.4.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-octave-4.4.0-w32-v3.5.3.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-octave-4.4.0-w64-v3.5.3.zip">64bit</a>), <br /> 5.1.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-octave-5.1.0-w32-v3.5.3.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-octave-5.1.0-w64-v3.5.3.zip">64bit</a>), <br /> 5.2.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-octave-5.2.0-w32-v3.5.3.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-octave-5.2.0-w64-v3.5.3.zip">64bit</a>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-octave-4.4.1-v3.5.3.tar.gz">4.4.1</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-octave-4.2.2-v3.5.3.tar.gz">4.2.2</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-octave-5.1.0-v3.5.3.tar.gz">5.1.0</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-octave-5.2.0-v3.5.3.tar.gz">5.2.0</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-octave-5.2.0-v3.5.3.tar.gz">5.2.0</a></td> </tr> <tr> <th rowspan="2">Python</th> <td>Py27 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py27-v3.5.3.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py27-v3.5.3-64bit.zip">64bit</a><sup></sup>),<br /> Py35 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py35-v3.5.3.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py35-v3.5.3-64bit.zip">64bit</a><sup></sup>),<br /> Py36 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py36-v3.5.3.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py36-v3.5.3-64bit.zip">64bit</a><sup></sup>),<br /> Py37 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py37-v3.5.3.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py37-v3.5.3-64bit.zip">64bit</a><sup></sup>),<br /> Py38 (<a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py38-v3.5.3.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-windows-py38-v3.5.3-64bit.zip">64bit</a><sup></sup>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-py27-v3.5.3-64bit.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-py35-v3.5.3-64bit.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-py36-v3.5.3-64bit.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-py37-v3.5.3-64bit.tar.gz">Py37</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-linux-py38-v3.5.3-64bit.tar.gz">Py38</a></td> <td> <a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-py27-v3.5.3.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-py35-v3.5.3.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-py36-v3.5.3.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-py37-v3.5.3.tar.gz">Py37</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.3/casadi-osx-py38-v3.5.3.tar.gz">Py38</a></td> </tr> <tr> <td colspan="3">or just <code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
(<sup>*</sup>) 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: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> addpath('<yourpath>/casadi-matlabR2014a-v3.5.3') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from sys import path path.append(r"<yourpath>/casadi-py27-v3.5.3") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack.
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.
print_time, default true for QP and NLP solvers). Use record_time to make timings available through f.stats() without printing them.map with reduce arguments now has an efficient implementation (no copying/repmat)eval_bufferFunctionInternal::finalize no longer takes options dict.always_inline and never_inline were addedis_diff_in and is_diff_out were addedhas_jacobian_sparsity/get_jacobian_sparsityIM type is removed from public API (was used to represent integer sparse matrices). Use DM instead.linspace(0,1,3) and linspace(0.0,1,3) now both return [0 0.5 1] instead of [0 0 1] for the formerMX supports slicing with MX now (symbolic indexing).veccat of an empty list now returns 0-by-1 instead of 0-by-0.jtimes output dimensions have changed when any of the arguments is empty.0-by-1 in case of missing parameters.cosh derivativeconvexify was addedinterpolant, new constructors where added that takes dimensions instead of concrete vectorsinline option to true).a(:)=b now behaves like Matlab builtin matrices when a is a CasADi matrix. Before, only the first column of a would be touched by this statement. (#2363)MX constructor treated a numeric row vector as column vector. Now size(MX(ones(1,4))) returns (1,4) as expected. (#2366)DM,MX,SXOpti('conic')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
max_iter is more natural now: use solve_limited() to avoid exceptions to be raised when iterations or time runs out. No need to try/catch.external now looks for a .dylib file, not .sovoid* mem changed to int memalloc_mem, init_mem, free_mem have been purged. checkout and release replace them. int mem = checkout();
eval(arg, res, iw, w, mem);
release(mem);
mem.h regressionmain and mex-related functions c89-compliantbreaking: 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 default off
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_margin option was addedregularize (bool) option was removed. To get the effect of regularize=true, specify convexify_strategy='regularize'. Other strategies include clipping eigenvalues.CPLEX and Gurobi got support for sos constraints
Conic/qpsol interface extended for semidefinite programming and SOCP
Gurobi, SuperSCS, CPLEXbreaking: Newton Rootfinder now supports a line_search option (default true)
Rootfinder now throws an exception by default ('error_on_fail' option true) when failing to converge
print_in/print_in print inputs/outputs when numerically evaluating a functiondump_in/dump_out dumps to the file systemdump dumps the function itself (loadable with Function.load)DM.from_file and DM.to_file with a MatrixMarket and txt supportmain=true: Function.generate_in/Function.nz_from_in/Function.nz_to_in to help creating input text files.Function.convert_in/Function.convert_out to switch between list and dictionary arguments/resultsGrab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below): <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-matlabR2016a-v3.5.2.zip">R2016a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-matlabR2014b-v3.5.2.zip">R2014b</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-matlabR2014a-v3.5.2.zip">R2014a</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-matlabR2013a-v3.5.2.zip">R2013a</a> or R2013b</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-matlabR2014b-v3.5.2.tar.gz">R2014b</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-matlabR2014a-v3.5.2.tar.gz">R2014a</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-matlabR2015a-v3.5.2.tar.gz">R2015a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-matlabR2014b-v3.5.2.tar.gz">R2014b</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-matlabR2014a-v3.5.2.tar.gz">R2014a</a></td> </tr> <tr> <th>Octave</th> <td> 4.4.1 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-octave-4.4.1-w32-v3.5.2.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-octave-4.4.1-w64-v3.5.2.zip">64bit</a>), <br /> 4.4.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-octave-4.4.0-w32-v3.5.2.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-octave-4.4.0-w64-v3.5.2.zip">64bit</a>), <br /> 5.1.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-octave-5.1.0-w32-v3.5.2.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-octave-5.1.0-w64-v3.5.2.zip">64bit</a>), <br /> 5.2.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-octave-5.2.0-w32-v3.5.2.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-octave-5.2.0-w64-v3.5.2.zip">64bit</a>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-octave-4.4.1-v3.5.2.tar.gz">4.4.1</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-octave-4.2.2-v3.5.2.tar.gz">4.2.2</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-octave-5.1.0-v3.5.2.tar.gz">5.1.0</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-octave-5.2.0-v3.5.2.tar.gz">5.2.0</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-octave-5.2.0-v3.5.2.tar.gz">5.2.0</a></td> </tr> <tr> <th rowspan="2">Python</th> <td>Py27 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py27-v3.5.2.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py27-v3.5.2-64bit.zip">64bit</a><sup></sup>),<br /> Py35 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py35-v3.5.2.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py35-v3.5.2-64bit.zip">64bit</a><sup></sup>),<br /> Py36 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py36-v3.5.2.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py36-v3.5.2-64bit.zip">64bit</a><sup></sup>),<br /> Py37 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py37-v3.5.2.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py37-v3.5.2-64bit.zip">64bit</a><sup></sup>),<br /> Py38 (<a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py38-v3.5.2.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-windows-py38-v3.5.2-64bit.zip">64bit</a><sup></sup>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-py27-v3.5.2-64bit.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-py35-v3.5.2-64bit.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-py36-v3.5.2-64bit.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-py37-v3.5.2-64bit.tar.gz">Py37</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-linux-py38-v3.5.2-64bit.tar.gz">Py38</a></td> <td> <a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-py27-v3.5.2.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-py35-v3.5.2.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-py36-v3.5.2.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-py37-v3.5.2.tar.gz">Py37</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.2/casadi-osx-py38-v3.5.2.tar.gz">Py38</a></td> </tr> <tr> <td colspan="3">or just <code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
(<sup>*</sup>) 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: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> addpath('<yourpath>/casadi-matlabR2014a-v3.5.2') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from sys import path path.append(r"<yourpath>/casadi-py27-v3.5.2") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack.
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.
print_time, default true for QP and NLP solvers). Use record_time to make timings available through f.stats() without printing them.map with reduce arguments now has an efficient implementation (no copying/repmat)eval_bufferFunctionInternal::finalize no longer takes options dict.always_inline and never_inline were addedis_diff_in and is_diff_out were addedhas_jacobian_sparsity/get_jacobian_sparsityIM type is removed from public API (was used to represent integer sparse matrices). Use DM instead.linspace(0,1,3) and linspace(0.0,1,3) now both return [0 0.5 1] instead of [0 0 1] for the formerMX supports slicing with MX now (symbolic indexing).veccat of an empty list now returns 0-by-1 instead of 0-by-0.jtimes output dimensions have changed when any of the arguments is empty.0-by-1 in case of missing parameters.cosh derivativeconvexify was addedinterpolant, new constructors where added that takes dimensions instead of concrete vectorsinline option to true).a(:)=b now behaves like Matlab builtin matrices when a is a CasADi matrix. Before, only the first column of a would be touched by this statement. (#2363)MX constructor treated a numeric row vector as column vector. Now size(MX(ones(1,4))) returns (1,4) as expected. (#2366)DM,MX,SXOpti('conic')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
max_iter is more natural now: use solve_limited() to avoid exceptions to be raised when iterations or time runs out. No need to try/catch.external now looks for a .dylib file, not .sovoid* mem changed to int memalloc_mem, init_mem, free_mem have been purged. checkout and release replace them. int mem = checkout();
eval(arg, res, iw, w, mem);
release(mem);
mem.h regressionmain and mex-related functions c89-compliantbreaking: 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 default off
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.2) AMPL was fixed to allow other solvers than IPOPT
breaking: SQP Method
regularize_margin option was addedregularize (bool) option was removed. To get the effect of regularize=true, specify convexify_strategy='regularize'. Other strategies include clipping eigenvalues.CPLEX and Gurobi got support for sos constraints
Conic/qpsol interface extended for semidefinite programming and SOCP
Gurobi, SuperSCS, CPLEXbreaking: Newton Rootfinder now supports a line_search option (default true)
Rootfinder now throws an exception by default ('error_on_fail' option true) when failing to converge
print_in/print_in print inputs/outputs when numerically evaluating a functiondump_in/dump_out dumps to the file systemdump dumps the function itself (loadable with Function.load)DM.from_file and DM.to_file with a MatrixMarket and txt supportmain=true: Function.generate_in/Function.nz_from_in/Function.nz_to_in to help creating input text files.Function.convert_in/Function.convert_out to switch between list and dictionary arguments/resultsNothing published for this version
Grab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below): <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-matlabR2016a-v3.5.1.zip">R2016a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-matlabR2014b-v3.5.1.zip">R2014b</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-matlabR2014a-v3.5.1.zip">R2014a</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-matlabR2013a-v3.5.1.zip">R2013a</a> or R2013b</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-matlabR2014b-v3.5.1.tar.gz">R2014b</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-matlabR2014a-v3.5.1.tar.gz">R2014a</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-osx-matlabR2015a-v3.5.1.tar.gz">R2015a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-osx-matlabR2014b-v3.5.1.tar.gz">R2014b</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-osx-matlabR2014a-v3.5.1.tar.gz">R2014a</a></td> </tr> <tr> <th>Octave</th> <td> 4.4.1 (<a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-octave-4.4.1-w32-v3.5.1.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-octave-4.4.1-w64-v3.5.1.zip">64bit</a>), <br /> 4.4.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-octave-4.4.0-w32-v3.5.1.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-octave-4.4.0-w64-v3.5.1.zip">64bit</a>), <br /> 5.1.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-octave-5.1.0-w32-v3.5.1.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-octave-5.1.0-w64-v3.5.1.zip">64bit</a>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-octave-4.4.1-v3.5.1.tar.gz">4.4.1</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-octave-4.2.2-v3.5.1.tar.gz">4.2.2</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-octave-5.1.0-v3.5.1.tar.gz">5.1.0</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-osx-octave-5.1.0-v3.5.1.tar.gz">5.1.0</a></td> </tr> <tr> <th rowspan="2">Python</th> <td>Py27 (<a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-py27-v3.5.1.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-py27-v3.5.1-64bit.zip">64bit</a><sup></sup>),<br /> Py35 (<a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-py35-v3.5.1.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-py35-v3.5.1-64bit.zip">64bit</a><sup></sup>),<br /> Py36 (<a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-py36-v3.5.1.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-py36-v3.5.1-64bit.zip">64bit</a><sup></sup>),<br /> Py37 (<a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-py37-v3.5.1.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-windows-py37-v3.5.1-64bit.zip">64bit</a><sup></sup>) </td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-py27-v3.5.1-64bit.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-py35-v3.5.1-64bit.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-py36-v3.5.1-64bit.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-linux-py37-v3.5.1-64bit.tar.gz">Py37</a></td> <td> <a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-osx-py27-v3.5.1.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-osx-py35-v3.5.1.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-osx-py36-v3.5.1.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.1/casadi-osx-py37-v3.5.1.tar.gz">Py37</a></td> </tr> <tr> <td colspan="3">or just <code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
(<sup>*</sup>) 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: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> addpath('<yourpath>/casadi-matlabR2014a-v3.5.1') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from sys import path path.append(r"<yourpath>/casadi-py27-v3.5.1") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack.
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.
print_time, default true for QP and NLP solvers). Use record_time to make timings available through f.stats() without printing them.map with reduce arguments now has an efficient implementation (no copying/repmat)eval_bufferFunctionInternal::finalize no longer takes options dict.always_inline and never_inline were addedis_diff_in and is_diff_out were addedIM type is removed from public API (was used to represent integer sparse matrices). Use DM instead.linspace(0,1,3) and linspace(0.0,1,3) now both return [0 0.5 1] instead of [0 0 1] for the formerMX supports slicing with MX now (symbolic indexing).veccat of an empty list now returns 0-by-1 instead of 0-by-0.jtimes output dimensions have changed when any of the arguments is empty.0-by-1 in case of missing parameters.interpolant, new constructors where added that takes dimensions instead of concrete vectorsinline option to true).a(:)=b now behaves like Matlab builtin matrices when a is a CasADi matrix. Before, only the first column of a would be touched by this statement. (#2363)MX constructor treated a numeric row vector as column vector. Now size(MX(ones(1,4))) returns (1,4) as expected. (#2366)DM,MX,SXOpti('conic')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
max_iter is more natural now: use solve_limited() to avoid exceptions to be raised when iterations or time runs out. No need to try/catch.external now looks for a .dylib file, not .sovoid* mem changed to int memalloc_mem, init_mem, free_mem have been purged. checkout and release replace them. int mem = checkout();
eval(arg, res, iw, w, mem);
release(mem);
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 default off
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
breaking: SQP Method
regularize_margin option was addedregularize (bool) option was removed. To get the effect of regularize=true, specify convexify_strategy='regularize'. Other strategies include clipping eigenvalues.CPLEX and Gurobi got support for sos constraints
Conic/qpsol interface extended for semidefinite programming and SOCP
Gurobi, SuperSCS, CPLEXbreaking: Newton Rootfinder now supports a line_search option (default true)
Rootfinder now throws an exception by default ('error_on_fail' option true) when failing to converge
print_in/print_in print inputs/outputs when numerically evaluating a functiondump_in/dump_out dumps to the file systemdump dumps the function itself (loadable with Function.load)DM.from_file and DM.to_file with a MatrixMarket and txt supportmain=true: Function.generate_in/Function.nz_from_in/Function.nz_to_in to help creating input text files.Function.convert_in/Function.convert_out to switch between list and dictionary arguments/resultsGrab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below): <table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-matlabR2016a-v3.5.0.zip">R2016a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-matlabR2014b-v3.5.0.zip">R2014b</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-matlabR2014a-v3.5.0.zip">R2014a</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-matlabR2013a-v3.5.0.zip">R2013a</a> or R2013b</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-matlabR2014b-v3.5.0.tar.gz">R2014b</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-matlabR2014a-v3.5.0.tar.gz">R2014a</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-osx-matlabR2015a-v3.5.0.tar.gz">R2015a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-osx-matlabR2014b-v3.5.0.tar.gz">R2014b</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-osx-matlabR2014a-v3.5.0.tar.gz">R2014a</a></td> </tr> <tr> <th>Octave</th> <td> 4.4.1 (<a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-octave-4.4.1-w32-v3.5.0.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-octave-4.4.1-w64-v3.5.0.zip">64bit</a>), <br /> 4.4.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-octave-4.4.0-w32-v3.5.0.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-octave-4.4.0-w64-v3.5.0.zip">64bit</a>), <br /> 5.1.0 (<a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-octave-5.1.0-w32-v3.5.0.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-octave-5.1.0-w64-v3.5.0.zip">64bit</a>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-octave-4.4.1-v3.5.0.tar.gz">4.4.1</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-octave-4.2.2-v3.5.0.tar.gz">4.2.2</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-octave-5.1.0-v3.5.0.tar.gz">5.1.0</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-osx-octave-5.1.0-v3.5.0.tar.gz">5.1.0</a></td> </tr> <tr> <th rowspan="2">Python</th> <td>Py27 (<a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-py27-v3.5.0.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-py27-v3.5.0-64bit.zip">64bit</a><sup></sup>),<br /> Py35 (<a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-py35-v3.5.0.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-py35-v3.5.0-64bit.zip">64bit</a><sup></sup>),<br /> Py36 (<a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-py36-v3.5.0.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-py36-v3.5.0-64bit.zip">64bit</a><sup></sup>),<br /> Py37 (<a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-py37-v3.5.0.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-windows-py37-v3.5.0-64bit.zip">64bit</a><sup></sup>) </td> <td><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-py27-v3.5.0-64bit.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-py35-v3.5.0-64bit.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-py36-v3.5.0-64bit.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-linux-py37-v3.5.0-64bit.tar.gz">Py37</a></td> <td> <a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-osx-py27-v3.5.0.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-osx-py35-v3.5.0.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-osx-py36-v3.5.0.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.5.0/casadi-osx-py37-v3.5.0.tar.gz">Py37</a></td> </tr> <tr> <td colspan="3">or just <code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
(<sup>*</sup>) 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: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> addpath('<yourpath>/casadi-matlabR2014a-v3.4.5') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from sys import path path.append(r"<yourpath>/casadi-py27-v3.4.5") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack.
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.
print_time, default true for QP and NLP solvers). Use record_time to make timings available through f.stats() without printing them.map with reduce arguments now has an efficient implementation (no copying/repmat)eval_bufferFunctionInternal::finalize no longer takes options dict.always_inline and never_inline were addedis_diff_in and is_diff_out were addedIM type is removed from public API (was used to represent integer sparse matrices). Use DM instead.linspace(0,1,3) and linspace(0.0,1,3) now both return [0 0.5 1] instead of [0 0 1] for the formerMX supports slicing with MX now (symbolic indexing).veccat of an empty list now returns 0-by-1 instead of 0-by-0.jtimes output dimensions have changed when any of the arguments is empty.0-by-1 in case of missing parameters.interpolant, new constructors where added that takes dimensions instead of concrete vectorsinline option to true).a(:)=b now behaves like Matlab builtin matrices when a is a CasADi matrix. Before, only the first column of a would be touched by this statement. (#2363)MX constructor treated a numeric row vector as column vector. Now size(MX(ones(1,4))) returns (1,4) as expected. (#2366)DM,MX,SXOpti('conic')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)
max_iter is more natural now: use solve_limited() to avoid exceptions to be raised when iterations or time runs out. No need to try/catch.external now looks for a .dylib file, not .sovoid* mem changed to int memalloc_mem, init_mem, free_mem have been purged. checkout and release replace them. int mem = checkout();
eval(arg, res, iw, w, mem);
release(mem);
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 default off
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
breaking: SQP Method
regularize_margin option was addedregularize (bool) option was removed. To get the effect of regularize=true, specify convexify_strategy='regularize'. Other strategies include clipping eigenvalues.CPLEX and Gurobi got support for sos constraints
Conic/qpsol interface extended for semidefinite programming and SOCP
Gurobi, SuperSCS, CPLEXbreaking: Newton Rootfinder now supports a line_search option (default true)
Rootfinder now throws an exception by default ('error_on_fail' option true) when failing to converge
print_in/print_in print inputs/outputs when numerically evaluating a functiondump_in/dump_out dumps to the file systemdump dumps the function itself (loadable with Function.load)DM.from_file and DM.to_file with a MatrixMarket and txt supportmain=true: Function.generate_in/Function.nz_from_in/Function.nz_to_in to help creating input text files.Function.convert_in/Function.convert_out to switch between list and dictionary arguments/resultsGrab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below):
<table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-matlabR2016a-v3.4.5.zip">R2016a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-matlabR2014b-v3.4.5.zip">R2014b</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-matlabR2014a-v3.4.5.zip">R2014a</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-matlabR2013a-v3.4.5.zip">R2013a</a> or R2013b</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-linux-matlabR2014b-v3.4.5.tar.gz">R2014b</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-linux-matlabR2014a-v3.4.5.tar.gz">R2014a</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-osx-matlabR2015a-v3.4.5.tar.gz">R2015a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-osx-matlabR2014b-v3.4.5.tar.gz">R2014b</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-osx-matlabR2014a-v3.4.5.tar.gz">R2014a</a></td> </tr> <tr> <th>Octave</th> <td> 4.4.1 (<a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-octave-4.4.1-w32-v3.4.5.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-octave-4.4.1-w64-v3.4.5.zip">64bit</a>), <br /> 4.4.0 (<a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-octave-4.4.0-w32-v3.4.5.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-octave-4.4.0-w64-v3.4.5.zip">64bit</a>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-linux-octave-4.4.1-v3.4.5.tar.gz">4.4.1</a>, <br/><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-linux-octave-v3.4.5.tar.gz">4.2.2</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-osx-octave-v3.4.5.tar.gz">4.4.0</a></td> </tr> <tr> <th rowspan="2">Python</th> <td>Py27 (<a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-py27-v3.4.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-py27-v3.4.5-64bit.zip">64bit</a><sup></sup>),<br /> Py35 (<a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-py35-v3.4.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-py35-v3.4.5-64bit.zip">64bit</a><sup></sup>),<br /> Py36 (<a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-py36-v3.4.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-py36-v3.4.5-64bit.zip">64bit</a><sup></sup>),<br /> Py37 (<a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-py37-v3.4.5.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-windows-py37-v3.4.5-64bit.zip">64bit</a><sup></sup>) </td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-linux-py27-v3.4.5-64bit.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-linux-py35-v3.4.5-64bit.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-linux-py36-v3.4.5-64bit.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-linux-py37-v3.4.5-64bit.tar.gz">Py37</a></td> <td> <a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-osx-py27-v3.4.5.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-osx-py35-v3.4.5.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-osx-py36-v3.4.5.tar.gz">Py36</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.5/casadi-osx-py37-v3.4.5.tar.gz">Py37</a></td> </tr> <tr> <td colspan="3">or just <code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
(<sup>*</sup>) 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: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> addpath('<yourpath>/casadi-matlabR2014a-v3.4.5') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from sys import path path.append(r"<yourpath>/casadi-py27-v3.4.5") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack.
Getting error "CasADi is not running from its package context." in Python? Check that you have casadi-py27-v3.4.5/casadi/casadi.py. If you have casadi-py27-v3.4.5/casadi.py instead, that's not good; add an extra casadi folder.
Got stuck while installing? You may also try out CasADi without installing, right in your browser (pick Python or Octave/Matlab).
CasADi 3.3 introduced support for two sparse direct linear solvers relying based on sparse direct QR factorization and sparse direct LDL factorization, respectively. In the release notes and in the code, it was not made clear enough that part of these routines could be considered derivative works of CSparse and LDL, respectively, both under copyright of Tim Davis. In the current release, routines derived from CSparse and LDL are clearly marked as such and to be considered derivative work under LGPL. All these routines reside inside the casadi::Sparsity class.
Since CasADi, CSparse and LDL all have the same open-source license (LGPL), this will not introduce any additional restrictions for users.
Since C code generated from CasADi is not LGPL (allowing CasADi users to use the generated code freely), all CSparse and LDL derived routines have been removed or replaced in CasADi's C runtime. This means that code generation for CasADi's 'qr' and 'ldl' is now possible without any additional license restrictions. A number of bugs have also been resolved.
CasADi 3.4 introduces differentiability for NLP solver instances in CasADi. Derivatives can be calculated efficiently with either forward or reverse mode algorithmic differentiation. We will detail this functionality in future publications, but in the meantime, feel free to reach out to Joel if you have questions about the functionality. The implementation is based on using derivative propagation rules to the implicit function theorem, applied to the nonlinear KKT system. It is part of the NLP solver base class and should in principle work with any NLP solver, although the factorization and solution of the KKT system (based on the sparse QR above) is likely to be a speed bottle neck in applications. The derivative calculations also depend on accurate Lagrange multipliers to be available, in particular with the correct signs for all multipliers. Functions for calculating parametric sensitivities for a particular system can be C code generated.
The parametric sensitivity analysis for NLP solvers, detailed above, is only as good as the multipliers you provide to it. Multipliers from an interior point method such as IPOPT are usually not accurate enough to be used for the parametric sensitivity analysis, which in particular relies on knowledge of the active set. For this reason, we have started work on a primal-dual active set method for quadratic programming. The method relies on the same factorization of the linearized KKT system as the parametric sensitivity analysis and will support C code generation. The solver is available as the "activeset" plugin in CasADi. The method is still work-in-progress and in particular performs poorly if the Hessian matrix is not strictly positive definite.
describe methods in Matlab now follows index-1 based convention.show_infeasibilities to help debugging infeasible problems.opti.lbg,opti.ubg2^31-1.
This limit has been raised to 2^63-1 by changing CasADi integer types to casadi_int (long long).
The change is hidden for Python/Octave/Matlab users, but C++ users may be affected.for-loop equivalents to the users guidesolver.stats() for nlpsol/conicevalf function to numerically evaluate an SX/MX matrix that does not depend on any symbolsdiff and cumsum (follows the Matlab convention)Release mode once again (as was always intended)-Werror for gcc-6 and gcc-7Grab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below):
<table> <tr><th></th><th>Windows</th><th>Linux</th><th>Mac</th></tr> <tr> <th>Matlab</th> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-matlabR2014b-v3.4.4.zip">R2014b</a> or later,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-matlabR2014a-v3.4.4.zip">R2014a</a>,<br /> <a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-matlabR2013a-v3.4.4.zip">R2013a</a> or R2013b</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-linux-matlabR2014b-v3.4.4.tar.gz">R2014b</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-linux-matlabR2014a-v3.4.4.tar.gz">R2014a</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-osx-matlabR2015a-v3.4.4.tar.gz">R2015a</a> or later,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-osx-matlabR2014b-v3.4.4.tar.gz">R2014b</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-osx-matlabR2014a-v3.4.4.tar.gz">R2014a</a></td> </tr> <tr> <th>Octave</th> <td> 4.2.2 (<a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-octave-4.2.2-w32-v3.4.4.zip">32bit</a> / <a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-octave-4.2.2-w64-v3.4.4.zip">64bit</a>)</td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-linux-octave-v3.4.4.tar.gz">4.2.2</a></td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-osx-octave-v3.4.4.tar.gz">4.4.0</a></td> </tr> <tr> <th rowspan="2">Python</th> <td>Py27 (<a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-py27-v3.4.4.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-py27-v3.4.4-64bit.zip">64bit</a><sup></sup>),<br /> Py35 (<a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-py35-v3.4.4.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-py35-v3.4.4-64bit.zip">64bit</a><sup></sup>),<br /> Py36 (<a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-py36-v3.4.4.zip">32bit</a><sup></sup> / <a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-windows-py36-v3.4.4-64bit.zip">64bit</a><sup></sup>) </td> <td><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-linux-py27-v3.4.4-64bit.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-linux-py35-v3.4.4-64bit.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-linux-py36-v3.4.4-64bit.tar.gz">Py36</a></td> <td> <a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-osx-py27-v3.4.4.tar.gz">Py27</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-osx-py35-v3.4.4.tar.gz">Py35</a>,<br /><a href="https://github.com/casadi/casadi/releases/download/3.4.4/casadi-osx-py36-v3.4.4.tar.gz">Py36</a></td> </tr> <tr> <td colspan="3">or just <code>pip install casadi</code> (needs <code>pip -V</code>>=8.1)</td> </tr> </table>
(<sup>*</sup>) 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: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> <code> addpath('<yourpath>/casadi-matlabR2014a-v3.4.4') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </code> </pre> </td><td>
<pre> <code> from sys import path path.append(r"<yourpath>/casadi-py27-v3.4.4") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </code> </pre> </td></tr> </table>
Get started with the example pack.
Getting error "CasADi is not running from its package context." in Python? Check that you have casadi-py27-v3.4.4/casadi/casadi.py. If you have casadi-py27-v3.4.4/casadi.py instead, that's not good; add an extra casadi folder.
Got stuck while installing? You may also try out CasADi without installing, right in your browser (pick Python or Octave/Matlab).
CasADi 3.3 introduced support for two sparse direct linear solvers relying based on sparse direct QR factorization and sparse direct LDL factorization, respectively. In the release notes and in the code, it was not made clear enough that part of these routines could be considered derivative works of CSparse and LDL, respectively, both under copyright of Tim Davis. In the current release, routines derived from CSparse and LDL are clearly marked as such and to be considered derivative work under LGPL. All these routines reside inside the casadi::Sparsity class.
Since CasADi, CSparse and LDL all have the same open-source license (LGPL), this will not introduce any additional restrictions for users.
Since C code generated from CasADi is not LGPL (allowing CasADi users to use the generated code freely), all CSparse and LDL derived routines have been removed or replaced in CasADi's C runtime. This means that code generation for CasADi's 'qr' and 'ldl' is now possible without any additional license restrictions. A number of bugs have also been resolved.
CasADi 3.4 introduces differentiability for NLP solver instances in CasADi. Derivatives can be calculated efficiently with either forward or reverse mode algorithmic differentiation. We will detail this functionality in future publications, but in the meantime, feel free to reach out to Joel if you have questions about the functionality. The implementation is based on using derivative propagation rules to the implicit function theorem, applied to the nonlinear KKT system. It is part of the NLP solver base class and should in principle work with any NLP solver, although the factorization and solution of the KKT system (based on the sparse QR above) is likely to be a speed bottle neck in applications. The derivative calculations also depend on accurate Lagrange multipliers to be available, in particular with the correct signs for all multipliers. Functions for calculating parametric sensitivities for a particular system can be C code generated.
The parametric sensitivity analysis for NLP solvers, detailed above, is only as good as the multipliers you provide to it. Multipliers from an interior point method such as IPOPT are usually not accurate enough to be used for the parametric sensitivity analysis, which in particular relies on knowledge of the active set. For this reason, we have started work on a primal-dual active set method for quadratic programming. The method relies on the same factorization of the linearized KKT system as the parametric sensitivity analysis and will support C code generation. The solver is available as the "activeset" plugin in CasADi. The method is still work-in-progress and in particular performs poorly if the Hessian matrix is not strictly positive definite.
describe methods in Matlab now follows index-1 based convention.show_infeasibilities to help debugging infeasible problems.opti.lbg,opti.ubg2^31-1.
This limit has been raised to 2^63-1 by changing CasADi integer types to casadi_int (long long).
The change is hidden for Python/Octave/Matlab users, but C++ users may be affected.for-loop equivalents to the users guidesolver.stats() for nlpsol/conicevalf function to numerically evaluate an SX/MX matrix that does not depend on any symbolsdiff and cumsum (follows the Matlab convention)Release mode once again (as was always intended)-Werror for gcc-6 and gcc-7Nothing published for this version
Octave bumped to 4.2.2. Worhp solver fixed. Docstrings are back for all casadi methods.
Octave bumped to 4.2.2.
Worhp solver fixed.
Docstrings are back for all casadi methods.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Grab a binary from the table (for MATLAB, use the newest compatible version below):
Grab a binary from the table (for MATLAB, use the newest compatible version below):
| Windows | Linux | Mac | |
|---|---|---|---|
| Matlab | R2014b or later,<br /> R2014a,<br /> R2013a or R2013b | R2014b or later,<br />R2014a | R2015a or later,<br />R2014b,<br />R2014a |
| Octave | 4.2.1 (32bit / 64bit) | 4.2.1 | 4.2.1 |
| Python | Py27 (32bit<sup>1,2</sup> / 64bit<sup>2</sup>),<br /> Py35 (32bit<sup>2</sup> / 64bit<sup>2</sup>),<br /> Py36 (32bit<sup>2</sup> / 64bit<sup>2</sup>) | Py27,<br />Py35,<br />Py36 | Py27,<br />Py35,<br />Py36 |
<sup>1</sup> Use this when you have Python(x,y). <sup>2</sup> Check your Python console if you need 32bit or 64bit - bitness should be printed at startup.
Or see the download page for more options.
Unzip in your home directory and adapt the path: <table> <tr><th>Matlab/Octave</th><th>Python</th><tr> <tr><td> <pre> addpath('.../casadi-matlabR2014a-v3.3.0') import casadi.* x = MX.sym('x') disp(jacobian(sin(x),x)) </pre> </td><td>
<pre> from sys import path path.append(r".../casadi-py27-v3.3.0") from casadi import * x = MX.sym("x") print(jacobian(sin(x),x)) </pre> </td></tr> </table>
New: install with pip install casadi
Get started with the example pack.
Getting error "CasADi is not running from its package context." in Python? Check that you have casadi-py27-v3.3.0/casadi/casadi.py. If you have casadi-py27-v3.3.0/casadi.py instead, that's not good; add an extra casadi folder.
CasADi is now able to calculate derivatives using finite differences approximations. To enable this feature, set the "enable_fd" option to true for a function object. If the function object has built-in derivative support, you can disable it by setting the options enable_forward, enable_reverse and enable_jacobian to false.
The default algorithm is a central difference scheme with automatic step-size selection based on estimates of truncation errors and roundoff errors. You can change this to a (cheaper, but less accurate) one-sided scheme by setting fd_method to forward or backward. There is also an experimental discontinuity avoiding scheme (suitable if the function is differentiated near nonsmooth points that can be enable by setting fd_method to smoothing.
Two sparse direct linear solvers have been added to CasADi's runtime core: One based on an up-looking QR factorization, calculated using Householder reflections, and one sparse direct LDL method (square-root free variant of Cholesky). These solvers are available for both SX and MX, for MX as the linear solver plugins "qr" and "ldl", for MX as the methods "SX::qr_sparse" and "SX::ldl". They also support for C code generation (with the exception of LDL in MX).
A speed bottleneck, related to the topological sorting of large MX graphs has been identified and resolved. The complexity of the sorting algorithms is now linear in all cases.
A\y and y'/A now work in Matlab/Octaveshell compiler now works on Windows, allowing to do jit using Visual Studioinstruction_* that work for SX/MX Functions. See accessing_mx_algorithm example to see how you can walk an MX graph.DM::rand creates a matrix with random numbers. DM::rng controls the seeding of the random number generator.manylinux.
CasADi should now run on CentOS 5.The default printout of Function instances is now shorter and consistent across different Function derived classes (SX/MX functions, NLP solvers, integrators, etc.). The new syntax is:
from casadi import *
x = SX.sym('x')
y = SX.sym('x',2)
f = Function('f', [x,y],[sin(x)+y], ['x', 'y'], ['r'])
print(f) # f:(x,y[2])->(r[2]) SXFunction
f.disp() # Equivalent syntax (MATLAB style)
f.disp(True) # Print algorithm
I.e. you get a list of inputs, with dimension if non-scalar, and a name of the internal class (here SXFunction).
You can also get the name as a string: str(f) or f.str(). If you want to print the algorithm, pass an optional argument "True", i.e. f.str(True) or f.disp(True).
The C API has seen continued improvements, in particular regarding the handling of external functions with memory allocation. See the user guide for the latest API.
inv() is now more efficient for large SX/DM matrices, and is evaluatable for MX (cparse by default).
The old variant is still available for SX/MX as inv_minor, and for MX as inv_node.csparse as opposed to symbolicqrvector<bool>, this gets mapped to a logical matrix. E.g. which_depends is affected by this change.sumsqr instead of sum_square.Linsol class has changed.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →