PROPT Quadratic constraint problem: Difference between revisions

From TomWiki
Jump to navigationJump to search
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 14: Line 14:


<math> J = 0.5*x_1(1)^2 + 0.5*\int_0^1 (x_1^2 + u_1^2 + u_2^2) \mathrm{d}t </math>
<math> J = 0.5*x_1(1)^2 + 0.5*\int_0^1 (x_1^2 + u_1^2 + u_2^2) \mathrm{d}t </math>


subject to:
subject to:


<math> \frac{dx_1}{dt} = 3*x_1+x_2 + u_1 </math>
<math> \frac{dx_1}{dt} = 3*x_1+x_2 + u_1 </math>
<math> \frac{dx_2}{dt} = -x_1+2*x_2 + u_2 </math>
<math> \frac{dx_2}{dt} = -x_1+2*x_2 + u_2 </math>
<math> x_1(0) = 4 </math>
<math> x_1(0) = 4 </math>
<math> x_2(0) = -4 </math>
<math> x_2(0) = -4 </math>
<math> 0.5*x_2(1)^2 + 0.5*\int_0^1 (x_1^2 + u_1^2 + u_2^2) <= 80 </math>
<math> 0.5*x_2(1)^2 + 0.5*\int_0^1 (x_1^2 + u_1^2 + u_2^2) <= 80 </math>


Introduce a new variable to remove integral in constraint:
Introduce a new variable to remove integral in constraint:


<math> \frac{dx_3}{dt} = 0.5 * (x_1.^2 + u_1.^2 + u_2.^2) </math>
<math> \frac{dx_3}{dt} = 0.5 * (x_1.^2 + u_1.^2 + u_2.^2) </math>


resulting in event constraint:
resulting in event constraint:


<math> 0.5*x_2(1)^2 + x_3(1) <= 8 </math>
<math> 0.5*x_2(1)^2 + x_3(1) <= 8 </math>


<source lang="matlab">
<source lang="matlab">
Line 91: Line 99:
<pre>
<pre>
Problem type appears to be: qpcon
Problem type appears to be: qpcon
Time for symbolic processing: 0.15617 seconds
Time for symbolic processing: 0.12268 seconds
Starting numeric solver
Starting numeric solver
===== * * * =================================================================== * * *
===== * * * =================================================================== * * *
Line 106: Line 114:


FuncEv    1 ConstrEv  32 ConJacEv  32 Iter  31 MinorIter  279
FuncEv    1 ConstrEv  32 ConJacEv  32 Iter  31 MinorIter  279
CPU time: 0.234001 sec. Elapsed time: 0.231000 sec.  
CPU time: 0.218401 sec. Elapsed time: 0.217000 sec.  


</pre>
</pre>
Line 125: Line 133:


[[File:quadraticConstraint_01.png]]
[[File:quadraticConstraint_01.png]]
[[Category:PROPT Examples]]

Latest revision as of 05:31, 14 February 2012

Notice.png

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

Paper: LINEAR-QUADRATIC OPTIMAL CONTROL WITH INTEGRAL QUADRATIC CONSTRAINTS. OPTIMAL CONTROL APPLICATIONS AND METHODS Optim. Control Appl. Meth., 20, 79-92 (1999)

E. B. LIM(1), Y. Q. LIU(2), K. L. TEO(2) AND J. B. MOORE(1)

(1) Department of Systems Engineering, Research School of Information Sciences and Engineering, Australian National University, Canberra ACT 0200, Australia

(2) School of Mathematics and Statistics, Curtin University of Technology, Perth, WA 6845, Australia

Problem Formulation

Find u(t) over t in [0; 1 ] to minimize


subject to:


Introduce a new variable to remove integral in constraint:


resulting in event constraint:


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

Problem setup

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

tomStates x1 x2 x3
tomControls u1 u2

% Initial guess
x0 = {icollocate({
    x1 == 4-5*t
    x2 == -4-1*t
    x3 == 50*t
    })
    collocate({
    u1 == -10+10*t
    u2 == 14-12*t})};

% Boundary constraints
cbnd = {
    initial({
    x1 == 4
    x2 == -4
    x3 == 0
    })
    final(x2)^2/2+final(x3) <= 80};

% ODEs and path constraints
ceq = collocate({
    dot(x1) == 3*x1+x2 + u1
    dot(x2) == -x1+2*x2 + u2
    dot(x3) == 1/2 * (x2.^2 + u1.^2 + u2.^2)
    });

% Objective
objective = final(x1)^2/2 + final(x3);

Solve the problem

options = struct;
options.name = 'Quadratic Constraint';
solution = ezsolve(objective, {cbnd, ceq}, x0, options);
t  = subs(collocate(t),solution);
x1 = subs(collocate(x1),solution);
x2 = subs(collocate(x2),solution);
x3 = subs(collocate(x3),solution);
u1 = subs(collocate(u1),solution);
u2 = subs(collocate(u2),solution);
Problem type appears to be: qpcon
Time for symbolic processing: 0.12268 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Quadratic Constraint           f_k      67.888740121887480000
                                       sum(|constr|)      0.000000192408232753
                              f(x_k) + sum(|constr|)     67.888740314295717000
                                              f(x_0)     50.499999999999915000

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

FuncEv    1 ConstrEv   32 ConJacEv   32 Iter   31 MinorIter  279
CPU time: 0.218401 sec. Elapsed time: 0.217000 sec. 

Plot result

subplot(2,1,1)
plot(t,x1,'*-',t,x2,'*-',t,x3/10,'*-');
legend('x1','x2','x3/10');
title('Quadratic Constraint state variables');

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

QuadraticConstraint 01.png