# Implicit A-Stable Peer Triplets for ODE Constrained Optimal Control Problems
## 2 Materials and Methods  
### The Boundary Value Problem  
Following the usual Lagrangian approach applied in [13], the first order discrete optimality conditions now consist of the forward Equations (10)-(12), the discrete adjoint equations, acting backwards in time,\[A_{N}^{\mathsf{T}}P_{N} = w\otimes p_{h}(T)+h\
abla_{Y}F(Y_{N},U_{N})^{\mathsf{T}}K_{N}^{ \mathsf{T}}P_{N}, \tag{13}\] \[A_{n}^{\mathsf{T}}P_{n} = B_{n+1}^{\mathsf{T}}P_{n+1}+h\
abla_{Y}F(Y_{n},U_{n})^{\mathsf{T }}K_{n}^{\mathsf{T}}P_{n},\ N-1\geq n\geq 0, \tag{14}\]  
and the control conditions  
\[-h\
abla_{U}F(Y_{n},U_{n})^{\mathsf{T}}K_{n}^{\mathsf{T}}P_{n} \in N_{U^{\mathsf{T}}}\big{(}U_{n}\big{)},\ 0\leq n\leq N, \tag{15}\] \[-h\
abla_{u_{0}}f(y_{0},u_{0})^{\mathsf{T}}(b^{\mathsf{T}}\otimes I )P_{0}\in N_{U}(u_{0}). \tag{16}\]  
Here, \(p_{h}(T)=\
abla_{y}C\big{(}y_{h}(T)\big{)}^{\mathsf{T}}\) and the Jacobians of \(F\) are block diagonal matrices \(\
abla_{Y}F(Y_{n},U_{n})\!=\operatorname{diag}_{i}\big{(}\
abla_{Y_{ni}}f(Y_ {ni},U_{ni})\big{)}\) and \(\
abla_{U}F(Y_{n},U_{n})=\operatorname{diag}_{i}\big{(}\
abla_{U_{ni}}f(Y_{ni },U_{ni})\big{)}\). The generalized normal cone mapping \(N_{U^{\mathsf{T}}}(U_{n})\) is defined by  
\[N_{U^{\mathsf{T}}}(u)=\Big{\{}w\in\mathbb{R}^{sd}:w^{\mathsf{T}}(v-u)\leq 0 \text{ for all }v\in U_{ad}^{s}\subset\mathbb{R}^{sd}\Big{\}}. \tag{17}\]  
The discrete KKT conditions (10)-(16) should be good approximations to the continuous ones (5)-(7). In what follows, we assume sufficient smoothness of the optimal control problem such that a local solution \((y^{\star},u^{\star},p^{\star})\) of the KKT system (1)-(3) exists. Furthermore, let the Hamiltonian \(H(y,u,p):=p^{\mathsf{T}}f(y,u)\) satisfy a coercivity assumption, which is a strong form of a second-order condition. Then the first-order optimality conditions are also sufficient [14]. If \((y,p)\) is sufficiently close to \((y^{\star},p^{\star})\), the control uniqueness property introduced in [14] yields the existence of a locally unique minimizer \(u=u(y,p)\) of the Hamiltonian over all \(u\in U_{ad}\). Substituting \(u\) in terms of \((y,p)\) in (5) and (6), gives then the two-point boundary value problem  
\[y^{\prime}(t)= g\big{(}y(t),p(t)\big{)},\quad y(0)=y_{0}, \tag{18}\] \[p^{\prime}(t)= \phi\big{(}y(t),p(t)\big{)},\quad p(T)=\
abla_{y}C\big{(}y(T) \big{)}^{\mathsf{T}}, \tag{19}\]  
with the source functions defined by  
\[g(y,p):= f\big{(}y,u(y,p)\big{)},\quad\phi(y,p):=-\
abla_{y}f\big{(}y,u(y,p) \big{)}^{\mathsf{T}}p. \tag{20}\]  
The same arguments apply to the discrete first-order optimality system (10)-(16). Substituting the discrete controls \(U_{n}=U_{n}(Y_{n},P_{n})\) in terms of \((Y_{n},P_{n})\) and defining  
\[\Phi(Y_{n},K_{n}^{\mathsf{T}}P_{n}):=\Big{(}\phi(Y_{ni},(K_{n}^{\mathsf{T}}P_{ n})_{i})\Big{)}_{i=1}^{s},\quad G(Y_{n},P_{n}):=\big{(}g(Y_{ni},P_{ni}) \big{)}_{i=1}^{s}, \tag{21}\]  
the approximations for the forward and adjoint differential equations read in a compact form  
\[A_{0}Y_{0} = a\otimes y_{0}+hb\otimes g\big{(}y_{0},p_{h}(0)\big{)}+hK_{0}G( Y_{0},P_{0}), \tag{22}\] \[A_{n}Y_{n} = B_{n}Y_{n-1}+hK_{n}G(Y_{n},P_{n}),\quad 1\leq n\leq N,\] (23) \[y_{h}(T) = (w^{\mathsf{T}}\otimes I)Y_{N},\] (24) \[p_{h}(0) = (v^{\mathsf{T}}\otimes I)P_{0},\] (25) \[A_{n}^{\mathsf{T}}P_{n} = B_{n+1}^{\mathsf{T}}P_{n+1}-h\[PERSON](Y_{n},K_{n}^{\mathsf{T}}P_{n}), \ 0\leq n\leq N-1,\] (26) \[A_{N}^{\mathsf{T}}P_{N} = w\otimes p_{h}(T)-h\[PERSON](Y_{N},K_{N}^{\mathsf{T}}P_{N}),\ n=N. \tag{27}\]  
Here, the value of \(p_{h}(0)\) is determined by an interpolant \(p_{h}(0)=(v^{\mathsf{T}}\otimes I)P_{0}\approx p(0)\) with \(v\in\mathbb{R}^{s}\) of appropriate order. In a next step, these discrete equations are now treatedas a discretization of the two-point boundary value problem (18) and (19). We will derive order conditions and give bounds for the global error.