PROPT Singular Control 4

From TomWiki
Revision as of 05:28, 14 February 2012 by Per (talk | contribs) (→‎Plot result)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Notice.png

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

ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS

10.2.3 Example 4

CHAPMAN & HALL/CRC Monographs and Surveys in Pure and Applied Mathematics

Problem Formulation

Find u over t in [0; 5 ] to minimize


subject to:


The initial condition are:


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

Problem setup

toms t
p = tomPhase('p', t, 0, 5, 100);
setPhase(p)

tomStates x1 x2 x3 x4
tomControls u

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

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

% Boundary constraints
cbnd = initial({x1 == 1; x2 == 0
    x3 == 0; x4 == 0});

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

% Objective
objective = final(x4);

Solve the problem

options = struct;
options.name = 'Singular Control 4';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t = subs(collocate(t),solution);
u = subs(collocate(u),solution);
Problem type appears to be: lpcon
Time for symbolic processing: 0.089315 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Singular Control 4             f_k       1.252389645383044100
                                       sum(|constr|)      0.000000063932037643
                              f(x_k) + sum(|constr|)      1.252389709315081800
                                              f(x_0)      0.000000000000000000

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

FuncEv    1 ConstrEv   92 ConJacEv   92 Iter   89 MinorIter  652
CPU time: 9.313260 sec. Elapsed time: 2.553000 sec. 

Plot result

figure(1)
plot(t,u,'+-');
legend('u');
title('Singular Control 4 control');

SingularControl4 01.png