Singular Arc Problem

Problem 3: Miser3 manual

Contents

Problem Formulation

Find u(t) over t in [0; tf ] to minimize

$$ J = t_f $$

subject to:

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

$$ \frac{dx_2}{dt} = cos(x_1) $$

$$ \frac{dx_3}{dt} = sin(x_1) $$

$$ x_2(t_f) = x_3(t_f) = 0 $$

$$ |u| <= 2 $$

$$ x(0) = [\frac{pi}{2} \ 4 \ 0] $$

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

Problem setup

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

tomStates x1 x2 x3
tomControls u

% Initial guess
x0 = {tf == 20
    icollocate({
    x1 == pi/2+pi/2*t/tf
    x2 == 4-4*t/tf; x3 == 0})
    collocate(u == 0)};

% Box constraints
cbox = {2 <= tf <= 1000
    -2 <= collocate(u) <= 2};

% Boundary constraints
cbnd = {initial({x1 == pi/2; x2 == 4; x3 == 0})
    final({x2 == 0; x3 == 0})};

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

% Objective
objective = tf;

Solve the problem

options = struct;
options.name = 'Singular Arc';
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);
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 Arc                   f_k       4.321198529553176300
                                       sum(|constr|)      0.000000875552660889
                              f(x_k) + sum(|constr|)      4.321199405105836900
                                              f(x_0)     20.000000000000000000

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

FuncEv    1 ConstrEv   60 ConJacEv   60 Iter   56 MinorIter  297
CPU time: 0.906250 sec. Elapsed time: 0.922000 sec. 

Plot result

subplot(2,1,1)
plot(t,x1,'*-',t,x2,'*-',t,x3,'*-');
legend('x1','x2','x3');
title('Singular Arc state variables');

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