PROPT Singular Arc Problem
From TomWiki
Jump to navigationJump to search
This page is part of the PROPT Manual. See PROPT Manual. |
Problem 3: Miser3 manual
Problem Formulation
Find u(t) over t in [0; t_f ] to minimize
subject to:
% Copyright (c) 2007-2008 by Tomlab Optimization Inc.
Problem setup
toms t
toms t_f
p = tomPhase('p', t, 0, t_f, 60);
setPhase(p);
tomStates x1 x2 x3
tomControls u
% Initial guess
x0 = {t_f == 20
icollocate({
x1 == pi/2+pi/2*t/t_f
x2 == 4-4*t/t_f; x3 == 0})
collocate(u == 0)};
% Box constraints
cbox = {2 <= t_f <= 1000
-2 <= collocate(u) <= 2};
% Boundary constraints
cbnd = {initial({x1 == pi/2; x2 == 4; x3 == 0})
final({x2 == 0; x3 == 0})};
% ODEs and path constraints
ceq = collocate({dot(x1) == u
dot(x2) == cos(x1); dot(x3) == sin(x1)});
% Objective
objective = t_f;
Solve the problem
options = struct;
options.name = 'Singular Arc';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t = subs(collocate(t),solution);
x1 = subs(collocate(x1),solution);
x2 = subs(collocate(x2),solution);
x3 = subs(collocate(x3),solution);
u = subs(collocate(u),solution);
Problem type appears to be: lpcon Time for symbolic processing: 0.1042 seconds Starting numeric solver ===== * * * =================================================================== * * * TOMLAB - TOMLAB Development license 999007. Valid to 2011-12-31 ===================================================================================== Problem: --- 1: Singular Arc f_k 4.321198387073171600 sum(|constr|) 0.000000179336713690 f(x_k) + sum(|constr|) 4.321198566409885100 f(x_0) 20.000000000000000000 Solver: snopt. EXIT=0. INFORM=1. SNOPT 7.2-5 NLP code Optimality conditions satisfied FuncEv 1 ConstrEv 77 ConJacEv 77 Iter 70 MinorIter 377 CPU time: 0.483603 sec. Elapsed time: 0.473000 sec.
Plot result
subplot(2,1,1)
plot(t,x1,'*-',t,x2,'*-',t,x3,'*-');
legend('x1','x2','x3');
title('Singular Arc state variables');
subplot(2,1,2)
plot(t,u,'+-');
legend('u');
title('Singular Arc control');