PROPT Singular Arc Problem: Difference between revisions
From TomWiki
Jump to navigationJump to search
(Created page with "{{Part Of Manual|title=the PROPT Manual|link=PROPT Manual}} Problem 3: Miser3 manual ==Problem Formulation== Find u(t) over t in [0; t_f ] to minimize <math> J = t_...") |
No edit summary |
||
Line 8: | Line 8: | ||
<math> J = t_f </math> | <math> J = t_f </math> | ||
subject to: | subject to: | ||
<math> \frac{dx_1}{dt} = u </math> | <math> \frac{dx_1}{dt} = u </math> | ||
<math> \frac{dx_2}{dt} = cos(x_1) </math> | <math> \frac{dx_2}{dt} = cos(x_1) </math> | ||
<math> \frac{dx_3}{dt} = sin(x_1) </math> | <math> \frac{dx_3}{dt} = sin(x_1) </math> | ||
<math> x_2(t_f) = x_3(t_f) = 0 </math> | <math> x_2(t_f) = x_3(t_f) = 0 </math> | ||
<math> |u| <= 2 </math> | <math> |u| <= 2 </math> | ||
<math> x(0) = [\frac{pi}{2} \ 4 \ 0] </math> | <math> x(0) = [\frac{pi}{2} \ 4 \ 0] </math> | ||
<source lang="matlab"> | <source lang="matlab"> |
Revision as of 08:12, 9 November 2011
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');