PROPT Quadruple Integral: Difference between revisions

From TomWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 12: Line 12:


<math> J = t_F </math>
<math> J = t_F </math>


subject to:
subject to:


<math> \frac{dx_1}{dt} = x_2 </math>
<math> \frac{dx_1}{dt} = x_2 </math>
<math> \frac{dx_2}{dt} = x_3 </math>
<math> \frac{dx_2}{dt} = x_3 </math>
<math> \frac{dx_3}{dt} = x_4 </math>
<math> \frac{dx_3}{dt} = x_4 </math>
<math> \frac{dx_4}{dt} = u </math>
<math> \frac{dx_4}{dt} = u </math>


The initial condition are:
The initial condition are:


<math> x(0)  = [0.1 \ 0.2 \ 0.3 \ 0] </math>
<math> x(0)  = [0.1 \ 0.2 \ 0.3 \ 0] </math>
<math> x(t_F) = [0 \ 0 \ 0 \ 0] </math>
<math> x(t_F) = [0 \ 0 \ 0 \ 0] </math>
<math> -1 <= u <= 1 </math>
<math> -1 <= u <= 1 </math>


<source lang="matlab">
<source lang="matlab">

Revision as of 08:11, 9 November 2011

Notice.png

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

ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS

12.4.5 Example 5

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

Problem Formulation

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


subject to:


The initial condition are:


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

Problem setup

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

tomStates x1 x2 x3 x4
tomControls u

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

% Box constraints
cbox = {0.1 <= t_f <= 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 = t_f;

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
Time for symbolic processing: 0.12111 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Quadruple Integral             f_k       4.849598187644263100
                                       sum(|constr|)      0.000000078353877264
                              f(x_k) + sum(|constr|)      4.849598265998140300
                                              f(x_0)      5.000000000000000000

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

FuncEv    1 ConstrEv   58 ConJacEv   58 Iter   31 MinorIter  474
CPU time: 0.109201 sec. Elapsed time: 0.090000 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');

QuadrupleIntegral 01.png