The problem was originally presented by .
Consider the orbit transfer problem illustrated below
The objective is find the optimal control profile such that radius of the final orbit is maximized:
With scaling and nondimensionalization (e.g. using Astronomical unit), system dynamics can be expressed as
Additionally, we have path constraint,
simple bounds on variables,
and boundary conditions
We require the numerical solution to fulfill the following accuracy criteria
We can specify the system dynamics in function OrbitRaising_Dynamics_Internal with
For this example problem, we have one equality path constraints, so function OrbitRaising_Dynamics_Internal need to return the value of variable dx and g_eq .
Similarly, the (optional) simulation dynamics can be specifed in function OrbitRaising_Dynamics_Sim.m .
First we provide the function handles for system dynamics with
The optional files providing analytic derivatives can be left empty as we use finite difference this time
and finally the function handle for the settings file is given as.
Then we may define the time variables with
For state variables, we need to provide the initial conditions
bounds on intial conditions
bounds on the absolute local and global (integrated) discretization error of state variables
tolerance for state variable box constraint violation
terminal state bounds
and an initial guess of the state trajectory (optional but recommended)
Lastly for control variables, we need to define simple bounds
bounds on the first control action
tolerance for control variable box constraint violation
as well as an initial guess of the input trajectory (optional but recommended)
We need to specify the bounds for the constraint functions . We have one equality path constraint
but do not have any inequality path constraint
Additionally, we have two boundary constraint functions
We may store the necessary problem parameters used in the functions
Since this problem only has a Mayer (boundary) cost , and no Lagrange (stage) cost ,we simply have
for sub-function E_unscaled and L_unscaled respectively.
For this example problem, we do have two boundary constraints (in addition to varialbe simple bounds). Thus we need to specify sub-routines b_unscaled as
Now we can fetch the problem and options, solve the resultant NLP, and generate some plots for the solution.
Note the last line of code will generate an open-loop simulation, applying the obtained input trajectory to the dynamics defined in WindshearGoAround_Dynamics_Sim.m , using the Matlab builtin ode113 ODE solver with a step size of 0.01.
Using the Hermite-Simpson discretization scheme of ICLOCS2, the following state and input trajectories are obtained under a mesh refinement scheme starting with 40 mesh points. The computation time with IPOPT (NLP convergence tol set to 1e-09) is about 12 seconds for 2 mesh refinement iterations together, using finite difference derivative calculations on an Intel i7-6700 desktop computer. Subsequent recomputation using the same mesh and warm starting will take on average 0.5 seconds and about 20 iterations.
Converting the nondimensionalized time variable back yield
which is equivalent to a journey time of approximately 193 days.
Optimal control problems that are mathematically equivalent may yield different results in compuatational efficiency. Here we demonstrate the benefit of using an alternative formulation of the same orbit raising problem. Instead of using the two elements of the direction vector as control input, we can reformulate the problem that directly uses the directional angle as control inputs. In this way, we can reduce the number of states and inputs by 1 each, and also eliminate the need of one equality path constraint. In addition, faster computations can be obtainable using analytic derivatives infomation rather than finite difference computations.
As the result, using the same Hermite-Simpson discretization with the same 40 mesh points at start, the following state and input trajectories are obtained after refining the mesh 2 time as well. The computation time with IPOPT (NLP convergence tol set to 1e-09) is now reduced to just 1.4 seconds . Subsequent recomputation using the same mesh and warm starting will take on average 0.3 seconds and less than 20 iterations.
 A.E. Bryson, and Y.C. Ho, Applied Optimal Control, Hemisphere Publishing, New York, 1975.