Opened 4 years ago

Last modified 3 years ago

#4601 new task

Upgrade to CasADi 2.4

Reported by: toivo Owned by: toivo
Priority: major Milestone: 2.0.x
Component: CasADiInterface Version: trunk
Keywords: Cc:

Description

The external for CasADi is currently locked at around CasADi 2.1. Upgrade to the latest release CasADi 2.4. This will require

  • Updating interface definitions such as SWIG files
  • Updating with respect to api changes in CasADi

Change History (50)

comment:1 Changed 4 years ago by toivo

Create branch CasADiUpdate24 to start upgrading to CasADi 2.4 in r8069.

comment:2 Changed 4 years ago by toivo

Change external for CasADi to version 2.4.0 in r8071.

Also

  • Compile C++ code with -std=c++11; the new CasADi verstion requires this
  • Update some references to CasADi files that have changed names
  • Add some missed "" in CMake files
  • Add numpy to include path for swig wrappers

comment:3 Changed 4 years ago by toivo

Update Java interface to CasADi in r8072:

  • Extend MX with a number of member functions that became inaccessible since we are not using casadi.i for the Java inteface
  • Add function subst to access CasADi's substitute function - calling it substitute seemed to result in some kind of collision
  • Add a rename for the call operator
  • Update Java code to match
  • Add #define WITH_DEPRECATED_FEATURES to be able to use older CasADi features for now
  • Fix renamed macro CASADI_EXPORT
  • Include casadi_types.hpp since it contains macro definitions that are needed
  • Remove some unnecessary includes

comment:4 Changed 4 years ago by toivo

Update CasADiInterface C++ code and swig wrappers in r8073:

  • Remove casadi:: on a number of CasADi functions that now use Argument Dependent name Lookup
  • Create wrappers for CasADi's substitute to use in classes that already have a substitute method
  • Update to api changes in CasADi:
    • New casing of isempty
    • f(args...) instead of f.call(args)
    • isEqual is no longer a member function
  • Add #define WITH_DEPRECATED_FEATURES for now
  • Use #ifdef __linux__ instead of #ifdef linux; more portable
  • Swig files:
    • Add some workarounds for pulling in numpy
    • Update due to changed CasADi file names
    • Use new names for numpy api constants
    • Fix some places where PyArrayObject * should be used instead of PyObject *
    • Add typecasts when converting from size_t to npy_intp (only difference is signedness)

comment:5 Changed 4 years ago by toivo

Update python files to use CasADi 2.4 in r8074:

  • x.getValue() -> float(x)
    • Also use float instead of .toScalar and .elem(0)
  • Use string names for inputs and outputs of NlpSolver instead of symbolic constants
  • Use e.g. "t_mainloop.proc" instead "t_mainloop" for names of solver statistics
    • There's now both processor and wall time measurements for each statistic; go with processor time for now
  • Change output to getOutput
  • Don't use DMatrix in polynomial.py; the reshape behavior of these no longer seems to match numpy
  • isEqual was changed from member function to separate function
  • Use workaround equality predicate MX_equal instead of isEqual in more places in test_casadiinterface_unittests.py
  • Update the expected answer in one transfer test (more updates will be needed)

comment:6 Changed 4 years ago by toivo

Milestone: 1.17.x

comment:7 Changed 4 years ago by toivo

Update to new style MXFunction constructor in FExpToCasADi.jrag in r8094.

comment:8 Changed 4 years ago by toivo

Update CasADiInterface transfer tests in r8095:

  • Add function check_strnorm to compare a string result with an expected one
    • If the results don't match
      • Make it throw an AssertionError (so that the test fails)
      • Include the expected and obtained results in the message
    • Use it for all string comparisons
  • Update the expected results for a number of tests:
    • Printing of function headers has changed
    • Reused results are now precomputed
    • Sometimes there's an extra [0] on an expression (why?)
    • A few redundant computations have disappeared

comment:9 Changed 4 years ago by toivo

Fix the last CasADiInterface transfer tests in r8097:

  • Update a number of expected results
  • Change how logic_and is called

comment:10 Changed 4 years ago by toivo

Don't wrap CasADi´s GenericType in the Java wrapper used by CasADiInterface since it's not used anymore, in r8101.

comment:11 Changed 4 years ago by toivo

Fix CasADi code generation to work with CasADi 2.4.0, in r8102:
Don't add suffixes .so/.dll when calling CasADi, and not prefix ./ either.
Also change names of generated functions to make it less likely to overwrite existing files.

comment:12 Changed 4 years ago by toivo

Work around test failures caused by calling Model.set in CasADiInterface with empty Python lists, in r8110:

The problem is caused by the fact that CasADi defines type maps for std::vector<double>, which have a bug in them that cause empty Python lists not to be recognized as convertible to std::vector<double>.

  • Convert the troublesome arguments to numpy arrays in Python, which don't trigger this problem.
  • Remove type maps for std::vector<double> and std::vector<string> to make use of CasADi's type maps instead.

comment:13 Changed 4 years ago by toivo

Use own type maps for std::vector<double> and std::vector<string> in CasADiInteface, instead of using CasADi's, in r8115:

  • Move casadi.i (and exception.i) before inclusion of vectors.i
  • Clear type maps for std::vector<double> and std::vector<string>, then
  • Include vectors.i (again)
  • Get rid of some repeated includes in ModelicaCasADi.i
  • Improve type maps in Ref.i and vectors.i:
    • Don't accept strings as convertible to vectors, even though they are iterable in python
    • Fix mismatched return type in out typemap in vectors.i

comment:14 Changed 4 years ago by toivo

