Skip to content

Commit

Permalink
blck
Browse files Browse the repository at this point in the history
  • Loading branch information
Ipuch committed Nov 5, 2023
1 parent fb901df commit 9a75586
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bioptim/interfaces/interface_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,14 @@ def get_node_control_info(nlp, node_idx, attribute: str):


def get_padded_control_array(
nlp,
node_idx: int,
u_mode: int,
attribute: str,
target_length: int,
is_within_control_limit_target: bool,
is_shared_dynamics_target: bool,
casadi_constructor: Callable,
nlp,
node_idx: int,
u_mode: int,
attribute: str,
target_length: int,
is_within_control_limit_target: bool,
is_shared_dynamics_target: bool,
casadi_constructor: Callable,
):
"""
Get a padded array of the correct length
Expand Down Expand Up @@ -674,7 +674,7 @@ def get_padded_control_array(

if is_shared_dynamics or is_within_control_limit:
should_apply_fake_padding_on_u_sym = target_length > len_u and (
is_within_control_limit_target or is_shared_dynamics_target
is_within_control_limit_target or is_shared_dynamics_target
)
_u_sym = getattr(nlp, attribute)[node_idx - u_mode]

Expand Down
2 changes: 2 additions & 0 deletions tests/shard6/test_unit_solver_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ def test_mx(nlp_mx):
res = Function("test", [], [result_mx - expected])
assert res()["o0"].is_zero()


@pytest.fixture
def nlp_control_sx():
nlp = NonLinearProgram(PhaseDynamics.SHARED_DURING_THE_PHASE)
nlp.U_scaled = [SX([[1], [2], [3]])]
return nlp


@pytest.fixture
def nlp_control_mx():
nlp = NonLinearProgram(PhaseDynamics.SHARED_DURING_THE_PHASE)
Expand Down

0 comments on commit 9a75586

Please sign in to comment.