Prev Next ipopt_cppad_ode_represent

ipopt_cppad_nlp ODE Problem Representation

Purpose
In this section we represent the objective and constraint functions, (in the simultaneous forward and reverse optimization problem) in terms of much simpler functions that are faster to differentiate (either by hand coding or by using AD).

Trapezoidal Time Grid
The discrete time grid, used for the trapezoidal approximation, is denote by  \{ t_M \}  . For  k = 1 , 2 , 3, 4 , and  \ell = 0 , \ldots , ns , we define  \[
\begin{array}{rcl}
     \Delta_k & = & ( s_k - s_{k-1} ) / ns
     \\
     t_{ (k-1) * ns + \ell } & = &  s_{k-1} + \Delta_k * \ell
\end{array}
\] 
Note that for  M = 1 , \ldots , 4 * ns  ,  y^M denotes our approximation for  y( t_M , a ) ,  t_0 is equal to 0, and  t_{k*ns} is equal to  s_k .

Argument Vector
The argument vector that we are optimizing with respect to (  x in ipopt_cppad_nlp ) has the following structure  \[
     x = \left( \begin{array}{c}
          y^0 \\ \vdots \\ y^{4 * ns} \\ a
     \end{array} \right)
\] 
Note that  x \in \R^{2 *(4 * ns + 1) + 3} and  \[
\begin{array}{rcl}
     y^M & = & ( x_{2 * M} , x_{2 * M + 1} )^\T
     \\
     a   & = & ( x_{8 * ns + 2} , x_{8 * ns + 3} , x_{8 * ns + 4} )^\T
\end{array}
\] 


Objective
The objective function (  fg_0 (x) in ipopt_cppad_nlp ) has the following representation,  \[
     fg_0 (x) 
     = \sum_{k=1}^4 H_k ( y^{k * ns} , a ) 
     = \sum_{k=0}^3 r^k ( u^{k,0} )
\] 
where  r^k = H_{k+1} and  u^{k,0} =   ( y^{k * ns} , a ) for  k = 0, 1, 2, 3 . The range index (in the vector  fg (x) ) corresponding to each term in the objective is 0. The domain components (in the vector  x ) corresponding to the k-th term are  \[
(    x_{2 * k * ns} , 
     x_{2 * k * ns + 1} , 
     x_{8 * ns + 2} , 
     x_{8 * ns + 3} , 
     x_{8 * ns + 4} 

= u^{k,0} 
= ( y_0^{k * ns} , y_1^{k * ns} , a_0, a_1, a_2 ) 
\] 


Initial Condition
We define the function  r^k : \R^2 \times \R^3 \rightarrow \R^2 for  k = 4 by  \[
     r^k ( u ) = r^k ( y , a ) = y - F(a)
\] 
where  u  = ( y , a) . Using this notation, and the function  fg (x) in ipopt_cppad_nlp , the constraint becomes  \[
\begin{array}{rcl}
     fg_1 (x) & = & r_0^4 ( u^{4,0} ) = r_0^4 ( y^0 , a)
     \\
     fg_2 (x) & = & r_1^4 ( u^{4,0} ) = r_1^4 ( y^0 , a)
\end{array}
\] 
The range indices (in the vector  fg (x) ) corresponding to this constraint are  ( 1, 2 ) . The domain components (in the vector  x ) corresponding to this constraint are  \[
(    x_0 , 
     x_1 , 
     x_{8 * ns + 2} , 
     x_{8 * ns + 3} , 
     x_{8 * ns + 4} 

=
u^{4,0}

( y_0^0, y_1^0 , \ldots , y_0^{4*ns}, y_1^{4*ns}, a_0 , a_1 , a_2 ) 
\] 


Trapezoidal Approximation
For  k = 5 , 6, 7 , 8 , and  \ell = 0 , \ldots , ns , define  M = (k - 5) * ns + \ell . The corresponding trapezoidal approximation is represented by the constraint  \[
0 = y^{M+1}  -  y^{M} - 
\left[ G( y^{M} , a ) + G( y^{M+1} , a ) \right] * \frac{\Delta_k }{ 2 }
\] 
For  k = 5, 6, 7, 8 , we define the function  r^k : \R^2 \times \R^2 \times \R^3 \rightarrow \R^2 by  \[
r^k ( y , w , a ) = y - w  [ G( y , a ) + G( w , a ) ] * \frac{ \Delta_k }{ 2 }
\] 
Using this notation, (and the function  fg (x)  in ipopt_cppad_nlp ) the constraint becomes  \[
\begin{array}{rcl}
fg_{2 * M + 3} (x)  & = & r_0 ( u^{k,\ell} ) = r_0^k ( y^M , y^{M+1} , a )
\\
fg_{2 * M + 4} (x)  & = & r_1 ( u^{k,\ell} ) = r_1^k ( y^M , y^{M+1} , a )
\end{array} 
\] 
where  M = (k - 5) * ns * \ell . The range indices (in the vector  fg (x) ) corresponding to this constraint are  ( 2 * M + 3 , 2 * M + 4 ) . The domain components (in the vector  x ) corresponding to this constraint are  \[
(    x_{2 * M} , 
     x_{2 * M + 1} , 
     x_{2 * M + 2} ,
     x_{2 * M + 3} ,
     x_{8 * ns + 2} , 
     x_{8 * ns + 3} , 
     x_{8 * ns + 4} 
)
= u^{k, \ell}
= ( y_0^M, y_1^M , y_0^{M+1} , y_1^{M+1} , a_0 , a_1 , a_2 ) 
\] 

Input File: omh/ipopt_cppad_ode2.omh