Skip to content

The variational integrator implementation could be uniformized with the one of other integrators #962

@EveCharbie

Description

@EveCharbie

Context: Following PR #959, there is an empty VARIATIONAL "enum" in dynamics/ode_solvers.py and dynamics/integrators.py in anticipation for the refactor suggested in this issue.

Current code state: The implementation of the variational integrator is done in VariationalOptimalControlProgram.

Possible action item: To uniformize the implementation of the variational integrator with the other integrators, it would be better to move it to

  1. dynamics/ode_solvers.py: define the variational constraint:
        nlp.implicit_dynamics_func = Function(
            "ThreeNodesIntegration",
            three_nodes_input,
            [
                self.bio_model.discrete_euler_lagrange_equations(
                    dt,
                    q_prev,
                    q_cur,
                    q_next,
                    control_prev,
                    control_cur,
                    control_next,
                    lambdas,
                )
            ],
        )
  1. dynamics/integrators.py evaluate the constraint here

*Please note that I did not fully thought this through, if you (aka the dev who tackle this issue) think it would be better to do otherwise, feel free to do so.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions