PROPT Nagurka Problem

From TomWiki
Jump to navigationJump to search

Notice.png

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

ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS

6.4 Further example

CHAPMAN & HALL/CRC Monographs and Surveys in Pure and Applied Mathematics

n'th-order linear time-invariant system.

Problem description

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


subject to:


A = [0 1 0 ... 0
     0 0 1 ... 0
     ... ... ...
     0 0 0 ... 1
     1 -2 3 ... (-1)^(n+1)*n]

The initial condition are:


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

Problem setup

toms t
n  = 6;
t_F = 1;

p = tomPhase('p', t, 0, t_F, 25);
setPhase(p);

x = tomState('x', n, 1);
u = tomState('u', n, 1);

nvec = (1:n);
A = [sparse(n-1,1), speye(n-1); ...
    sparse(nvec.*(-1).^(nvec+1))];

% Initial guess
guess = icollocate(x == nvec');

% Initial conditions
cinit = (initial(x) == nvec');

% ODEs and path constraints
ceq = collocate(dot(x) == A*x+u);

% Objective
objective = 10*final(x(1))^2 + integrate(x'*x + u'*u);

Solve the problem

options = struct;
options.name = 'Nagurka Problem';
solution = ezsolve(objective, {ceq, cinit}, guess, 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.067164 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem:  1: Nagurka Problem                    f_k     109.074347751905190000
                                       sum(|constr|)      0.000000000001514694
                              f(x_k) + sum(|constr|)    109.074347751906710000
                                              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 
CPU time: 0.015600 sec. Elapsed time: 0.007000 sec. 

Plot result

subplot(2,1,1)
x1 = x(:,1);
plot(t,x1,'*-');
legend('x1');
title('Nagurka Problem - First state variable');

subplot(2,1,2)
u1 = u(:,1);
plot(t,u1,'+-');
legend('u1');
title('Nagurka Problem - First control variable');

figure(2)
surf(t, 1:n, x')
xlabel('t'); ylabel('i'); zlabel('x');
title('Nagurka Problem - All state variables');

figure(3)
surf(t, 1:n, u')
xlabel('t'); ylabel('i'); zlabel('u');
title('Nagurka Problem - All control variables');

NagurkaProblem 01.png

NagurkaProblem 02.png

NagurkaProblem 03.png