Initial Value Problem
On some linear-quadratic optimal control problems for descriptor systems. Galina Kurina, Department of Mathematics, Stockholm University, Sweden.
2.5 Necessary control optimality conditions is not valid in general case.
Contents
Problem Description
Find u over t in [0; 1 ] to minimize:
subject to:
% Copyright (c) 2007-2008 by Tomlab Optimization Inc.
Problem setup
toms t1 p1 = tomPhase('p1', t1, 0, 0.5, 20); setPhase(p1); tomStates x1p1 x2p1 tomControls x3p1 up1 % Initial guess x01 = {icollocate({x1p1 == 0; x2p1 == 0}) collocate({x3p1 == 0; up1 == 0})}; % Boundary constraints cbnd1 = initial({x1p1 == 5; x2p1 == 0}); % ODEs and path constraints ceq1 = collocate({ dot(x1p1) == x3p1+up1 dot(x2p1) == x2p1-x3p1+up1 dot(x2p1) == 0}); % Objective objective1 = 0.5*final(x1p1)^2+0.5*integrate(up1.^2); toms t2 p2 = tomPhase('p2', t2, 0.5, 0.5, 20); setPhase(p2); tomStates x1p2 x2p2 tomControls x3p2 up2 % Initial guess x02 = {icollocate({x1p2 == 0; x2p2 == 0}) collocate({x3p2 == 0; up2 == 0})}; % ODEs and path constraints ceq2 = collocate({ dot(x1p2) == x3p2+up2 dot(x2p2) == x2p2-x3p2+up2 dot(x2p2) == 0}); % Objective objective2 = 0.5*final(x1p2)^2+0.5*integrate(up2.^2); objective = objective1 + objective2; % Link phase link = {final(p1,x1p1) == initial(p2,x1p2) final(p1,x2p1) == initial(p2,x2p2) final(p1,x3p1) == initial(p2,x3p2)};
Solve the problem
options = struct; options.name = 'Initial Value Problem'; options.solver = 'snopt'; constr = {cbnd1, ceq1, ceq2, link}; solution = ezsolve(objective, constr, {x01, x02}, options);
Problem type appears to be: qp ===== * * * =================================================================== * * * TOMLAB - Tomlab Optimization Inc. Development license 999001. Valid to 2010-02-05 ===================================================================================== Problem: 1: Initial Value Problem f_k 4.550747663987698000 sum(|constr|) 0.000000000641877076 f(x_k) + sum(|constr|) 4.550747664629574800 f(x_0) 12.499999999999893000 Solver: snopt. EXIT=0. INFORM=1. SNOPT 7.2-5 NLP code Optimality conditions satisfied FuncEv 1 Iter 23 MinorIter 121 CPU time: 0.015625 sec. Elapsed time: 0.016000 sec.
Plot result
subplot(3,1,1) t = [subs(collocate(p1,t1),solution);subs(collocate(p2,t2),solution)]; x1 = [subs(collocate(p1,x1p1),solution);subs(collocate(p2,x1p2),solution)]; x2 = [subs(collocate(p1,x2p1),solution);subs(collocate(p2,x2p2),solution)]; u = [subs(collocate(p1,up1),solution);subs(collocate(p2,up2),solution)]; plot(t,x1,'*-',t,x2,'*-'); legend('x1','x2'); title('Initial Value Problem state variables'); subplot(3,1,2) plot(t,u,'+-'); legend('u'); title('Initial Value Problem control'); subplot(3,1,3) plot(t,-8/11*5*(t<0.5)-2/11*5*(t>=0.5),'*-'); legend('Known u'); title('Initial Value Problem known solution');