PROPT Singular Control 6

From TomWiki
Revision as of 08:12, 9 November 2011 by Mbot (talk | contribs)
Jump to navigationJump to search

Notice.png

This page is part of the PROPT Manual. See PROPT Manual.

Viscocity Solutions of Hamilton-Jacobi Equations and Optimal Control Problems. Alberto Bressan, S.I.S.S.A, Trieste, Italy.

A singular control example.

Problem Description

Find u over t in [0; 10 ] to maximize:


subject to:


% Copyright (c) 2007-2008 by Tomlab Optimization Inc.

Problem setup

toms t
t_F = 10;
p = tomPhase('p', t, 0, t_F, 80);
setPhase(p);

tomStates x1 x2 x3
tomControls u

x = [x1; x2; x3];

% Initial guess
x0 = {icollocate({x1 == 0, x2 == 0, x3 == 0})
    collocate(u==0)};

% Box constraints
cbox = {-1 <= collocate(u) <= 1};

% Boundary constraints
cbnd = initial(x == [0;0;0]);

% ODEs and path constraints
ceq = collocate({dot(x1) == u; dot(x2) == -x(1)
    dot(x3) == x(2)-x(1).^2});

% Objective
objective = -final(x(3));

Solve the problem

options = struct;
options.name = 'Singular Control 6';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);

% Extract optimal states and controls from solution
t  = collocate(subs(t,solution));
u  = collocate(subs(u,solution));
x1 = collocate(subs(x1,solution));
x2 = collocate(subs(x2,solution));
x3 = collocate(subs(x3,solution));
Problem type appears to be: lpcon
Time for symbolic processing: 0.076014 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Singular Control 6             f_k     -55.555568442322517000
                                       sum(|constr|)      0.000000011402048583
                              f(x_k) + sum(|constr|)    -55.555568430920466000
                                              f(x_0)      0.000000000000000000

Solver: snopt.  EXIT=0.  INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied

FuncEv    1 ConstrEv   58 ConJacEv   58 Iter   49 MinorIter  678
CPU time: 0.733205 sec. Elapsed time: 0.738000 sec. 

Plot result

subplot(3,1,1)
plot(t,x1,'*-',t,x2/10,'*-',t,x3/50,'*-');
legend('x1','x2/10','x3/50');
title('Singular Control 6 state variables');

subplot(3,1,2)
plot(t,u,'+-');
legend('u');
title('Singular Control 6 control');

subplot(3,1,3)
plot(t,-1*(t<t_F/3)+1/2*(t>=t_F/3),'*-');
legend('Known u');
title('Singular Control 6 known solution');

SingularControl6 01.png