PROPT Grusins Metric
From TomWiki
Jump to navigationJump to search
This page is part of the PROPT Manual. See PROPT Manual. |
A Short Introduction to Optimal Control, Ugo Boscain, SISSA, Italy
3.4 A Detailed Application: the Grusin's Metric
Problem Description
Find u over t in [0; 1 ] to minimize:
subject to:
% Copyright (c) 2007-2008 by Tomlab Optimization Inc.
Problem setup
toms t
p = tomPhase('p', t, 0, 1, 60);
setPhase(p);
tomStates x1 x2
tomControls u1 u2
% Boundary constraints
cbnd = {initial({x1 == 0; x2 == 0})
final({x1 == -0.01; x2 == -1})};
% ODEs and path constraints
ceq = collocate({dot(x1) == u1
dot(x2) == u2.*x1});
% Objective
objective = integrate(u1.^2+u2.^2);
Solve the problem
options = struct;
options.name = 'Grusins Metric';
solution = ezsolve(objective, {cbnd, ceq}, [], options);
t = subs(collocate(t),solution);
x1 = subs(collocate(x1),solution);
x2 = subs(collocate(x2),solution);
u1 = subs(collocate(u1),solution);
u2 = subs(collocate(u2),solution);
Problem type appears to be: qpcon Time for symbolic processing: 0.10028 seconds Starting numeric solver ===== * * * =================================================================== * * * TOMLAB - TOMLAB Development license 999007. Valid to 2011-12-31 ===================================================================================== Problem: --- 1: Grusins Metric f_k 6.233154129250785900 sum(|constr|) 0.000000060262669206 f(x_k) + sum(|constr|) 6.233154189513455500 f(x_0) 0.000000000000000000 Solver: snopt. EXIT=0. INFORM=1. SNOPT 7.2-5 NLP code Optimality conditions satisfied FuncEv 1 ConstrEv 45 ConJacEv 45 Iter 38 MinorIter 269 CPU time: 0.249602 sec. Elapsed time: 0.255000 sec.
Plot result
subplot(2,1,1)
plot(x1,x2,'*-');
legend('x1 vs x2');
title('Grusins Metric state variables');
subplot(2,1,2)
plot(t,u1,'+-',t,u2,'+-');
legend('u1','u2');
title('Grusins Metric control');