PROPT Simple Bang Bang Problem

From TomWiki
Revision as of 08:12, 9 November 2011 by Mbot (talk | contribs)
Jump to navigationJump to search

Notice.png

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

Function Space Complementarity Methods for Optimal Control Problems, Dissertation, Martin Weiser

Problem Description

Find u over t in [-0.5; 0.5 ] to minimize:


subject to:


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

Problem setup

toms t
p = tomPhase('p', t, -0.5, 1, 20);
setPhase(p);
tomStates x
tomControls u

% Initial guess
x0 = {collocate(u == 1-2*(t+0.5))
    icollocate(x == 1-2*(t+0.5))};

% Box constraints
cbox = {-1 <= icollocate(x) <= 1
    -1 <= collocate(u)  <= 1};

% ODEs and path constraints
ceq = collocate(dot(x) == 0);

% Objective
objective = integrate(t.*u);

Solve the problem

options = struct;
options.name = 'Simple Bang Bang Problem';
solution = ezsolve(objective, {cbox, ceq}, x0, options);
t = subs(collocate(t),solution);
u = subs(collocate(u),solution);
Problem type appears to be: lp
Time for symbolic processing: 0.013436 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Simple Bang Bang Problem       f_k      -0.250490325030180820
                                       sum(|constr|)      0.000000000000870996
                              f(x_k) + sum(|constr|)     -0.250490325029309850
                                              f(x_0)      0.000000000000000000

Solver: CPLEX.  EXIT=0.  INFORM=1.
CPLEX Dual Simplex LP solver
Optimal solution found


Elapsed time: 0.002000 sec. 

Plot result

figure(1);
plot(t,u,'*-');
legend('u');
ylim([-1.1,1.1]);

SimpleBangBang 01.png