control so that the perturbed trajectory eventually reaches $x_f$. But it certainly does not enable us to face perturbations that would happen after time $t$. In order to absorb perturbations all along the trajectory, we suggest the following algorithm: Let $\mathcal{T}$ be an initial control. Given an integer $s$ and a subdivision $0 < \tau_1 < \cdots < \tau_s < t_f$ of the interval $[0,t_f]$, we adjust the control at each $\tau_i$ for all $i \in \llbracket 1,s\rrbracket$. That is, for each $i \in \llbracket 1,s\rrbracket$, we measure the drift $\delta x (\tau_i)= x_{per}(\tau_i) - x_{ref}(\tau_i)$, and compute the differential of the backward end-point mapping $d\tilde{E}(\tau_i,\overline{t}_1, \ldots, \overline{t}_N)$. We deduce from that the correction to apply is then $\delta \mathcal{T} = d\tilde{E}(\tau_i,\overline{t}_1, \ldots, \overline{t}_N)^{\dagger} \cdot \delta x(\tau_i)$. We then update the control by considering the new vector of switching times $\mathcal{T} + \delta \mathcal{T}$.

\[rq\_interchanging\] When computing the correction $\mathcal{T} + \delta \mathcal{T}$, it may happen that the new switching times are not ordered, i.e., there exists some integer $ j \in \llbracket1,N-1\rrbracket$ such that $t_{j+1} < t_j$. In this case, we consider that the correction is not physically acceptable, and we reject it. (Note that in some cases, we 