Revert changes in realtimecontrol.py from r8110, since the workaround shouln't be needed anymore, in r8116.

comment:15 Changed 4 years ago by toivo

Merge trunk into branch CasADiUpdate24 in r8117.

comment:16 Changed 4 years ago by toivo

Merge branch CasADiUpdate24 into trunk in r8118.

comment:17 Changed 4 years ago by toivo

Revert r8118 since it caused build problems, in r8119.

comment:18 Changed 4 years ago by toivo

Change external for CasADi to version 2.4.0 with a windows related patch, on CasADiUpdate24 branch, in r8141.

comment:19 Changed 4 years ago by toivo

Merge trunk into CasADiUpdate24 branch in r8173.

comment:20 Changed 4 years ago by toivo

Milestone: 1.17.x1.18.x

comment:21 Changed 4 years ago by toivo

Merge trunk into CasADiUpdate24 branch in r8197.

comment:22 Changed 4 years ago by toivo

Make the CasADiUpdate24 branch build under JM-SDK 1.11 (with swig updated to 3.0.7), in r8220:

  • Change gcc compiler option from -std=c++11 to -std=gnu++11, since the former was excluding some functionality used in JCCEnv.cpp.
  • Put #include <cmath> at the beginning of the swig wrapper for CasADiInterface, to avoid strange problem with hypot. (Interaction with Python.h?)
  • Add a define for NPY_ARRAY_IN_ARRAY if we are using a numpy version that is too old to define the new name.

comment:23 Changed 4 years ago by toivo

Merge trunk into CasADiUpdate24 branch in r8421.

comment:24 Changed 4 years ago by toivo

Update the grey box code to work with CasADi 2.4.0 in r8423.

comment:25 Changed 4 years ago by toivo

Merge r8426 into CasADiUpdate24 branch in r8427, since it's needed to make tests pass on the branch.

comment:26 Changed 4 years ago by toivo

Change code generation for CasADi optimization on the CasADiUpdate24 branch to always use a .so extension, since CasADi 2.4 seems to expect that, in r8428.
Also decrease the amount of memory allocated for the JVM heap to reduce the risk of out of memory errors when starting the JVM.

comment:27 Changed 4 years ago by toivo

Add some comments about tests that are expected to change in CasADi 3.0 due to https://github.com/casadi/casadi/issues/1618, in r8437.

comment:28 Changed 4 years ago by Christian Andersson

changeset:8962

Merged trunk into the casadi update branch. Related to ticket:4601

comment:29 Changed 3 years ago by Christian Andersson

changeset:8981

Updated the casadi branch with the latest changes from trunk. Related to ticket:4601

comment:30 Changed 3 years ago by Christian Andersson

changeset:8985

Updated collocation code to work with Casadi 2.4.3. Related to ticket:4601

comment:31 Changed 3 years ago by Christian Andersson

changeset:9013

Updated the casadi branch with the latests trunk changes. Related to ticket:4601

comment:32 Changed 3 years ago by Christian Andersson

changeset:9019

Fixed tests in the casadi 2.4 branch. Related to ticket:4601

comment:33 Changed 3 years ago by Christian Andersson

changeset:9022

Updated the casadi branch. Related to ticket:4601

comment:34 Changed 3 years ago by Christian Andersson

changeset:9023

Fixed a failing test in the casadi branch. Related to ticket:4601

comment:35 Changed 3 years ago by Christian Andersson

changeset:9088

Updated Casadi version to 2.4.5 in the update branch. Related to ticket:4601

comment:36 Changed 3 years ago by Christian Andersson

changeset:9095

Updated casadi branch with the latest trunk changes. Related to ticket:4601

comment:37 Changed 3 years ago by Christian Andersson

changeset:9160

Updated the casadi branch. Related to ticket:4601

comment:38 Changed 3 years ago by Fredrik Magnusson

[9189]

Merged trunk to branch. In particular includes changes in #5113.

Last edited 3 years ago by Fredrik Magnusson (previous) (diff)

comment:39 Changed 3 years ago by Fredrik Magnusson

[9381]

Reverted bad merge in [9189].

comment:40 Changed 3 years ago by Christian Andersson

changeset:9382

Merged latest changes from trunk into the casadi branch. Related to ticket:4601

comment:41 Changed 3 years ago by Fredrik Magnusson

[9385]

Reverted bad merge in [9382].

comment:42 Changed 3 years ago by Fredrik Magnusson

[9388]

Merged trunk up to [9295] to branch.

comment:43 Changed 3 years ago by Fredrik Magnusson

[9389]

Updated CasADi version in CasADi branch.

comment:44 Changed 3 years ago by Christian Andersson

changeset:9416

Updated the casadi branch to the latest trunk (except revision r9296). Related to ticket:4601

comment:45 Changed 3 years ago by Christian Andersson

changeset:9418

Merged r9296 to casadi branch. Related to ticket:4601

comment:46 Changed 3 years ago by Fredrik Magnusson

[9420]

Fixed elimination tests in CasADi branch.

comment:47 Changed 3 years ago by Fredrik Magnusson

[9425]

Merged trunk to CasADi branch.

comment:48 Changed 3 years ago by Fredrik Magnusson

[9491]

Worked around CasADi simplification deficiencies and adapted the use of simplify to 2.4 syntax in the CasADi 2.4 branch.

comment:49 Changed 3 years ago by Fredrik Magnusson

[9493]

Missed a few spots in [9491].

comment:50 Changed 3 years ago by Fredrik Magnusson

See #5239, which was developed in this branch.

Note: See TracTickets for help on using tickets.