pyomeca / bioptim

An optimization framework that links CasADi, Ipopt, ACADOS and biorbd for Optimal Control Problem
MIT License
92 stars 46 forks source link

Direct Collocation method should be modified #421

Closed Ipuch closed 2 years ago

Ipuch commented 2 years ago

I've dug in how direct collocation actually works when it is not used in an optimal control scheme.

It looks like our implementation is not truly based on a boundary value problem. As it has been implemented from IRK solver, the collocation method implemented still rely on an initial value problem.

image

And the direct collocation method is a boundary value problem. Meaning we should have a initial value and final value satisfied by the solution of the differential equation :

image

To implement a true collocation method, modifications could be done:

Thus, we would get n+1 equations for each segment, and a system of equations that can be solved.

Plus, this formulation could reduce the number of variables since the final value of each segment is the first value of the next segment. So, the final enhancement could be to reduce the number of symbolic variables and delete the defect when using direct collocation.

pariterre commented 2 years ago

Good :)