PROPT LQR Problem: Difference between revisions
From TomWiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
<math> J = \int_0^{1} (0.625*x^2 + 0.5*x*u +0.5*u^2) \mathrm{d}t </math> | <math> J = \int_0^{1} (0.625*x^2 + 0.5*x*u +0.5*u^2) \mathrm{d}t </math> | ||
subject to: | subject to: | ||
<math> \frac{dx}{dt} = \frac{1}{2}*x + u </math> | <math> \frac{dx}{dt} = \frac{1}{2}*x + u </math> | ||
<math> x(0) = 1 </math> | <math> x(0) = 1 </math> | ||
<source lang="matlab"> | <source lang="matlab"> |
Revision as of 08:09, 9 November 2011
This page is part of the PROPT Manual. See PROPT Manual. |
Problem: LQR: RIOTS 95 Manual
Problem Description
Find u(t) over t in [0; 1 ] to minimize
subject to:
% Copyright (c) 2007-2008 by Tomlab Optimization Inc.
Problem setup
toms t
p = tomPhase('p', t, 0, 1, 20);
setPhase(p);
tomStates x
tomControls u
% Initial guess
x0 = icollocate(x == 1-t);
% ODEs and constraints
ceq = {collocate(dot(x) == 0.5*x+u)
initial(x == 1)};
% Objective
objective = integrate(0.625*x.^2+0.5*x.*u+0.5*u.^2);
Solve the problem
options = struct;
options.name = 'LQR Problem';
solution = ezsolve(objective, ceq, x0, options);
t = subs(collocate(t),solution);
x = subs(collocate(x),solution);
u = subs(collocate(u),solution);
Problem type appears to be: qp Time for symbolic processing: 0.053812 seconds Starting numeric solver ===== * * * =================================================================== * * * TOMLAB - TOMLAB Development license 999007. Valid to 2011-12-31 ===================================================================================== Problem: 1: LQR Problem f_k 0.380797077977355130 sum(|constr|) 0.000000000050276185 f(x_k) + sum(|constr|) 0.380797078027631300 f(x_0) 0.000000000000000000 Solver: CPLEX. EXIT=0. INFORM=1. CPLEX Barrier QP solver Optimal solution found FuncEv 3 GradEv 3 ConstrEv 3 Iter 3 Elapsed time: 0.003000 sec.
Plot result
subplot(2,1,1)
plot(t,x,'*-');
legend('x');
title('LQR Problem state variable');
subplot(2,1,2)
plot(t,u,'+-');
legend('u');
title('LQR Problem control');