Skip to content

Commit

Permalink
style(black)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin CO committed Oct 8, 2024
1 parent 0ae4997 commit bd5a025
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
VariableScaling,
)


class MyCyclicNMPC(MultiCyclicNonlinearModelPredictiveControl):
def advance_window_bounds_states(self, sol, n_cycles_simultaneous=None):
# Reimplementation of the advance_window method so the rotation of the wheel restart at -pi
Expand Down Expand Up @@ -103,7 +104,9 @@ def parameter_dependent_dynamic(
return DynamicsEvaluation(dxdt=vertcat(dq, ddq), defects=None)


def custom_configure(ocp: OptimalControlProgram, nlp: NonLinearProgram, numerical_data_timeseries: dict[str, np.ndarray] = None):
def custom_configure(
ocp: OptimalControlProgram, nlp: NonLinearProgram, numerical_data_timeseries: dict[str, np.ndarray] = None
):
"""
Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def time_dependent_dynamic(
return DynamicsEvaluation(dxdt=vertcat(dq, ddq), defects=None)


def custom_configure(ocp: OptimalControlProgram, nlp: NonLinearProgram, numerical_data_timeseries: dict[str, np.ndarray] = None):
def custom_configure(
ocp: OptimalControlProgram, nlp: NonLinearProgram, numerical_data_timeseries: dict[str, np.ndarray] = None
):
"""
Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.
Expand Down
7 changes: 6 additions & 1 deletion bioptim/optimization/receding_horizon_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,12 @@ def _initialize_one_cycle(self, dt: float, states: np.ndarray, controls: np.ndar
size=self.nlp[0].parameters[key].shape,
scaling=self.nlp[0].parameters[key].scaling,
)
p_init.add(key, parameters_tp, interpolation=InterpolationType.EACH_FRAME, phase=0,)
p_init.add(
key,
parameters_tp,
interpolation=InterpolationType.EACH_FRAME,
phase=0,
)

solution_ocp = OptimalControlProgram(
bio_model=model_class(**model_initializer),
Expand Down
4 changes: 3 additions & 1 deletion tests/shard2/test_global_nmpc_final.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ def update_functions(_nmpc, cycle_idx, _sol):

# initial and final parameters
for key in parameters.keys():
npt.assert_almost_equal(parameters[key], [np.array([2.5594204]), np.array([2.55932934]), np.array([2.56215198])])
npt.assert_almost_equal(
parameters[key], [np.array([2.5594204]), np.array([2.55932934]), np.array([2.56215198])]
)

# check time
n_steps = nmpc.nlp[0].ode_solver.n_integration_steps
Expand Down

0 comments on commit bd5a025

Please sign in to comment.