PROPT Continuous State Constraint Problem

From TomWiki
Jump to navigationJump to search

Notice.png

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

Problem 2: Miser3 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, 50);
setPhase(p);

tomStates x1 x2
tomControls u

% Initial guess
x0 = {icollocate({x1 == 0; x2 == -1})
    collocate(u==0)};

% Box constraints
cbox = {-10 <= icollocate(x1) <= 10
    -10 <= icollocate(x2) <= 10
    -20 <= collocate(u)  <= 20};

% Boundary constraints
cbnd = initial({x1 == 0; x2 == -1});

% ODEs and path constraints
ceq = collocate({
    dot(x1) == x2
    dot(x2) == -x2+u
    8*(t-0.5).^2-0.5-x2 >= 0 % Path constr.
    });

% Objective
objective = integrate(x1.^2 + x2.^2 + 0.005*u.^2);

Solve the problem

options = struct;
options.name = 'Cont State Constraint';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t  = subs(collocate(t),solution);
x1 = subs(collocate(x1),solution);
x2 = subs(collocate(x2),solution);
u  = subs(collocate(u),solution);
Problem type appears to be: qp
Time for symbolic processing: 0.066489 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem:  1: Cont State Constraint              f_k       0.169824305998485000
                                       sum(|constr|)      0.000000000079762962
                              f(x_k) + sum(|constr|)      0.169824306078247970
                                              f(x_0)      0.000000000000000000

Solver: CPLEX.  EXIT=0.  INFORM=1.
CPLEX Barrier QP solver
Optimal solution found

FuncEv   10 GradEv   10 ConstrEv   10 Iter   10 
Elapsed time: 0.007000 sec. 

Plot result

subplot(3,1,1)
plot(t,x1,'*-',t,x2,'*-');
legend('x1','x2');
title('Cont State Constraint state variables');

subplot(3,1,2)
plot(t,u,'+-');
legend('u');
title('Cont State Constraint control');

subplot(3,1,3)
ieq = 8*(t-0.5).^2-0.5-x2;
plot(t,ieq,'+-');
axis([0 1 0 5]);
legend('path');
title('Cont State Constraint path constraint');

ContStateConstraint 01.png