This PR fixes a bug in the pycollo/solution/casadi_solution.py module in which phase final times tF were incorrectly extracted (extracted as phase initial times t0). This bug was only present in the CasADi backend and caused phase stretch scaling to be evaluated as 0 (due to t0 = tF), which in turn caused RuntimeWarnings to be raised due to divisions by 0. This then caused Pycollo to crash during a second mesh iteration due to a RuntimeError being raised as a result of attempting to index an array of variables out-of-bounds.
This PR also fixes a bug in the pycollo/solution/casadi_solution.py and pycollo/mesh_refinement.py modules in which the all_phase_mapping symbol mapping was incorrectly constructed for multiphase problems with variable numbers of discretisation nodes in their different phases. The creation of all_phase_mapping now ensures that only symbols associated with the relevant phase are included, and that phase-specified indices for decision variables are not exceeded.
This PR fixes a bug in the
pycollo/solution/casadi_solution.py
module in which phase final timestF
were incorrectly extracted (extracted as phase initial timest0
). This bug was only present in the CasADi backend and caused phase stretch scaling to be evaluated as0
(due tot0 = tF
), which in turn causedRuntimeWarning
s to be raised due to divisions by0
. This then caused Pycollo to crash during a second mesh iteration due to aRuntimeError
being raised as a result of attempting to index an array of variables out-of-bounds.This PR also fixes a bug in the
pycollo/solution/casadi_solution.py
andpycollo/mesh_refinement.py
modules in which theall_phase_mapping
symbol mapping was incorrectly constructed for multiphase problems with variable numbers of discretisation nodes in their different phases. The creation ofall_phase_mapping
now ensures that only symbols associated with the relevant phase are included, and that phase-specified indices for decision variables are not exceeded.