diff --git a/bioptim/dynamics/configure_new_variable.py b/bioptim/dynamics/configure_new_variable.py index 9a4f2e364..8cb0997b3 100644 --- a/bioptim/dynamics/configure_new_variable.py +++ b/bioptim/dynamics/configure_new_variable.py @@ -640,4 +640,4 @@ def append_faked_optim_var(name: str, optim_var, keys: list): to_second.extend(list(np.array(optim_var[key].mapping.to_second.map_idx) + len(to_second))) to_first.extend(list(np.array(optim_var[key].mapping.to_first.map_idx) + len(to_first))) - optim_var.append_fake(name, index, None, BiMapping(to_second, to_first)) + optim_var.append_fake(name, index, BiMapping(to_second, to_first)) diff --git a/bioptim/dynamics/configure_problem.py b/bioptim/dynamics/configure_problem.py index f8e943d5e..424ec6a24 100644 --- a/bioptim/dynamics/configure_problem.py +++ b/bioptim/dynamics/configure_problem.py @@ -1496,7 +1496,11 @@ def configure_integrated_value( initial_vector = StochasticBioModel.reshape_to_vector(initial_matrix) cx_scaled_next_formatted = [initial_vector for _ in range(n_cx)] nlp.integrated_values.append( - name, cx_scaled_next_formatted, cx_scaled_next_formatted, initial_matrix, dummy_mapping, 0 + name=name, + cx=cx_scaled_next_formatted, + cx_scaled=[initial_matrix for i in range(n_cx)], # Only the first value is used + mapping=dummy_mapping, + node_index=0 ) for node_index in range(1, nlp.ns + 1): # cannot use phase_dynamics == PhaseDynamics.SHARED_DURING_THE_PHASE cx_scaled_next = nlp.integrated_value_functions[name](nlp, node_index) @@ -1504,7 +1508,6 @@ def configure_integrated_value( nlp.integrated_values.append( name, cx_scaled_next_formatted, - cx_scaled_next_formatted, cx_scaled_next, dummy_mapping, node_index, diff --git a/bioptim/examples/muscle_driven_ocp/muscle_excitations_tracker.py b/bioptim/examples/muscle_driven_ocp/muscle_excitations_tracker.py index 75807414e..9644a0727 100644 --- a/bioptim/examples/muscle_driven_ocp/muscle_excitations_tracker.py +++ b/bioptim/examples/muscle_driven_ocp/muscle_excitations_tracker.py @@ -114,7 +114,6 @@ def generate_data( name="q", cx=[symbolic_q, symbolic_q, symbolic_q], cx_scaled=[symbolic_q, symbolic_q, symbolic_q], - mx=symbolic_q, mapping=nlp.variable_mappings["q"], node_index=node_index, ) @@ -122,7 +121,6 @@ def generate_data( name="qdot", cx=[symbolic_qdot, symbolic_qdot, symbolic_qdot], cx_scaled=[symbolic_qdot, symbolic_qdot, symbolic_qdot], - mx=symbolic_qdot, mapping=nlp.variable_mappings["qdot"], node_index=node_index, ) @@ -130,7 +128,6 @@ def generate_data( name="muscles", cx=[symbolic_mus_states, symbolic_mus_states, symbolic_mus_states], cx_scaled=[symbolic_mus_states, symbolic_mus_states, symbolic_mus_states], - mx=symbolic_mus_states, mapping=nlp.variable_mappings["muscles"], node_index=node_index, ) @@ -139,7 +136,6 @@ def generate_data( name="tau", cx=[symbolic_tau, symbolic_tau, symbolic_tau], cx_scaled=[symbolic_tau, symbolic_tau, symbolic_tau], - mx=symbolic_tau, mapping=nlp.variable_mappings["tau"], node_index=node_index, ) @@ -147,7 +143,6 @@ def generate_data( name="muscles", cx=[symbolic_mus_controls, symbolic_mus_controls, symbolic_mus_controls], cx_scaled=[symbolic_mus_controls, symbolic_mus_controls, symbolic_mus_controls], - mx=symbolic_mus_controls, mapping=nlp.variable_mappings["muscles"], node_index=node_index, ) @@ -155,7 +150,6 @@ def generate_data( name="qdot", cx=[symbolic_qdot, symbolic_qdot, symbolic_qdot], cx_scaled=[symbolic_qdot, symbolic_qdot, symbolic_qdot], - mx=symbolic_qdot, mapping=nlp.variable_mappings["qdot"], node_index=node_index, ) @@ -163,7 +157,6 @@ def generate_data( name="qddot", cx=[symbolic_qddot, symbolic_qddot, symbolic_qddot], cx_scaled=[symbolic_qddot, symbolic_qddot, symbolic_qddot], - mx=symbolic_qddot, mapping=nlp.variable_mappings["qddot"], node_index=node_index, ) diff --git a/bioptim/optimization/optimal_control_program.py b/bioptim/optimization/optimal_control_program.py index e3bd952a6..470cb023b 100644 --- a/bioptim/optimization/optimal_control_program.py +++ b/bioptim/optimization/optimal_control_program.py @@ -1704,15 +1704,10 @@ def _define_numerical_timeseries(self, dynamics): f"{key}_phase{i_phase}_{i_component}_cx", variable_shape[0], ) - mx = MX.sym( - f"{key}_phase{i_phase}_{i_component}_mx", - variable_shape[0], - ) numerical_timeseries[-1].append( name=f"{key}_{i_component}", cx=[cx, cx, cx], - mx=mx, bimapping=BiMapping( Mapping(list(range(variable_shape[0]))), Mapping(list(range(variable_shape[0]))) ),