8000 Releases Β· casadi/casadi Β· GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Releases: casadi/casadi

nightly-ge9

17 Jun 12:20
Compare
Choose a tag to compare
nightly-ge9 Pre-release
Pre-release
automated commit by docs target [skip ci]

nightly-issue_4122

30 May 06:24
Compare
Choose a tag to compare
nightly-issue_4122 Pre-release
Pre-release
issue #4116: avoid backslashes in fmuResourceLocation

nightly-simulink

03 Apr 20:45
Compare
Choose a tag to compare
nightly-simulink Pre-release
Pre-release
issue #3624: generic pickling support

3.7.0

30 Mar 07:12
Compare
Choose a tag to compare

Install

Grab a binary from the table:

WindowsLinuxMac 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)

For Matlab/Octave, unzip in your home directory and adapt the path:


addpath('<yourpath>/casadi-3.7.0-windows64-matlab2018b')

Check your installation:

Matlab/OctavePython

import casadi.*
x = MX.sym('x')
disp(jacobian(sin(x),x))


from casadi import *
x = MX.sym("x")
print(jacobian(sin(x),x))

Get started with the example pack. Onboarding pointers have been gathered by the community at our wiki.

Troubleshooting

  • KNITRO on linux crashes with a segmentation fault without LD_PRELOAD=<knitro_lin_path>/libiomp5.so.
  • Callbacks with one argument are broken in Matlab CasADi

Release notes

Symbolic expressions

  • 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
  • New functionality 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))

AD

  • The ability to perform algorithmic differentiation on nlp solvers incurs some overhead and surprises for novice users, even when unused. breaking The default settings of calc_lam_p and no_nlp_grad for nlpsol have now been made false and true respectively, eliminating that overhead.

Code-generation

  • We now avoid copying over input arguments into a local workvector before acting upon them.
    This very relevant if you perform sublinear operations on large inputs (e.g. parametric lookup tables, #3962). Influenced by GlobalOptions's setCopyElisionMinSize.
  • Breaking Dense sparsity patterns in the input/output scheme of generated functions are now compactly represented. You can use option force_canonical true to revert to old behaviour.
  • Added a 'memory pool' feature #3812

Solvers/plugins

  • Important bugfixes to fatrop interface
  • breaking Rootfinder was refactored internally to use a different naming convention. When you use the expression-oriented interface, no changes are needed. If you use the Function-based interface, you will need changes. For example, a code that read:
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])

Opti Stack

  • New 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.

Function

  • breaking Serialization: Functions that include an Integrator, Rootfinder or FMU Function.
  • dump dump_in dump_out options now create directories when needed.

Thread safety

  • CasADi used to be thread-safe for numerical evaluation. Now it is thread-safe for symbolic manipulation too.

C++

  • breaking The casadi cmake target now has a namespace. The preferred way of configuring your cmake is:
find_package(casadi CONFIG REQUIRED)
 
add_executable(casadi_demo casadi_demo.cpp)
target_link_libraries(casadi_demo casadi::casadi)

Python

  • CasADi-Python interfaces now releases the GIL. This is a preparation for eventually post python 3.13 GIL free releases.

DaeBuilder / FMI interoperability

  • DaeBuilder can now accept the name of an fmu file, unzip it in a temporary folder and clean up that folder when it is no longer needed.
  • The DaeBuilder class has had a major revision, both in terms of syntax and in functionality. With the new release, the syntax stays much closer to FMI/Modelica. If you are using or planning to use this class, we recommend you to read the updated section on DaeBuilder in the user guide.
  • FMU import now supports FMI 3.0 (in addition to FMI 2.0). The FMU export, as before, only supports FMI 3.0. In addition, additional derivative information is handled by the interface including adjoints (FMI 3 only) and forward directional derivatives (which were previously only used to construct sparse Jacobians).
  • The interface to formulate DaeBuilder symbolically has been updated with the goal of eventually supporting the proposed Base Modelica standard in terms of functionality. We are currently not planning to distribute a Modelica parser with CasADi, but we are coordinating the Base Modelica effort with developers of the open-source [Rumoca](https://github.com/cognipilot...
Read more

nightly-rn4

26 Mar 21:34
Compare
Choose a tag to compare
nightly-rn4 Pre-release
Pre-release
Valgrind exceptions

nightly-issue_1879

08 Mar 20:48
Compare
Choose a tag to compare
nightly-issue_1879 Pre-release
Pre-release
automated commit by docs target [skip ci]

nightly-se8

19 Feb 22:33
Compare
Choose a tag to compare
nightly-se8 Pre-release
Pre-release
Merge branch 'main' into issue_4040

nightly-rn

12 Nov 09:34
Compare
Choose a tag to compare
nightly-rn Pre-release
Pre-release
deactivate broken compiler test (not a regression)

nightly-se3

07 Nov 22:19
Compare
Choose a tag to compare
nightly-se3 Pre-release
Pre-release
Make eval_mx usable from swig

nightly-gil_release

29 Oct 21:40
48ad82d
Compare
Choose a tag to compare
nightly-gil_release Pre-release
Pre-release
issue #3890: openblas compat with Visual Studio
0