Skip to content

Change solver_output from 2-D to 1-D array

Tjerk Vreeken requested to merge solver-output-1D into master

Most arrays like lbg/ubg/x0 are already 1-D NumPy arrays if they are not a CasADi matrix (MX/DM). It therefore makes sense if the output of the solver is also a 1-D array, requiring only a single index to be specified to get an element (instead of X[i, 0]).

We ensure that the results dictionary does not present views onto the raw solver_output by making a full copy of it first. This is just a safeguard though, as it is undefined behavior what should happen if someone changes the arrays in the results like that.

Contrary to the previous type annotation, the solver output was already a numpy array (a 2-D one, see commit 40875b0a).

Closes #1064 (closed)

Merge request reports