Bryson Denham

Bryson Denham

This problem can be found here.

Packages that will be used

using NLOptControl

Differential Equations

de=[:(x2[j]),:(u1[j])]

Define and Configure the Problem:

n=define!(de;numStates=2,numControls=1,X0=[0.,1],XF=[0.,-1.],XL=[0.,NaN],XU=[1/9,NaN],CL=[NaN],CU=[NaN]);
configure!(n;(:finalTimeDV=>false),(:tf=>1.0));

Objective Function

obj=integrate!(n,n.r.u[:,1];C=0.5,(:variable=>:control),(:integrand=>:squared));
@NLobjective(n.mdl,Min,obj);

Optimize

optimize!(n);

Post Process

using PrettyPlots
allPlots(n)
0.0 0.2 0.4 0.6 0.8 1.0 0.00 0.05 0.10 time (s) x1 max min mpc 0.0 0.2 0.4 0.6 0.8 1.0 -1 0 1 time (s) x2 mpc 0.0 0.2 0.4 0.6 0.8 1.0 -5.0 -2.5 0.0 time (s) u1 mpc