From 3b3fa7243b940ff989663795cbf2828db5b463a0 Mon Sep 17 00:00:00 2001 From: Ipuch Date: Tue, 25 Feb 2025 15:34:56 -0500 Subject: [PATCH] fix: when control has dimension (1,1) it helps --- bioptim/limits/penalty_option.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bioptim/limits/penalty_option.py b/bioptim/limits/penalty_option.py index f35989528..7609282c4 100644 --- a/bioptim/limits/penalty_option.py +++ b/bioptim/limits/penalty_option.py @@ -450,7 +450,7 @@ def _set_penalty_function(self, controllers: list[PenaltyController], fcn: MX | if self.integration_rule == QuadratureRule.APPROXIMATE_TRAPEZOIDAL: state_cx_end = controller.states_scaled.cx_end elif self.integration_rule == QuadratureRule.TRAPEZOIDAL: - u_integrate = u.reshape((-1, 2)) + u_integrate = u.reshape((-1, 2)) if u.shape[0] == 2 else u.T if self.control_types[0] in (ControlType.CONSTANT, ControlType.CONSTANT_WITH_LAST_NODE): u_integrate = u_integrate[:, 0] elif self.control_types[0] in (ControlType.LINEAR_CONTINUOUS,):