Bryson Maxrange

Contents

Problem description

Max range version of Bryson-Denham problem

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

Problem setup

toms t
p = tomPhase('p', t, 0, 2, 50);
setPhase(p);

tomStates x y v
tomControls u1 u2

% Various constants and expressions
xmin = -10; xmax = 10;
ymin = xmin; ymax = xmax;
Vmin = -100; Vmax = 100;
g = 1;
a = 0.5*g;

% Initial guess
x0 = collocate({u1 == 1; u2 == 0});

% Box constraints
cbox = {xmin <= icollocate(x) <= xmax
    ymin <= icollocate(y) <= ymax
    Vmin <= icollocate(v) <= Vmax
    -100 <= collocate(u1) <= 100
    -100 <= collocate(u2) <= 100};

% Boundary constraints
cbnd = {initial({x == 0; y == 0; v == 0})
    final(y == 0.1)};

% ODEs and path constraints
ceq = {collocate({
    dot(x) == v.*u1
    dot(y) == v.*u2
    dot(v) == a-g*u2
    })
    collocate(u1.^2+u2.^2 == 1)};

% Objective
objective = -final(x);

Solve the problem

options = struct;
options.name = 'Bryson MaxRange';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t  = subs(collocate(t),solution);
x  = subs(collocate(x),solution);
y  = subs(collocate(y),solution);
v  = subs(collocate(v),solution);
u1 = subs(collocate(u1),solution);
u2 = subs(collocate(u2),solution);
Problem type appears to be: lpcon
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Bryson MaxRange                f_k      -1.712314875015308500
                                       sum(|constr|)      0.000000100745336446
                              f(x_k) + sum(|constr|)     -1.712314774269972000
                                              f(x_0)      0.000000000000000000

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

FuncEv    1 ConstrEv   55 ConJacEv   55 Iter   34 MinorIter  169
CPU time: 0.500000 sec. Elapsed time: 0.516000 sec. 

Plot result

subplot(2,1,1)
plot(t,x,'*-',t,y,'*-',t,v,'*-');
legend('x','y','v');
title('Bryson MaxRange state variables');

subplot(2,1,2)
plot(t,u1,'+-',t,u2,'+-');
legend('u1','u2');
title('Bryson MaxRange control');