Simplified version of the sterilization problem considered in the paper: Z.S. Chalabi, L.G. van Willigenburg, G. van Straten, 1999, Robust optimal receding horizon control of the thermal sterilization of canned food, Journal of Food Engineering, 40, pp. 207-218.
Programmers: Gerard Van Willigenburg (Wageningen University) Willem De Koning (retired from Delft University of Technology)
% Array with consecutive number of collocation points narr = [20 30 40]; toms t; t_f = 1500; % Fixed final time for n=narr
p = tomPhase('p', t, 0, t_f, n);
setPhase(p)
tomStates x1 x2 x3 x4
tomControls u1
% Initial & terminal states
xi = [20; 20; 0; 0];
xf = [40; 0; 100; 0];
% Initial guess
if n==narr(1)
x0 = {icollocate({x1 == xi(1); x2 == xi(2)
x3 == xi(3); x4 == xi(4)})
collocate({u1 == 50})};
else
x0 = {icollocate({x1 == xopt1; x2 == xopt2
x3 == xopt3; x4 == xopt4})
collocate({u1 == uopt1})};
end
% Box constraints
cbox = {0 <= collocate(u1) <= 50};
% Boundary constraints
cbnd = {initial({x1 == xi(1); x2 == xi(2); x3 == xi(3); x4 == xi(4)})};
% ODEs and path constraints
pv = [0.01; 0.005; 0.01; 20; 10; 121.11; 25.56; 121.11];
dx1 = pv(1)*(x2-x1);
dx2 = pv(2)*(pv(4)-x2)+pv(3)*u1;
dx3 = exp(log(10)/pv(5)*(x1-pv(6)));
dx4 = exp(log(10)/pv(7)*(x1-pv(8)));
ceq = collocate({
dot(x1) == dx1; dot(x2) == dx2
dot(x3) == dx3; dot(x4) == dx4});
% Objective
objective = final(x4)+final((x3-100)^2)+final((x1-40)^2);
options = struct;
options.name = 'Food Sterilization';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
xopt1 = subs(x1,solution);
xopt2 = subs(x2,solution);
xopt3 = subs(x3,solution);
xopt4 = subs(x4,solution);
uopt1 = subs(u1,solution);
Problem type appears to be: qpcon
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license 999001. Valid to 2010-02-05
=====================================================================================
Problem: --- 1: Food Sterilization f_k 10000.633789899643000000
sum(|constr|) 0.000041751724577319
f(x_k) + sum(|constr|) 10000.633831651367000000
f(x_0) -1200.000000000000000000
Solver: snopt. EXIT=0. INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied
FuncEv 1 ConstrEv 21 ConJacEv 21 Iter 20 MinorIter 128
CPU time: 0.093750 sec. Elapsed time: 0.094000 sec.
Problem type appears to be: qpcon
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license 999001. Valid to 2010-02-05
=====================================================================================
Problem: --- 1: Food Sterilization f_k 10000.653592992361000000
sum(|constr|) 0.000007302827005963
f(x_k) + sum(|constr|) 10000.653600295189000000
f(x_0) -1599.366210100359200000
Solver: snopt. EXIT=0. INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied
FuncEv 1 ConstrEv 4 ConJacEv 4 Iter 3 MinorIter 108
CPU time: 0.046875 sec. Elapsed time: 0.047000 sec.
Problem type appears to be: qpcon
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license 999001. Valid to 2010-02-05
=====================================================================================
Problem: --- 1: Food Sterilization f_k 10000.653878478508000000
sum(|constr|) 0.000000000000026244
f(x_k) + sum(|constr|) 10000.653878478508000000
f(x_0) -1599.346407007637000000
Solver: snopt. EXIT=0. INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied
FuncEv 1 ConstrEv 2 ConJacEv 2 Iter 1 MinorIter 133
CPU time: 0.046875 sec. Elapsed time: 0.047000 sec.
end
figure(1)
subplot(2,1,1);
ezplot([x1; x2; x3; x4]); legend('x1','x2','x3','x4');
title('Food Sterilizer states');
subplot(2,1,2);
ezplot(u1); legend('u1');
title('Food Sterilizer controls');