Drug Displacement Problem
ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS
12.4.3 Example 3: The desired level of two drugs, warfarin and phenylbutazone, must be reached in a patients bloodstream in minimum time.
CHAPMAN & HALL/CRC Monographs and Surveys in Pure and Applied Mathematics
Contents
Problem Formulation
Find u over t in [0; t ] to minimize
subject to:
x1 is the concentration of warfarin, and x2 of phenylbutazone. The initial and final condition are:
% Copyright (c) 2007-2008 by Tomlab Optimization Inc.
Problem setup
toms t toms tf p = tomPhase('p', t, 0, tf, 50); setPhase(p); tomStates x1 x2 tomControls u % Initial guess x0 = {tf == 300 icollocate({ x1 == 0.02; x2 == 2*t/tf}) collocate(u == 8-8*t/tf)}; % Box constraints cbox = { 1 <= tf <= 500 0 <= collocate(u) <= 8}; % Boundary constraints cbnd = {initial({x1 == 0.02; x2 == 0}) final({x1 == 0.02; x2 == 2})}; % General variables g2 = 1+0.2*(x1+x2); g3 = g2.^2+232+46.4*x2; g4 = g2.^2+232+46.4*x1; g1 = g2.^2./(g3.*g4-2152.96*x1.*x2); % ODEs and path constraints ceq = collocate({ dot(x1) == g1.*(g4.*(0.02-x1)+46.4*x1.*(u-2*x2)) dot(x2) == g1.*(g3.*(u-2*x2)+46.4*(0.02-x1))});
Solve the problem
options = struct; options.name = 'Drug Displacement'; % Objective is first parameter solution = ezsolve(tf, {cbox, 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: Drug Displacement f_k 221.333418113809330000 sum(|constr|) 0.000000058988258573 f(x_k) + sum(|constr|) 221.333418172797590000 f(x_0) 300.000000000000000000 Solver: snopt. EXIT=0. INFORM=1. SNOPT 7.2-5 NLP code Optimality conditions satisfied FuncEv 1 ConstrEv 14 ConJacEv 14 Iter 10 MinorIter 259 CPU time: 0.140625 sec. Elapsed time: 0.141000 sec.
Plot result
figure(1) plot(t,u,'+-'); legend('u'); title('Drug Displacement control');