custom_dynamics/root_implicit.py
def custom_configure_root_implicit(ocp: OptimalControlProgram, nlp: NonLinearProgram):
    """
    Tell the program which variables are states and controls.
    The user is expected to use the ConfigureProblem.configure_xxx functions.

    Parameters
    ----------
    ocp: OptimalControlProgram
        A reference to the ocp
    nlp: NonLinearProgram
        A reference to the phase
    """

    ConfigureProblem.configure_q(nlp, as_states=True, as_controls=False)
    ConfigureProblem.configure_qdot(nlp, as_states=True, as_controls=False)
    ConfigureProblem.configure_qddot(nlp, as_states=False, as_controls=True)

    # we call the implicit constraint function in Bioptim but we could have called the custom one written below
    # ocp.implicit_constraints.add(
    #     ImplicitConstraintFcn.QDDOT_ROOT_EQUALS_ROOT_DYNAMICS,
    #     node=Node.ALL_SHOOTING,
    #     constraint_type=ConstraintType.IMPLICIT,
    #     phase=nlp.phase_idx,
    # )
    ocp.implicit_constraints.add(
        implicit_root_dynamics,
        node=Node.ALL_SHOOTING,
        constraint_type=ConstraintType.IMPLICIT,
        phase=nlp.phase_idx,
    )

    ConfigureProblem.configure_dynamics_function(ocp, nlp, root_implicit_dynamic)

    Tell the program which variables are states and controls.
    The user is expected to use the ConfigureProblem.configure_xxx functions.

    Parameters
    ----------
    ocp: OptimalControlProgram
        A reference to the ocp
    nlp: NonLinearProgram
        A reference to the phase
    
Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.

Parameters

OptimalControlProgram
A reference to the ocp
nlp: NonLinearProgram
A reference to the phase
Tell the program which variables are states and controls . The user is expected to use the ConfigureProblem . configure_xxx functions . Parameters OptimalControlProgram A reference to the ocp nlp : NonLinearProgram A reference to the phase
def custom_configure_root_implicit(ocp: OptimalControlProgram, nlp: NonLinearProgram):
    ConfigureProblem.configure_q(nlp, as_states=True, as_controls=False)
    ConfigureProblem.configure_qdot(nlp, as_states=True, as_controls=False)
    ConfigureProblem.configure_qddot(nlp, as_states=False, as_controls=True)
    ocp.implicit_constraints.add(
        implicit_root_dynamics,
        node=Node.ALL_SHOOTING,
        constraint_type=ConstraintType.IMPLICIT,
        phase=nlp.phase_idx,
    )
    ConfigureProblem.configure_dynamics_function(ocp, nlp, root_implicit_dynamic)
def custom_configure_root_implicit ( ocp : OptimalControlProgram , nlp : NonLinearProgram ) : ConfigureProblem . configure_q ( nlp , as_states = True , as_controls = False ) ConfigureProblem . configure_qdot ( nlp , as_states = True , as_controls = False ) ConfigureProblem . configure_qddot ( nlp , as_states = False , as_controls = True ) ocp . implicit_constraints . add ( implicit_root_dynamics , node = Node . ALL_SHOOTING , constraint_type = ConstraintType . IMPLICIT , phase = nlp . phase_idx , ) ConfigureProblem . configure_dynamics_function ( ocp , nlp , root_implicit_dynamic )
Tell the program which variables are states and controls.
Tell the program which variables are states and controls .
"""
    Tell the program which variables are states and controls.
    The user is expected to use the ConfigureProblem.configure_xxx functions.

    Parameters
    ----------
    ocp: OptimalControlProgram
        A reference to the ocp
    nlp: NonLinearProgram
        A reference to the phase
    """ # we call the implicit constraint function in Bioptim but we could have called the custom one written below # ocp.implicit_constraints.add( #     ImplicitConstraintFcn.QDDOT_ROOT_EQUALS_ROOT_DYNAMICS, #     node=Node.ALL_SHOOTING, #     constraint_type=ConstraintType.IMPLICIT, #     phase=nlp.phase_idx, # )
ocp
OptimalControlProgram
nlp
NonLinearProgram