Skip to content

CollInt: Fix RuntimeError for underspecified CasADi Function

Tjerk Vreeken requested to merge issue-1096 into master

Regression introduced in cab3c6ac. When expanding a CasADi function, one needs to be sure that all variables in the output are listed as inputs. For CasADi 3.4.5, not doing this would result in random other input symbols being used for the missing ones. For CasADi 3.5+ (not yet released at time of this commit), a RuntimeError is raised.

As we do not want to calculate the affinity of the DAE w.r.t. the parameters and constant inputs, we get rid of them before checking. Before commit cab3c6ac, the values with which they were substituted was effectively 0.0. Now, we use random values between 0 and 1 for a slightly better check.

Note that the affinity check has always been imperfect, and still is (even with the random values). It is likely the check will be deprecated in the future, to be replaced with an optional (default off) check on the entire optimization problem.

Closes #1096 (closed)

Merge request reports