# Direct multiple shooting (numerical optimal control)

please, Iam currently implementing direct multiple shooting method* and I need one simple but fundamental concept answered:

When I want to provide not only objective funtion value (result of ODE integrator), but as well derivatives (for the NLP solver), for the control parameters it is just sensitivity analysis of said ODE. But what about the parameters, that arise in direct multiple shooting from the discretization of the beginning points of the path (state and ccost trajectory)? What should I tell the solver about derivation of the cost by these parameters?

Of course, I managed to run the multiple shooting algorithm in matlab, but now I want to add the derivatives of the ODE in respect to control parameters. (Note to say, that this question does not depend on the implementation or on the problem itself.)

Is it sufficient to set them to zero? These parameters are not free, they are just numerical-clever-thingies and their values are just bound using equality constraints.

*Brief description of direct multiple shooting, if you know the method by another name:

It is numeric method of discretization for optimal control problems. We have an ODE and control function. By translating this to NonLinear Programming problem, we can solve the original problem.

-Direct Single shooting does just this, just discretizes (at certain timepoints) the control function and calls a routine for NLP using the parameters of the discretized function as parameters to optimize against. (And the Cost function is just solved using ODE solver that gets these parameters.)

-Direct multiple shooting is somewhat clever. When computing the ODE (for calculating the cost function), it gets not only the parameters of the discretized control function, but also the beginning points, where to begin the integration of the ODE. AND at the same time, the method says to the NLP optimizer - use equivality constraints to keep theese parameters (beginnings of the trajectiories) equal to endings of just the trajectory, that was computed at the previous time slot.

Exactly as described, for example, in https://workspace.imperial.ac.uk/people/Public/chemicalengineering/b.chachuat/ic-32_secured.pdf

HOWEVER, why are these new multiple shooting parameters used as explicit NLP parameters in the first place? If something is not a free parameter, then the NLP solver shouldn't have direct access to it. NLP solvers can usually handle equality constraints without any problem. For a trajectory $$\gamma$$ that has been sliced up into $$\{\gamma_1, \gamma_2, \cdots, \gamma_n\}$$ each with time segments $$\{[\tau_0, \tau_1], [\tau_1, \tau_2], \cdots\, [\tau_{n-1}, \tau_n]\}$$ in multiple shooting, extra boundary conditions become
$$\gamma_i(\tau_{i}) - \gamma_{i+1}(\tau_i) = 0 \; \forall \; i \in [1,n-1]$$