Skip to content

Commit

Permalink
hacky: disgusting solution, need to make sure i can skip any intermed…
Browse files Browse the repository at this point in the history
…iate phases
  • Loading branch information
Ipuch committed Feb 4, 2025
1 parent 5c87647 commit 21e6030
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bioptim/optimization/optimal_control_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,8 @@ def update_bounds(
if not isinstance(a_bounds, BoundsList):
raise RuntimeError("a_bounds should be built from a BoundsList")
origin_phase = 0 if len(a_bounds) == 1 else i
if origin_phase + 1 > len(a_bounds):
continue # Trying to skip the phases if it doesn't have any algebraic states
for key in a_bounds[origin_phase].keys():
if key not in self.nlp[i].algebraic_states.keys() + ["None"]:
raise ValueError(
Expand Down Expand Up @@ -1210,6 +1212,8 @@ def update_initial_guess(
if not isinstance(a_init, InitialGuessList):
raise RuntimeError("a_init should be built from a InitialGuessList")
origin_phase = 0 if len(a_init) == 1 else i
if origin_phase + 1 > len(a_init):
continue # Trying to skip the phases if it doesn't have any algebraic states
for key in a_init[origin_phase].keys():
if key not in self.nlp[i].algebraic_states.keys() + ["None"]:
raise ValueError(
Expand Down

0 comments on commit 21e6030

Please sign in to comment.