Formulating an optimal control problem in ICLOCS2 is straight-forward, and this guide will assist you in setting up the problem correctly and efficiently.
A general purpose optimal control problem can be formulated in the following Bolza form
and can be directly implement in ICLOCS2 through the following procedures.
First we define the time variables with
for the initial time and
for the final time. If the upper bound and the lower bounds are the same, then the final time can be fixed. Otherwise it is a variable terminal time problem.
For state variables, we need to provide the initial conditions
and bounds on intial conditions
Again, the initial states can be fixed by setting upper and lower bounds the same.
Furthermore, we can to specify the bounds on the state variables
as well as bounds on the rate of change of state variables (optional)
For unbounded variables, -inf and inf may be used accordingly.
In ICLOCS2, we allow the user to specify the level of accuracy required for each variable. Here the bounds on the absolute local (discretization) error of state variables can be specified
together with the tolerances for state and state rate variable box constraint violations
Next is to define the terminal state bounds
It is also recommend to give an initial guess of the state values at various times along the trajectory in the following form
Firstly, it is possible to define the number of control actions. By default, the number of control actions is in correspondence with the number of integration intervals, with
Then smilarly, we need to define simple bounds. for input variables
bounds on the first control action.
and bounds on the rate of change. for control variables (optional)
Furthermore, we need tolerance for control variable and input rate box constraint violation
as well as an initial guess of the input trajectory (optional but recommended)
We need to specify the bounds for the path constraint function
and path constraint violation tolerances
For additional boundary constraints (in addition to simple bounds on variables), we will define the bounds of the boundary constraint function here.
We may store the necessary problem parameters used in the functions in the following form
and give reference to the plant model if Adigator is used to supply the derivative information
Now we can start to define the sub-functions.
First, the Lagrange (stage) cost can be defined in L_unscaled(x,u,p,t,data) as
and the Mayer (boundary) cost in sub-function E_unscaled(x0,xf,u0,uf,p,t0,tf,data) as
We then can specify the system dynamics in sub-function f_unscaled(x,u,p,t,data) with
Any path constraints need to be specified in sub-function g_unscaled(x,u,p,t,data) with
Any boundary constraints that are not formulated as variable simple bounds need to be specified in sub-function b_unscaled(x0,xf,u0,uf,p,t0,tf,vdat,varargin) . The user should only modify the follwing sections of codes
This conclude the process of formulating an optimal control problem in ICLOCS2.