ODE Fitting Using Fast Representation
Keywords: ode fitting using fast representation purpose objective function range indices i(k0) domain j(k0) initial condition trapezoidal approximation source

| Prev | Next |  |  |  |  |  |  |

ODE Fitting Using Fast Representation
Purpose
In this section we represent a more complex representation of the simultaneous forward and reverse ODE fitting problem (described above). The representation defines the problem using simpler functions that are faster to differentiate (either by hand coding or by using AD).
Objective Function
We use the following representation for the objective function : For k = 0 , … , Nz - 1 , we define the function r k : R Ny + Na → R by fg 0 ( x ) = ∑ i = 1 Nz H i ( y S ( i ) , a ) fg 0 ( x ) = ∑ k = 0 Nz -1 r k ( u k , 0 ) where for k = 0 , … , Nz -1 , u k , 0 ∈ R Ny + Na is defined by u k , 0 = ( y S ( k + 1 ) , a )
Range Indices I(k,0)
For k = 0 , … , Nz - 1 , the range index in the vector fg ( x ) corresponding to r k ( u k , 0 ) is 0. Thus, the range indices are given by I ( k , 0 ) = { 0 } for k = 0 , … , Nz -1 .
Domain Indices J(k,0)
For k = 0 , … , Nz - 1 , the components of the vector x corresponding to the vector u k , 0 are u k , 0 = ( y S ( k + 1 , a ) = ( x Ny * S ( k + 1 ) , … , x Ny * S ( k + 1 ) + Ny - 1 , x Ny * S ( Nz ) + Ny , … , x Ny * S ( Nz ) + Ny + Na - 1 ) Thus, the domain indices are given by J ( k , 0 ) = { Ny * S ( k + 1 ) , … , Ny * S ( k + 1 ) + Ny - 1 , Ny * S ( Nz ) + Ny , … , Ny * S ( Nz ) + Ny + Na - 1 }
Initial Condition
We use the following representation for the initial condition constraint : For k = Nz we define the function r k : R Ny × R Na + Ny by 0 = fg i ( x ) = y i 0 - F i ( a ) 0 = r i -1 k ( u k , 0 ) = y i 0 - F i ( a ) where i = 1 , … , Ny and where u k , 0 ∈ R Ny + Na is defined by u k , 0 = ( y 0 , a ) .
Range Indices I(k,0)
For k = Nz , the range index in the vector fg ( x ) corresponding to r k ( u k , 0 ) are I ( k , 0 ) = { 1 , … , Ny } .
Domain Indices J(k,0)
For k = Nz , the components of the vector x corresponding to the vector u k , 0 are u k , 0 = ( y 0 , a ) = ( x 0 , … , x Ny -1 , x Ny * S ( Nz ) + Ny , … , x Ny * S ( Nz ) + Ny + Na - 1 ) Thus, the domain indices are given by J ( k , 0 ) = { 0 , … , Ny - 1 , Ny * S ( Nz ) + Ny , … , Ny * S ( Nz ) + Ny + Na - 1 }
Trapezoidal Approximation
We use the following representation for the trapezoidal approximation constraint : For k = 1 , … , Nz , we define the function r Nz + k : R 2 * Ny + Na → R Ny by r Nz + k ( y , w , a ) = y - w - [ G ( y , a ) + G ( w , a ) ] * Δ t k 2 For ℓ = 0 , … , N ( k ) -1 , using the notation i = Ny * S ( k -1 ) + ℓ + 1 , the corresponding trapezoidal approximation is represented by 0 = fg Ny + i ( x ) = y i - y i -1 - [G ( y i , a ) + G ( y i -1 , a ) ] * Δ t k 2 = r Nz + k ( u Nz + k , ℓ ) where u Nz + k , ℓ ∈ R 2 * Ny + Na is defined by u Nz + k , ℓ = ( y i -1 , y i , a ) .
Range Indices I(k,0)
For k = Nz + 1 , … , 2 * Nz , and ℓ = 0 , … , N ( k ) -1 , the range index in the vector fg ( x ) corresponding to r k ( u k , ℓ ) are I ( k , ℓ ) = { Ny + i , … , 2 * Ny + i - 1 } where i = Ny * S ( k -1 ) + ℓ + 1 .
Domain Indices J(k,0)
For k = Nz + 1 , … , 2 * Nz , and ℓ = 0 , … , N ( k ) -1 , define i = Ny * S ( k -1 ) + ℓ + 1 . The components of the vector x corresponding to the vector u k , ℓ are (and the function fg ( x ) in cppad_ipopt_nlp ) u k , ℓ = ( y i -1 , y i , a ) = ( x Ny * ( i -1 ) , … , x Ny * ( i + 1 ) - 1 , x Ny * S ( Nz ) + Ny , … , x Ny * S ( Nz ) + Ny + Na - 1 ) Thus, the domain indices are given by J ( k , ℓ ) = { Ny * ( i -1 ) , … , Ny * ( i + 1 ) - 1 , Ny * S ( Nz ) + Ny , … , Ny * S ( Nz ) + Ny + Na - 1 }
Source
The file ipopt_nlp_ode_fast.hpp contains source code for this representation of the objective and constraints.

Input File: cppad_ipopt/example/ode2.omh