PROPT Bryson-Denham Problem (Short version)

From TomWiki
Jump to navigationJump to search

Notice.png

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

Problem description

The Bryson-Denham Problem but we take advantage of the propt input format to compute the cost function directly, without going via u and x3.

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

Problem setup

toms t t_f
p = tomPhase('p', t, 0, t_f, 30); setPhase(p);
tomStates x1 x2
x1max = 1/9; x0 = {t_f == 0.5};

constr = {0.001 <= t_f <= 50
    collocate({0 <= x1 <= x1max; -10 <= x2 <= 10})
    initial({x1 == 0; x2 == 1}); final({x1 == 0; x2 == -1})
    collocate(dot(x1) == x2)};

options = struct;
options.name = 'Bryson Denham Short';
solution = ezsolve(integrate(0.5*dot(x2).^2), constr, x0, options);
t  = subs(collocate(t),solution);
x1 = subs(collocate(x1),solution); x2 = subs(collocate(x2),solution);
figure(1)
plot(t,x1,'*-',t,x2,'*-');
legend('x1','x2');
title('Bryson Denham Short state variables');
Problem type appears to be: con
Time for symbolic processing: 0.10697 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Bryson Denham Short            f_k       3.975295744664977700
                                       sum(|constr|)      0.000000002213285958
                              f(x_k) + sum(|constr|)      3.975295746878263700
                                              f(x_0)   1859.999999999957700000

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

FuncEv  139 GradEv  137 ConstrEv  137 ConJacEv  137 Iter  136 MinorIter  319
CPU time: 0.093601 sec. Elapsed time: 0.116000 sec. 

BrysonDenhamShort 01.png