PROPT Simple Bang Bang Problem: Difference between revisions
From TomWiki
Jump to navigationJump to search
(Created page with "{{Part Of Manual|title=the PROPT Manual|link=PROPT Manual}} Function Space Complementarity Methods for Optimal Control Problems, Dissertation, Martin Weiser ==Problem...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 8: | Line 8: | ||
<math> J = \int_{-\frac{1}{2}}^{\frac{1}{2}} t*u \mathrm{d}t </math> | <math> J = \int_{-\frac{1}{2}}^{\frac{1}{2}} t*u \mathrm{d}t </math> | ||
subject to: | subject to: | ||
<math> |u| <= 1 </math> | <math> |u| <= 1 </math> | ||
<source lang="matlab"> | <source lang="matlab"> | ||
Line 82: | Line 84: | ||
[[File:simpleBangBang_01.png]] | [[File:simpleBangBang_01.png]] | ||
[[Category:PROPT Examples]] |
Latest revision as of 05:29, 14 February 2012
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]);