From 4d08ee47594df6423cd884f388a45f39d45a29e6 Mon Sep 17 00:00:00 2001 From: Ipuch Date: Thu, 18 Jan 2024 15:10:39 -0500 Subject: [PATCH 1/3] restoring custom model and add a test :) --- bioptim/examples/custom_model/custom_package/my_model.py | 5 +++++ bioptim/examples/custom_model/main.py | 2 +- tests/shard1/test_all_examples.py | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bioptim/examples/custom_model/custom_package/my_model.py b/bioptim/examples/custom_model/custom_package/my_model.py index 804c39730..6a3d7c056 100644 --- a/bioptim/examples/custom_model/custom_package/my_model.py +++ b/bioptim/examples/custom_model/custom_package/my_model.py @@ -26,6 +26,11 @@ def serialize(self) -> tuple[Callable, dict]: return MyModel, dict(com=self.com, inertia=self.inertia) # ---- Needed for the example ---- # + + @property + def name(self) -> str: + return "MyModel" + @property def nb_tau(self): return 1 diff --git a/bioptim/examples/custom_model/main.py b/bioptim/examples/custom_model/main.py index 8116f3e1a..5037b1bfa 100644 --- a/bioptim/examples/custom_model/main.py +++ b/bioptim/examples/custom_model/main.py @@ -141,7 +141,7 @@ def main(): sol = ocp.solve(solver=solver) # --- Show results --- # - sol.graphs(show_bounds=True) + # sol.graphs(show_bounds=True) sol.print_cost() # --- Animation --- # diff --git a/tests/shard1/test_all_examples.py b/tests/shard1/test_all_examples.py index 1c6de58b2..b4e26a6d3 100644 --- a/tests/shard1/test_all_examples.py +++ b/tests/shard1/test_all_examples.py @@ -1485,3 +1485,8 @@ def test_min_max_example(): ocp_module.prepare_ocp( bio_model_path=bioptim_folder + "/models/double_pendulum.bioMod", ) + + +def test_custom_model(): + from bioptim.examples.custom_model.main import main as ocp_module + ocp_module() From 4ed21685f2e8d8b9bfecaa6d8329cb1875ffc0af Mon Sep 17 00:00:00 2001 From: Ipuch Date: Thu, 18 Jan 2024 15:17:50 -0500 Subject: [PATCH 2/3] fix: custom_model.py now working --- .../custom_model/custom_package/my_model.py | 5 +- bioptim/examples/custom_model/main.py | 21 ++-- tests/shard1/test_all_examples.py | 119 ++++++++++++------ 3 files changed, 94 insertions(+), 51 deletions(-) diff --git a/bioptim/examples/custom_model/custom_package/my_model.py b/bioptim/examples/custom_model/custom_package/my_model.py index 6a3d7c056..d1281c4b3 100644 --- a/bioptim/examples/custom_model/custom_package/my_model.py +++ b/bioptim/examples/custom_model/custom_package/my_model.py @@ -2,10 +2,9 @@ This script implements a custom model to work with bioptim. Bioptim has a deep connection with biorbd, but it is possible to use bioptim without biorbd. This is an example of how to use bioptim with a custom model. """ -from typing import Callable - import numpy as np from casadi import sin, MX +from typing import Callable class MyModel: @@ -63,7 +62,7 @@ def forward_dynamics(self, q, qdot, tau, fext=None, f_contacts=None): I = self.inertia m = self.mass g = 9.81 - return 1 / (I + m * L**2) * (-qdot[0] * d - g * m * L * sin(q[0]) + tau[0]) + return 1 / (I + m * L ** 2) * (-qdot[0] * d - g * m * L * sin(q[0]) + tau[0]) # def system_dynamics(self, *args): # This is where you can implement your system dynamics with casadi if you are dealing with other systems diff --git a/bioptim/examples/custom_model/main.py b/bioptim/examples/custom_model/main.py index 5037b1bfa..a6b860df9 100644 --- a/bioptim/examples/custom_model/main.py +++ b/bioptim/examples/custom_model/main.py @@ -4,9 +4,6 @@ """ import numpy as np -# import the custom model -from bioptim.examples.custom_model.custom_package import MyModel - from bioptim import ( OptimalControlProgram, BoundsList, @@ -20,17 +17,19 @@ DynamicsList, PhaseDynamics, ) +# import the custom model +from bioptim.examples.custom_model.custom_package import MyModel def prepare_ocp( - model: MyModel, - final_time: float, - n_shooting: int, - configure_dynamics: callable = None, - ode_solver: OdeSolverBase = OdeSolver.RK4(n_integration_steps=5), - phase_dynamics: PhaseDynamics = PhaseDynamics.SHARED_DURING_THE_PHASE, - n_threads: int = 2, - expand_dynamics: bool = True, + model: MyModel, + final_time: float, + n_shooting: int, + configure_dynamics: callable = None, + ode_solver: OdeSolverBase = OdeSolver.RK4(n_integration_steps=5), + phase_dynamics: PhaseDynamics = PhaseDynamics.SHARED_DURING_THE_PHASE, + n_threads: int = 2, + expand_dynamics: bool = True, ) -> OptimalControlProgram: """ The initialization of an ocp diff --git a/tests/shard1/test_all_examples.py b/tests/shard1/test_all_examples.py index b4e26a6d3..10c360a72 100644 --- a/tests/shard1/test_all_examples.py +++ b/tests/shard1/test_all_examples.py @@ -1,6 +1,7 @@ +import numpy as np import os import pytest -import numpy as np + from bioptim import InterpolationType, PhaseDynamics @@ -24,7 +25,10 @@ def test__acados__pendulum(): bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path=bioptim_folder + "/models/pendulum.bioMod", n_shooting=41, final_time=3, expand_dynamics=True + biorbd_model_path=bioptim_folder + "/models/pendulum.bioMod", + n_shooting=41, + final_time=3, + expand_dynamics=True, ) @@ -194,12 +198,15 @@ def test__getting_started__example_external_forces(): def test__getting_started__example_inequality_constraint(): - from bioptim.examples.getting_started import example_inequality_constraint as ocp_module + from bioptim.examples.getting_started import ( + example_inequality_constraint as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path=bioptim_folder + "/../torque_driven_ocp/models/2segments_4dof_2contacts.bioMod", + biorbd_model_path=bioptim_folder + + "/../torque_driven_ocp/models/2segments_4dof_2contacts.bioMod", phase_time=0.3, n_shooting=10, min_bound=50, @@ -214,11 +221,13 @@ def test__getting_started__example_inequality_constraint(): def test__getting_started__example_mapping(): - from bioptim.examples.getting_started import example_mapping as ocp_module + pass def test__getting_started__example_multinode_constraints(): - from bioptim.examples.getting_started import example_multinode_constraints as ocp_module + from bioptim.examples.getting_started import ( + example_multinode_constraints as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -231,7 +240,9 @@ def test__getting_started__example_multinode_constraints(): def test__getting_started__example_multinode_objective(): - from bioptim.examples.getting_started import example_multinode_objective as ocp_module + from bioptim.examples.getting_started import ( + example_multinode_objective as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -243,10 +254,10 @@ def test__getting_started__example_multinode_objective(): ) with pytest.raises( - ValueError, - match="Valid values for setting the cx is 0, 1 or 2. If you reach this error message, you probably tried to " - "add more penalties than available in a multinode constraint. You can try to split the constraints " - "into more penalties or use phase_dynamics=PhaseDynamics.ONE_PER_NODE", + ValueError, + match="Valid values for setting the cx is 0, 1 or 2. If you reach this error message, you probably tried to " + "add more penalties than available in a multinode constraint. You can try to split the constraints " + "into more penalties or use phase_dynamics=PhaseDynamics.ONE_PER_NODE", ): ocp_module.prepare_ocp( biorbd_model_path=bioptim_folder + "/models/pendulum.bioMod", @@ -274,11 +285,11 @@ def test__getting_started__example_multiphase(): def test__getting_started__example_optimal_time(): - from bioptim.examples.getting_started import example_optimal_time as ocp_module + pass def test__getting_started__example_simulation(): - from bioptim.examples.getting_started import example_optimal_time as ocp_module + pass # todo: Add example_variable_scaling.py? @@ -299,7 +310,9 @@ def test__getting_started__pendulum(): def test__getting_started__pendulum_constrained_states_controls(): - from bioptim.examples.getting_started import pendulum_constrained_states_controls as ocp_module + from bioptim.examples.getting_started import ( + pendulum_constrained_states_controls as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -314,15 +327,15 @@ def test__getting_started__pendulum_constrained_states_controls(): ## examples/moving_horizon_estimation def test__moving_horizon_estimation__mhe(): - from bioptim.examples.moving_horizon_estimation import mhe as ocp_module + pass def test__muscle_driven_ocp__muscle_activations_tracker(): - from bioptim.examples.muscle_driven_ocp import muscle_activations_tracker as ocp_module + pass def test__muscle_driven_ocp__muscle_excitations_tracker(): - from bioptim.examples.muscle_driven_ocp import muscle_excitations_tracker as ocp_module + pass def test__muscle_driven_ocp__static_arm(): @@ -341,11 +354,13 @@ def test__muscle_driven_ocp__static_arm(): def test__muscle_driven_with_contact__muscle_activations_contacts_tracker(): - from bioptim.examples.muscle_driven_with_contact import muscle_activations_contacts_tracker as ocp_module + pass def test__optimal_time_ocp__multiphase_time_constraint(): - from bioptim.examples.optimal_time_ocp import multiphase_time_constraint as ocp_module + from bioptim.examples.optimal_time_ocp import ( + multiphase_time_constraint as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -365,7 +380,9 @@ def test__optimal_time_ocp__multiphase_time_constraint(): def test__optimal_time_ocp__pendulum_min_time_Lagrange(): - from bioptim.examples.optimal_time_ocp import pendulum_min_time_Lagrange as ocp_module + from bioptim.examples.optimal_time_ocp import ( + pendulum_min_time_Lagrange as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -408,7 +425,9 @@ def test__optimal_time_ocp__time_constraint(): def test__symmetrical_torque_driven_ocp__symmetry_by_constraint(): - from bioptim.examples.symmetrical_torque_driven_ocp import symmetry_by_constraint as ocp_module + from bioptim.examples.symmetrical_torque_driven_ocp import ( + symmetry_by_constraint as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -420,7 +439,9 @@ def test__symmetrical_torque_driven_ocp__symmetry_by_constraint(): def test__symmetrical_torque_driven_ocp__symmetry_by_mapping(): - from bioptim.examples.symmetrical_torque_driven_ocp import symmetry_by_mapping as ocp_module + from bioptim.examples.symmetrical_torque_driven_ocp import ( + symmetry_by_mapping as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -432,7 +453,9 @@ def test__symmetrical_torque_driven_ocp__symmetry_by_mapping(): def test__torque_driven_ocp__maximize_predicted_height_CoM(): - from bioptim.examples.torque_driven_ocp import maximize_predicted_height_CoM as ocp_module + from bioptim.examples.torque_driven_ocp import ( + maximize_predicted_height_CoM as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -449,13 +472,16 @@ def test__torque_driven_ocp__maximize_predicted_height_CoM(): def test__torque_driven_ocp__multi_biorbd_model(): - from bioptim.examples.torque_driven_ocp import example_multi_biorbd_model as ocp_module + from bioptim.examples.torque_driven_ocp import ( + example_multi_biorbd_model as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( biorbd_model_path=bioptim_folder + "/models/triple_pendulum.bioMod", - biorbd_model_path_modified_inertia=bioptim_folder + "/models/triple_pendulum_modified_inertia.bioMod", + biorbd_model_path_modified_inertia=bioptim_folder + + "/models/triple_pendulum_modified_inertia.bioMod", n_shooting=40, phase_dynamics=PhaseDynamics.SHARED_DURING_THE_PHASE, expand_dynamics=False, @@ -463,13 +489,16 @@ def test__torque_driven_ocp__multi_biorbd_model(): def test__torque_driven_ocp__phase_transition_uneven_variable_number_by_mapping(): - from bioptim.examples.torque_driven_ocp import phase_transition_uneven_variable_number_by_mapping as ocp_module + from bioptim.examples.torque_driven_ocp import ( + phase_transition_uneven_variable_number_by_mapping as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( biorbd_model_path=bioptim_folder + "/models/double_pendulum.bioMod", - biorbd_model_path_with_translations=bioptim_folder + "/models/double_pendulum_with_translations.bioMod", + biorbd_model_path_with_translations=bioptim_folder + + "/models/double_pendulum_with_translations.bioMod", n_shooting=(5, 5), phase_dynamics=PhaseDynamics.SHARED_DURING_THE_PHASE, expand_dynamics=False, @@ -477,12 +506,15 @@ def test__torque_driven_ocp__phase_transition_uneven_variable_number_by_mapping( def test__torque_driven_ocp__phase_transition_uneven_variable_number_by_bounds(): - from bioptim.examples.torque_driven_ocp import phase_transition_uneven_variable_number_by_bounds as ocp_module + from bioptim.examples.torque_driven_ocp import ( + phase_transition_uneven_variable_number_by_bounds as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path_with_translations=bioptim_folder + "/models/double_pendulum_with_translations.bioMod", + biorbd_model_path_with_translations=bioptim_folder + + "/models/double_pendulum_with_translations.bioMod", n_shooting=(5, 5), phase_dynamics=PhaseDynamics.SHARED_DURING_THE_PHASE, expand_dynamics=False, @@ -1317,11 +1349,13 @@ def test__track__optimal_estimation(): def test__torque_driven_ocp__track_markers_2D_pendulum(): - from bioptim.examples.torque_driven_ocp import track_markers_2D_pendulum as ocp_module + pass def test__torque_driven_ocp__track_markers_with_torque_actuators(): - from bioptim.examples.torque_driven_ocp import track_markers_with_torque_actuators as ocp_module + from bioptim.examples.torque_driven_ocp import ( + track_markers_with_torque_actuators as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -1349,7 +1383,9 @@ def test__torque_driven_ocp__trampo_quaternions(): def test__torque_driven_ocp__minimize_segment_velocity(): - from bioptim.examples.torque_driven_ocp import example_minimize_segment_velocity as ocp_module + from bioptim.examples.torque_driven_ocp import ( + example_minimize_segment_velocity as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -1418,7 +1454,9 @@ def test__getting_started__example_variable_scaling(): def test__torque_driven_ocp__torque_activation_driven(): - from bioptim.examples.torque_driven_ocp import torque_activation_driven as ocp_module + from bioptim.examples.torque_driven_ocp import ( + torque_activation_driven as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -1432,7 +1470,9 @@ def test__torque_driven_ocp__torque_activation_driven(): def test__inverse_optimal_control__double_pendulum_torque_driven_IOCP(): - from bioptim.examples.inverse_optimal_control import double_pendulum_torque_driven_IOCP as ocp_module + from bioptim.examples.inverse_optimal_control import ( + double_pendulum_torque_driven_IOCP as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) @@ -1445,12 +1485,15 @@ def test__inverse_optimal_control__double_pendulum_torque_driven_IOCP(): def test__contact_and_muscle_forces_example(): - from bioptim.examples.muscle_driven_with_contact import contact_forces_inequality_constraint_muscle as ocp_module + from bioptim.examples.muscle_driven_with_contact import ( + contact_forces_inequality_constraint_muscle as ocp_module, + ) bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path=bioptim_folder + "/models/2segments_4dof_2contacts_1muscle.bioMod", + biorbd_model_path=bioptim_folder + + "/models/2segments_4dof_2contacts_1muscle.bioMod", phase_time=0.3, n_shooting=10, min_bound=50, @@ -1467,7 +1510,8 @@ def test__contact_and_muscle_forces_example_excitation(): bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path=bioptim_folder + "/models/2segments_4dof_2contacts_1muscle.bioMod", + biorbd_model_path=bioptim_folder + + "/models/2segments_4dof_2contacts_1muscle.bioMod", phase_time=0.3, n_shooting=10, min_bound=50, @@ -1489,4 +1533,5 @@ def test_min_max_example(): def test_custom_model(): from bioptim.examples.custom_model.main import main as ocp_module + ocp_module() From 044cb2bbf7c3ee044e678a3269968ef9fc9a641b Mon Sep 17 00:00:00 2001 From: Ipuch Date: Thu, 18 Jan 2024 15:23:17 -0500 Subject: [PATCH 3/3] black --- .../custom_model/custom_package/my_model.py | 2 +- bioptim/examples/custom_model/main.py | 26 ++++++++++++------- tests/shard1/test_all_examples.py | 26 +++++++------------ 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/bioptim/examples/custom_model/custom_package/my_model.py b/bioptim/examples/custom_model/custom_package/my_model.py index d1281c4b3..8bd68ed43 100644 --- a/bioptim/examples/custom_model/custom_package/my_model.py +++ b/bioptim/examples/custom_model/custom_package/my_model.py @@ -62,7 +62,7 @@ def forward_dynamics(self, q, qdot, tau, fext=None, f_contacts=None): I = self.inertia m = self.mass g = 9.81 - return 1 / (I + m * L ** 2) * (-qdot[0] * d - g * m * L * sin(q[0]) + tau[0]) + return 1 / (I + m * L**2) * (-qdot[0] * d - g * m * L * sin(q[0]) + tau[0]) # def system_dynamics(self, *args): # This is where you can implement your system dynamics with casadi if you are dealing with other systems diff --git a/bioptim/examples/custom_model/main.py b/bioptim/examples/custom_model/main.py index a6b860df9..151806ad2 100644 --- a/bioptim/examples/custom_model/main.py +++ b/bioptim/examples/custom_model/main.py @@ -17,19 +17,20 @@ DynamicsList, PhaseDynamics, ) + # import the custom model from bioptim.examples.custom_model.custom_package import MyModel def prepare_ocp( - model: MyModel, - final_time: float, - n_shooting: int, - configure_dynamics: callable = None, - ode_solver: OdeSolverBase = OdeSolver.RK4(n_integration_steps=5), - phase_dynamics: PhaseDynamics = PhaseDynamics.SHARED_DURING_THE_PHASE, - n_threads: int = 2, - expand_dynamics: bool = True, + model: MyModel, + final_time: float, + n_shooting: int, + configure_dynamics: callable = None, + ode_solver: OdeSolverBase = OdeSolver.RK4(n_integration_steps=5), + phase_dynamics: PhaseDynamics = PhaseDynamics.SHARED_DURING_THE_PHASE, + n_threads: int = 2, + expand_dynamics: bool = True, ) -> OptimalControlProgram: """ The initialization of an ocp @@ -69,7 +70,10 @@ def prepare_ocp( # Dynamics dynamics = DynamicsList() dynamics.add( - configure_dynamics, dynamic_function=dynamics, expand_dynamics=expand_dynamics, phase_dynamics=phase_dynamics + configure_dynamics, + dynamic_function=dynamics, + expand_dynamics=expand_dynamics, + phase_dynamics=phase_dynamics, ) # Path constraint @@ -118,7 +122,9 @@ def main(): """ # import the custom dynamics and configuration - from bioptim.examples.custom_model.custom_package.custom_dynamics import custom_configure_my_dynamics + from bioptim.examples.custom_model.custom_package.custom_dynamics import ( + custom_configure_my_dynamics, + ) # --- Prepare the ocp --- # ocp = prepare_ocp( diff --git a/tests/shard1/test_all_examples.py b/tests/shard1/test_all_examples.py index 10c360a72..bcf036e9e 100644 --- a/tests/shard1/test_all_examples.py +++ b/tests/shard1/test_all_examples.py @@ -205,8 +205,7 @@ def test__getting_started__example_inequality_constraint(): bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path=bioptim_folder - + "/../torque_driven_ocp/models/2segments_4dof_2contacts.bioMod", + biorbd_model_path=bioptim_folder + "/../torque_driven_ocp/models/2segments_4dof_2contacts.bioMod", phase_time=0.3, n_shooting=10, min_bound=50, @@ -254,10 +253,10 @@ def test__getting_started__example_multinode_objective(): ) with pytest.raises( - ValueError, - match="Valid values for setting the cx is 0, 1 or 2. If you reach this error message, you probably tried to " - "add more penalties than available in a multinode constraint. You can try to split the constraints " - "into more penalties or use phase_dynamics=PhaseDynamics.ONE_PER_NODE", + ValueError, + match="Valid values for setting the cx is 0, 1 or 2. If you reach this error message, you probably tried to " + "add more penalties than available in a multinode constraint. You can try to split the constraints " + "into more penalties or use phase_dynamics=PhaseDynamics.ONE_PER_NODE", ): ocp_module.prepare_ocp( biorbd_model_path=bioptim_folder + "/models/pendulum.bioMod", @@ -480,8 +479,7 @@ def test__torque_driven_ocp__multi_biorbd_model(): ocp_module.prepare_ocp( biorbd_model_path=bioptim_folder + "/models/triple_pendulum.bioMod", - biorbd_model_path_modified_inertia=bioptim_folder - + "/models/triple_pendulum_modified_inertia.bioMod", + biorbd_model_path_modified_inertia=bioptim_folder + "/models/triple_pendulum_modified_inertia.bioMod", n_shooting=40, phase_dynamics=PhaseDynamics.SHARED_DURING_THE_PHASE, expand_dynamics=False, @@ -497,8 +495,7 @@ def test__torque_driven_ocp__phase_transition_uneven_variable_number_by_mapping( ocp_module.prepare_ocp( biorbd_model_path=bioptim_folder + "/models/double_pendulum.bioMod", - biorbd_model_path_with_translations=bioptim_folder - + "/models/double_pendulum_with_translations.bioMod", + biorbd_model_path_with_translations=bioptim_folder + "/models/double_pendulum_with_translations.bioMod", n_shooting=(5, 5), phase_dynamics=PhaseDynamics.SHARED_DURING_THE_PHASE, expand_dynamics=False, @@ -513,8 +510,7 @@ def test__torque_driven_ocp__phase_transition_uneven_variable_number_by_bounds() bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path_with_translations=bioptim_folder - + "/models/double_pendulum_with_translations.bioMod", + biorbd_model_path_with_translations=bioptim_folder + "/models/double_pendulum_with_translations.bioMod", n_shooting=(5, 5), phase_dynamics=PhaseDynamics.SHARED_DURING_THE_PHASE, expand_dynamics=False, @@ -1492,8 +1488,7 @@ def test__contact_and_muscle_forces_example(): bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path=bioptim_folder - + "/models/2segments_4dof_2contacts_1muscle.bioMod", + biorbd_model_path=bioptim_folder + "/models/2segments_4dof_2contacts_1muscle.bioMod", phase_time=0.3, n_shooting=10, min_bound=50, @@ -1510,8 +1505,7 @@ def test__contact_and_muscle_forces_example_excitation(): bioptim_folder = os.path.dirname(ocp_module.__file__) ocp_module.prepare_ocp( - biorbd_model_path=bioptim_folder - + "/models/2segments_4dof_2contacts_1muscle.bioMod", + biorbd_model_path=bioptim_folder + "/models/2segments_4dof_2contacts_1muscle.bioMod", phase_time=0.3, n_shooting=10, min_bound=50,