Quadruple Integral

ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS

12.4.5 Example 5

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

Contents

Problem Formulation

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

$$ J = t_F $$

subject to:

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

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

$$ \frac{dx_3}{dt} = x_4 $$

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

The initial condition are:

$$ x(0)  = [0.1 \ 0.2 \ 0.3 \ 0] $$

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

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

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

Problem setup

toms t
toms tf
p = tomPhase('p', t, 0, tf, 30);
setPhase(p);

tomStates x1 x2 x3 x4
tomControls u

% Initial guess
x0 = {tf == 5
    icollocate({x1 == 0.1-0.1*t/tf
    x2 == 0.2-0.2*t/tf; x3 == 0.3-0.3*t/tf})
    collocate(u == -1)};

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

% Boundary constraints
cbnd = {initial({x1 == 0.1; x2 == 0.2; x3 == 0.3; x4 == 0})
    final({x1 == 0; x2 == 0; x3 == 0; x4 == 0})};

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

% Objective
objective = tf;

Solve the problem

options = struct;
options.name = 'Quadruple Integral';
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);
x4 = subs(collocate(x4),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: Quadruple Integral             f_k       4.849598187860811600
                                       sum(|constr|)      0.000000001395818289
                              f(x_k) + sum(|constr|)      4.849598189256630200
                                              f(x_0)      5.000000000000000000

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

FuncEv    1 ConstrEv   46 ConJacEv   46 Iter   22 MinorIter  262
CPU time: 0.171875 sec. Elapsed time: 0.172000 sec. 

Plot result

subplot(2,1,1)
plot(t,x1,'*-',t,x2,'*-',t,x3,'*-',t,x4,'*-');
legend('x1','x2','x3','x4');
title('Quadruple Integral state variables');

subplot(2,1,2)
plot(t,u,'+-');
legend('u');
title('Quadruple Integral control');