# Time Delay 2

ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS

8.3.2 Example 2

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

Linear time-delay system considered by Palanisamy et al.

## Problem Formulation

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

subject to:

The initial condition are:

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


## Problem setup

toms t
p1 = tomPhase('p1', t, 0, 2, 50);
setPhase(p1);

tomStates x1 x2
tomControls u

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

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

% Expression for x1(t-tau)
tau = 1;
x1delayed = ifThenElse(t<tau, 1, subs(x1,t,t-tau));

% ODEs and path constraints
ceq = collocate({
dot(x1) == t.*x1 + x1delayed + u
dot(x2) == x1.^2 + u.^2});

% Objective
objective = final(x2);


## Solve the problem

options = struct;
options.name = 'Time Delay 2';
solution = ezsolve(objective, {cbnd, ceq}, x0, options);
t  = subs(collocate(t),solution);
u  = subs(collocate(u),solution);

Problem type appears to be: lpcon
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Time Delay 2                   f_k       4.796108524522179700
sum(|constr|)      0.000000271933102924
f(x_k) + sum(|constr|)      4.796108796455282400
f(x_0)      0.000000000000000000

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

FuncEv    1 ConstrEv   26 ConJacEv   26 Iter   25 MinorIter  154
CPU time: 0.250000 sec. Elapsed time: 0.281000 sec.


## Plot result

figure(1)
plot(t,u,'+-');
legend('u');
title('Time Delay 2 control');