Singular Control 3

ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS

10.2.3 Example 3

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

Contents

Problem Formulation

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

$$ J = x_3(t_F) $$

subject to:

$$ \frac{dx_1}{dt} = x_2 $$

$$ \frac{dx_2}{dt} = u $$

$$ \frac{dx_3}{dt} = x_1^2 + x_2^2 $$

The initial condition are:

$$ x(0) = [0 \ 1 \ 0] $$

$$ -1 <= u <= 1 $$

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

Problem setup

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

tomStates x1 x2 x3
tomControls u

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

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

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

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

% Objective
objective = final(x3);

Solve the problem

options = struct;
options.name = 'Singular Control 3';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t = subs(collocate(t),solution);
u = subs(collocate(u),solution);
Problem type appears to be: lpcon
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Singular Control 3             f_k       0.753994561590093370
                                       sum(|constr|)      0.000000015979323829
                              f(x_k) + sum(|constr|)      0.753994577569417230
                                              f(x_0)      0.000000000000000000

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

FuncEv    1 ConstrEv   43 ConJacEv   43 Iter   34 MinorIter  327
CPU time: 0.609375 sec. Elapsed time: 0.610000 sec. 

Plot result

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