B RIEF T UTORIAL ON U SING DOT CVP SB ( A M ATLAB T OOLBOX FOR DYNAMIC O PTIMIZATION IN S YSTEMS B IOLOGY ) Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga Process Engineering Group Instituto de Investigaciones Marinas [IIM-CSIC] Spanish Council for Scientific Research C/Eduardo Cabello 6, 36208 Vigo, Spain e-mails: {thirmajer, ebalsa, julio}@iim.csic.es All information about the toolbox is available at http://www.iim.csic.es/∼dotcvpsb/ or partial information is available at http://reven.comli.com/index4.html
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
1 / 43
Outline
O UTLINE
1
DOTcvpSB: Key Features
2
Optimal Control Problems
3
NLP and MINLP Solvers, Solution Scheme
4
Single Optimization
5
Multistart
6
Sucessive Re-optimization
7
Hybrid Strategy
8
SBML to DOTcvpSB (dotcvp_sbml2dotcvpsb.m)
9
Simulation
10
GUI, a Graphical User Interface (dotcvp_gui.m)
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
2 / 43
Outline
O UTLINE
1
DOTcvpSB: Key Features
2
Optimal Control Problems
3
NLP and MINLP Solvers, Solution Scheme
4
Single Optimization
5
Multistart
6
Sucessive Re-optimization
7
Hybrid Strategy
8
SBML to DOTcvpSB (dotcvp_sbml2dotcvpsb.m)
9
Simulation
10
GUI, a Graphical User Interface (dotcvp_gui.m)
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
2 / 43
Brief information about the modules
B RIEF INFORMATION ABOUT
THE MODULES
1
Single Optimization – For most problems is this approach sufficient, but if the problem is multimodal, or high non-linear with many optimas, it is necessary to use an additional robust algorithm as, f.e. hybrid approach.
2
Hybrid Strategy – Hybrid optimization is characterized by the combination of the deterministic local and the stochastic global method for the convergence speed up. Deterministic local methods stand out with their convergence speed into the nearest optimum, whereas the stochastic global methods are able to get to the vicinity of the global optimum without the extensive computational cost in comparison to deterministic global methods.
3
Sucessive Re-optimization – Sucessive re-optimization is assigned to speed up the convergence for the problems with the high discretization level. At the beginning, the single optimization is run with relative low amount of the time intervals. It follows that the total number of optimized variables is lower. At the end of the optimization the amount of the time intervals is increased and the final values of the control variables are used for the next single optimization initialization. This iterative approach speeds up the final convergence of all optimizations.
4
SBML to DOTcvpSB – This module is able to import SBML models defined as XML files.
5
Simulation – Simulation module serves for problem simulation and state trajectories generation. It is useful to use this module in combination, f.e. with sbml2dotcvp module to input check.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
3 / 43
Brief information about the modules
B RIEF INFORMATION ABOUT
THE MODULES
1
Single Optimization – For most problems is this approach sufficient, but if the problem is multimodal, or high non-linear with many optimas, it is necessary to use an additional robust algorithm as, f.e. hybrid approach.
2
Hybrid Strategy – Hybrid optimization is characterized by the combination of the deterministic local and the stochastic global method for the convergence speed up. Deterministic local methods stand out with their convergence speed into the nearest optimum, whereas the stochastic global methods are able to get to the vicinity of the global optimum without the extensive computational cost in comparison to deterministic global methods.
3
Sucessive Re-optimization – Sucessive re-optimization is assigned to speed up the convergence for the problems with the high discretization level. At the beginning, the single optimization is run with relative low amount of the time intervals. It follows that the total number of optimized variables is lower. At the end of the optimization the amount of the time intervals is increased and the final values of the control variables are used for the next single optimization initialization. This iterative approach speeds up the final convergence of all optimizations.
4
SBML to DOTcvpSB – This module is able to import SBML models defined as XML files.
5
Simulation – Simulation module serves for problem simulation and state trajectories generation. It is useful to use this module in combination, f.e. with sbml2dotcvp module to input check.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
3 / 43
Brief information about the modules
B RIEF INFORMATION ABOUT
THE MODULES
1
Single Optimization – For most problems is this approach sufficient, but if the problem is multimodal, or high non-linear with many optimas, it is necessary to use an additional robust algorithm as, f.e. hybrid approach.
2
Hybrid Strategy – Hybrid optimization is characterized by the combination of the deterministic local and the stochastic global method for the convergence speed up. Deterministic local methods stand out with their convergence speed into the nearest optimum, whereas the stochastic global methods are able to get to the vicinity of the global optimum without the extensive computational cost in comparison to deterministic global methods.
3
Sucessive Re-optimization – Sucessive re-optimization is assigned to speed up the convergence for the problems with the high discretization level. At the beginning, the single optimization is run with relative low amount of the time intervals. It follows that the total number of optimized variables is lower. At the end of the optimization the amount of the time intervals is increased and the final values of the control variables are used for the next single optimization initialization. This iterative approach speeds up the final convergence of all optimizations.
4
SBML to DOTcvpSB – This module is able to import SBML models defined as XML files.
5
Simulation – Simulation module serves for problem simulation and state trajectories generation. It is useful to use this module in combination, f.e. with sbml2dotcvp module to input check.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
3 / 43
Brief information about the modules
B RIEF INFORMATION ABOUT
THE MODULES
1
Single Optimization – For most problems is this approach sufficient, but if the problem is multimodal, or high non-linear with many optimas, it is necessary to use an additional robust algorithm as, f.e. hybrid approach.
2
Hybrid Strategy – Hybrid optimization is characterized by the combination of the deterministic local and the stochastic global method for the convergence speed up. Deterministic local methods stand out with their convergence speed into the nearest optimum, whereas the stochastic global methods are able to get to the vicinity of the global optimum without the extensive computational cost in comparison to deterministic global methods.
3
Sucessive Re-optimization – Sucessive re-optimization is assigned to speed up the convergence for the problems with the high discretization level. At the beginning, the single optimization is run with relative low amount of the time intervals. It follows that the total number of optimized variables is lower. At the end of the optimization the amount of the time intervals is increased and the final values of the control variables are used for the next single optimization initialization. This iterative approach speeds up the final convergence of all optimizations.
4
SBML to DOTcvpSB – This module is able to import SBML models defined as XML files.
5
Simulation – Simulation module serves for problem simulation and state trajectories generation. It is useful to use this module in combination, f.e. with sbml2dotcvp module to input check.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
3 / 43
Brief information about the modules
B RIEF INFORMATION ABOUT
THE MODULES
1
Single Optimization – For most problems is this approach sufficient, but if the problem is multimodal, or high non-linear with many optimas, it is necessary to use an additional robust algorithm as, f.e. hybrid approach.
2
Hybrid Strategy – Hybrid optimization is characterized by the combination of the deterministic local and the stochastic global method for the convergence speed up. Deterministic local methods stand out with their convergence speed into the nearest optimum, whereas the stochastic global methods are able to get to the vicinity of the global optimum without the extensive computational cost in comparison to deterministic global methods.
3
Sucessive Re-optimization – Sucessive re-optimization is assigned to speed up the convergence for the problems with the high discretization level. At the beginning, the single optimization is run with relative low amount of the time intervals. It follows that the total number of optimized variables is lower. At the end of the optimization the amount of the time intervals is increased and the final values of the control variables are used for the next single optimization initialization. This iterative approach speeds up the final convergence of all optimizations.
4
SBML to DOTcvpSB – This module is able to import SBML models defined as XML files.
5
Simulation – Simulation module serves for problem simulation and state trajectories generation. It is useful to use this module in combination, f.e. with sbml2dotcvp module to input check.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
3 / 43
DOTcvpSB
Toolbox Key Features
T OOLBOX K EY F EATURES
handling of a wide class of dynamic optimization problems, including constrained, unconstrained, fixed, and free terminal time problems described by ordinary differential equations (ODEs), as well as continuous and mixed integer decision variables; the inner initial value problem (IVP) is solved using the state-of-the-art methods available in SUNDIALS; the outer (MI)NLP problem can be solved using a number of advanced solvers, including local deterministic methods, stochastic global optimization methods, and hybrid metaheuristics; in addition to the traditional single optimization approach, the toolbox also offers more sophisticated strategies, like multistart, sucessive re-optimization, and hybrid strategies; a graphical user interface (GUI) which makes the definition and edition of a problem more easy and clear; possibility of importing SBML models; many output options for the results, including detailed figures.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
4 / 43
Optimal Control Problems
Problem Definition
P ROBLEM D EFINITION Consider a dynamical system described by the vector of ordinary differential equations (ODEs) x˙ = f (t, x, u, p) with given initial and terminal conditions x(0) = x0 ,
x(tF ) = xF
The aim is to find the optimal control policy ui , vector of the time-independent parameters p, and the final time tF , when minimum or free time problem is considered that minimizes the cost function J0 min J0 = G0 (tF , xF , u, p)
tF ,ui ,p
subject to the constraints, introduced also in general Mayer form as the cost function Jl = Gl (tF , xF , u, p),
l = 1, me + mi
where me and mi represent the equality and inequality constraints, respectively. The bounds on the optimized variables are given by ∆ti ∈ [∆tilower bound , ∆tiupper bound ] ui ∈ [uilower bound , uiupper bound ] p ∈ [plower bound , pupper bound ] Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
5 / 43
NLP and MINLP solvers
MI/NLP Formulation
S OLUTION OF THE R ESULTING NLP OR MINLP P ROBLEMS The dynamic optimization (DO) problem can be translated into a set of optimized variables y T = [∆t1 , . . . , ∆tN , u1T , . . . , uNT , p] that can be handled by a suitable NLP or Mixed-Integer (MI) NLP solver. The toolbox is able to interface following MI/NLP solvers deterministic IPOPT: Interior Point OPTimizer FMINCON: Find MINimum of CONstrained nonlinear multivariable function MISQP: Mixed-Integer Sequential Quadratic Programming
stochastic DE: Differential Evolution SRES: Stochastic Ranking Evolution Strategy
and hybrid ACO MI : Ant Colony Optimization for Mixed Integer nonlinear programming problems MITS: Mixed-Integer Tabu Search algorithm
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
6 / 43
DOTcvpSB
Scheme of the Solution of the Resulting NLP Problem
A LGORITHM S CHEME
F IGURE : DOTcvpSB solution scheme of the resulting dynamic optimization problem with sensitivity equations approach. Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
7 / 43
DOTcvpSB
Organization of the Toolbox Code
C ODE O RGANIZATION
F IGURE : Organization of the toolbox code. Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
8 / 43
Single Optimization
Single Optimization
S INGLE O PTIMIZATION Single Optimization
T HIS PROBLEM CAN BE RUN FROM THE TOOLBOX WITH THE FOLLOWING NAME cdop_DrugDisplacementProblemA.m < input file with all options midop_PhaseResettingOfCalciumOscillationsA.m cdop_DrugDisplacementProblemA_simple.m < input file with minimum midop_PhaseResettingOfCalciumOscillationsA_simple.m options, undefined options are taken from the default file gui_DrugDisplacementProblemA.dotcvp < input file defined by the DOTcvp graphical user interface (GUI) T HE FILE WITH THE DEFAULT SETTINGS FOR THE PRESENTED MODULE IS THE FOLLOWING dotcvp_single_optimization_default.m
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
9 / 43
Single Optimization
Single Optimization
S INGLE O PTIMIZATION Single Optimization
T HIS PROBLEM CAN BE RUN FROM THE TOOLBOX WITH THE FOLLOWING NAME cdop_DrugDisplacementProblemA.m < input file with all options midop_PhaseResettingOfCalciumOscillationsA.m cdop_DrugDisplacementProblemA_simple.m < input file with minimum midop_PhaseResettingOfCalciumOscillationsA_simple.m options, undefined options are taken from the default file gui_DrugDisplacementProblemA.dotcvp < input file defined by the DOTcvp graphical user interface (GUI) T HE FILE WITH THE DEFAULT SETTINGS FOR THE PRESENTED MODULE IS THE FOLLOWING dotcvp_single_optimization_default.m
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
9 / 43
Single Optimization
Drug Displacement Problem without the path constraint
E XAMPLE 1: D RUG D ISPLACEMENT P ROBLEM WITHOUT THE PATH CONSTRAINT
Example 1: Drug Displacement Problem without the path constraint
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
10 / 43
Single Optimization
Drug Displacement Problem without the path constraint
P ROBLEM D EFINITION The problem consists of the right rate projection of phenylbutazone infusion to minimize the time needed to reach in a patient’s bloodstream a desired level of two drugs min J0 {tF } ui ,ti
subject to x˙ 1 = g4 (g3 (0.02 − x1 ) + 46.4x1 (u − 2x2 )) x˙ 2 = g4 (g2 (u − 2x2 )) + 46.4(0.02 − x1 ) with gi , i = 1, 4 defined as follows g1 = 1 + 0.2(x1 + x2 ),
g2 = g12 + 232 + 46.4x2 ,
g3 = g12 + 232 + 46.4x1 ,
g4 =
g12 g2 g3 − 2152.96x1 x2
where the state variables represent the concentration of warfarin and phenylbutazone drugs. The initial values were set for the process and decisions variables at the value of x0 = [0.02; 2.00] and u0 = [4], respectively. The boundaries of the decision variables are as follows: u ∈ [0; 8]. The equality point constraints on the final amount of displacement drugs are given by x1 (tF ) = 0.02, Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
x2 (tF ) = 2.00
Brief Tutorial on Using DOTcvpSB
April 5, 2009
11 / 43
Single Optimization
Drug Displacement Problem without the path constraint
U SER I NPUT: P ROBLEM AND IVP I NITIALIZATION 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
clear mex; clear all; close all; global data; % --------------------------------------------------- % % Initialization: % --------------------------------------------------- % data.name = ’DrugDisplacementProblemA_simple’; % --------------------------------------------------- % % Settings for IVP (ODEs, sensitivities) % --------------------------------------------------- % data.odes.res(1) = {’((1+0.2*(y(1)+y(2)))^2/(((1+0.2*(y(1)+y(2)))^2+232+46.4*y(2)) *((1+0.2*(y(1)+y(2)))^2+232+46.4*y(1)) -2152.96*y(1)*y(2)))*(((1+0.2*(y(1)+y(2)))^2+232+46.4*y(1))*(0.02-y(1))+46.4*y(1)*(u(1)-2*y(2)))’}; data.odes.res(2) = {’((1+0.2*(y(1)+y(2)))^2/(((1+0.2*(y(1)+y(2)))^2+232+46.4*y(2)) *((1+0.2*(y(1)+y(2)))^2+232+46.4*y(1)) -2152.96*y(1)*y(2)))*(((1+0.2*(y(1)+y(2)))^2+232+46.4*y(2))*(u(1)-2*y(2))+46.4*(0.02-y(1)))’}; data.odes.res(3) = {’1’}; data.odes.ic = [0.02 0.0 0.0]; data.odes.tf = 500.0; %final time data.odes.RelTol = 1*10^(-8); %IVP relative tolerance level data.odes.AbsTol = 1*10^(-8); %IVP absolute tolerance level data.sens.SensAbsTol = 1*10^(-8); %absolute tolerance for sensitivity variables
DATA . NAME DATA . ODES . RES (1–3)
The variable which contains the name of the problem. Here is defined the mathematical description of the system in the standard ODEs form. The notation y(number), u(number), p(number) has to be used for the state, decision variables, and time-independent parameters, respectively.
DATA . ODES . IC
The vector of the initial state variables defined for the system.
DATA . ODES . TF
The final time of the optimization, initial time is set as default at the value of 0.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
12 / 43
Single Optimization
Drug Displacement Problem without the path constraint
U SER I NPUT: NLP D EFINITION
1 2 3 4 5 6 7 8 9 10
% --------------------------------------------------- % % NLP definition: % --------------------------------------------------- % data.nlp.RHO = 5; %number of time intervals data.nlp.J0 = ’y(3)’; %cost function: min-max(cost function) data.nlp.u0 = [4.0]; %initial value for control values data.nlp.lb = [0.0]; %lower bounds for control values data.nlp.ub = [8.0]; %upper bounds for control values data.nlp.solver = ’IPOPT’; %[’FMINCON’|’IPOPT’|’SRES’|’DE’|’ACOMI’|’MISQP’|’MITS’] data.nlp.FreeTime = ’on’; %[’on’|’off’] set ’on’ if free time is considered
DATA . NLP.RHO
The number of time intervals.
DATA . NLP.J0
The cost function is defined in the standard Mayer form. The problem is set as default to find a minimum of the presented cost function.
DATA . NLP. U 0
The initial values of the decision variables, if here is defined only one number for each control trajectory, then the initial control trajectory is constant, otherwise is needed to define, e.g. [u01 ; u02 ; ..] whether only one initial non-constant control trajectory is considered.
DATA . NLP. LB
The vector of lower bounds of the decision variables.
DATA . NLP. UB
The vector of upper bounds of the decision variables.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
13 / 43
Single Optimization
Drug Displacement Problem without the path constraint
U SER I NPUT: E QUALITY C ONSTRAINTS 1 2 3 4 5 6 7 8 9
% --------------------------------------------------- % % Equality constraints (ECs): % --------------------------------------------------- % data.nlp.eq.status = ’on’; %[’on’|’off’] ECs data.nlp.eq.NEC = 2; %number of active ECs data.nlp.eq.eq(1) = {’y(1)-0.02’}; data.nlp.eq.eq(2) = {’y(2)-2.0’}; data.nlp.eq.time(1) = data.nlp.RHO; data.nlp.eq.time(2) = data.nlp.RHO;
DATA . NLP. EQ . STATUS DATA . NLP. EQ .NEC DATA . NLP. EQ . EQ (1-2) DATA . NLP. EQ . TIME (1-2)
The information about the equality constrains, if those are active, set this option at the value of ’on’ otherwise ’off’. The number of active equality constraints. The equality constraints defined by the user. The segments after which are before defined equality constrains active.
N OTE The equality constraint of the type ’data.nl.eq.eq(1) = {’y(2)+0.1’}’ is active, the status is set at the value of ’on’ what means that the equation x2 (tF ) = −0.1 is active in the final segment ’data.nlp.eq.time(1) = data.nlp.RHO’. This direction – timing is equal to the final time. If we would like to set the active equality constraint on the half time of the optimization, we have to define the before mentioned option on the value of 15 or ’data.nlp.RHO/2’. Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
14 / 43
Single Optimization
Drug Displacement Problem without the path constraint
U SER I NPUT: F INAL O PTIONS
1 2 3 4 5 6 7 8 9 10
% --------------------------------------------------- % % Options for setting of the final output: % --------------------------------------------------- % data.options.intermediate = ’off’; %[’on’|’off’|’silent’] display of the intermediate results data.options.trajectories = 2; %how many state trajectories will be displayed % --------------------------------------------------- % % Call of the main function (you do not change this!): % --------------------------------------------------- % dotcvp_main(data)
DATA . OPTIONS . INTERMEDIATE
The option related to the display of the intermediate results.
DATA . OPTIONS . TRAJECTORIES
How many state trajectories will be displayed in the final figure.
DOT CVP _M AIN ( DATA ) Here the main function of the toolbox is called together with the data input structure. N OTE Only this file is needed for introducing a new problem into toolbox, everything else is generated automatically. Remember that this is only a simple input file. The undefined options are taken from the default settings [dotcvp_single_optimization_default.m], of course it is possible to change them. After MATLAB is started, it is necessary to run the [dotcvp_install.m] file to save the paths into MATLAB environment. Note, if you quit MATLAB environment, all paths will be deleted, so you need to run the [dotcvp_install.m] file with the new start of MATLAB again.
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
15 / 43
Single Optimization
Drug Displacement Problem without the path constraint
S CREEN O UTPUT: I NITIALIZATION 1 2
________________________________________________________
3 4 5
DOTcvp: Dynamic Optimization Toolbox with CVP approach for handling continuous and mixed-integer DO problems
6 7
Main author: Tomas Hirmajer,
[email protected] Coauthors: Eva Balsa-Canto and Julio R. Banga Web pages: http://www.iim.csic.es/~dotcvp/ http://www.iim.csic.es/~dotcvpsb/ Core version: DOTcvp_R2008_E2 ________________________________________________________
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
________________________________________________________ DOTcvp - a Module for Single Optimization ________________________________________________________ Saving of the ODE ................................................. done! Generation of the file: cvm_rhs.m (ODE - MATLAB) .................. done! Saving of the parameters .......................................... done! Generation of the file: cvm_d/bjac.m (Jacobian - MATLAB) .......... done! Saving of the cost function (J0) .................................. done! Generation of the file: temp_TimeDiscontinuity .................... done! Generation of the gradients (J0) .................................. done! Generation of the file: cvm_rhsS.m (sensitivities - MATLAB) ....... done! Saving of the in/equality constraints (Ji) ........................ done! Generation of the gradients (Ji) .................................. done! Generation of the file: temp_cvfdx.m (main IVP file) .............. done! Optimizing of the process (N=5; min(J0); IPOPT; DrugDisplacementProblemA_simple) ... in progress Default settings are loading ...................................... done!
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
16 / 43
Single Optimization
Drug Displacement Problem without the path constraint
S CREEN O UTPUT: R ESULTS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
____________________________ Final results [single-optimization]: ............. Problem name: DrugDisplacementProblemA_simple ...... NLP or MINLP solver: IPOPT . Number of time intervals: 5 ... IVP relative tolerance: 1.000000e-008 ... IVP absolute tolerance: 1.000000e-008 . Sens. absolute tolerance: 1.000000e-008 ............ NLP tolerance: 1.000000e-005 ....... Final state values: 2.000004e-002 2.000014e+000 2.212422e+002 ...... 1th optimal control: 7.999963e+000 7.999963e+000 7.999963e+000 8.000000e+000 5.454379e-007 ..... Final size of the dt: 1.000009e-001 1.000009e-001 1.000009e-001 1.886241e+002 3.231812e+001 ..... Final time [sum(dt)]: 2.212422e+002 ____________________________ ............ Final CPUtime: 18.89062500 seconds . Cost function [min(J_0)]: 221.24223300 The detailed information is saved to the workspace structure with the name ’data’. data = name: odes: sens: nlp: options: version: compiler: output: p: gradJ0: gradJi: J0:
’DrugDisplacementProblemA_simple’ [1x1 struct] [1x1 struct] [1x1 struct] [1x1 struct] ’DOTcvp_R2008_E2’ ’None’ [1x1 struct] [5.4544e-007 5] [0 0 0 0 0 1 1 1 1 1] [2x10 double] 221.2422
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
17 / 43
Single Optimization
Drug Displacement Problem without the path constraint
G RAPHICAL O UTPUT: O PTIMAL T RAJECTORIES 0.03
4 x1
8
x2
7
2
State Variable
0.025
Control variable
State Variable
6
5
4
3
2
1
0.02 0
0
50
100
150
200
0
0
Time
50
100
150
200
Time
F IGURE : Optimal state trajectories (left) and the optimal control profile (right) for the drug displacement problem. Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
18 / 43
Single Optimization
Resetting of Calcium Oscillator
E XAMPLE 2: R ESETTING OF C ALCIUM O SCILLATOR
Example 2: Resetting of Calcium Oscillator
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
19 / 43
Single Optimization
Resetting of Calcium Oscillator
P ROBLEM D EFINITION The model describes intracellular calcium spiking in hepatocytes induced by an extracellular increase in adenosine triphosphate concentration. The problem is formulated as minimization of the state variables deviations (oscillatory behaviour) from the desired values 4 Z 22 X 2 s wj xj (t) − xj + w5 u1 (t) + w6 u2 (t) dt min J0 0 x(t),u(t),p j=1
subject to
k5 x1 x3 k3 x1 x2 − x1 + K4 x1 + K6 k8 x2 active phospholipase C → x˙ 2 = (1 − u2 )k7 x1 − x2 + K9 k14 x3 k16 x3 x4 k14 x3 k10 x2 x3 x4 − u1 + k12 x2 + k13 x1 − + − (1 − u1 ) intracellular calcium → x˙ 3 = x4 + K11 x3 + K17 10 p1 x3 + K15 x3 + K15 k10 x2 x3 x4 k16 x3 x4 intra-ER calcium → x˙ 4 = − + − x4 + K11 x3 + K17 10 activated G-protein → x˙ 1 = k1 + k2 x1 −
and the time-independent parameter: 1 ≤ p1 ≤ 1.3 Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
20 / 43
Single Optimization
Resetting of Calcium Oscillator
S IMULATION WITH NO AND F ULL I NHIBITION 30
20 x x
25
x x
x
1
18
2
x x
3
16
4
x
1 2 3 4
14 State variables
State variables
20
15
12 10 8
10 6 4 5 2 0 0
2
4
6
8
10 12 Time
14
16
18
20
22
0 0
2
4
6
8
10 12 Time
14
16
18
20
22
F IGURE : Simulation of the system with no inhibition (left: u1 = 0, u2 = 0, p1 = 1) and with the constant maximum inhibition of the PMCA (plasma membrane Ca2+ ) ion pump (right: u1 = 1, u2 = 0, p1 = 1.3) for the calcium oscillator problem. Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
21 / 43
Single Optimization
Resetting of Calcium Oscillator
T HE S CENARIO WITH F REE T RANSITION T IMES AND ONE C ONTROL VARIABLE 25 x x x 20
x
1
1 2
0.9
3
0.8
4
Control variable
State variables
0.7 15
10
0.6 0.5 0.4 0.3 0.2
5
0.1 0 0 0
2
4
6
8
10 12 Time
14
16
18
20
22
0
2
4
6
8
10 12 Time
14
16
18
20
22
F IGURE : Optimal state trajectories (left) with corresponding control profile (right) for the calcium oscillator problem. Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
22 / 43
Single Optimization
Resetting of Calcium Oscillator
T HE S CENARIO WITH F REE T RANSITION T IMES AND T WO C ONTROL VARIABLES Activated G−proteins
Active Phospholipase C
25
8 6 4
20 15 10
2 0
0
10 Time
0
20
20
0
Control variable
State variable
1
0
10 Time
20
20
Channel Blocker
2
0
10 Time
1
3
1
0.4
Intra−ER Calcium
4 State variable
10 Time
4
2
0.6
0 0
Intracellular Calcium
3
0.8
0.2
5
5
0
Pump Inhibitor 1
Control variable
10 State variable
30
State variable
12
0.8 0.6 0.4 0.2 0
0
10 Time
20
0
10 Time
20
F IGURE : Optimal state and control trajectories for the calcium oscillator problem. Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
23 / 43
Single Optimization
Resetting of Calcium Oscillator
T HE P ROBLEM S IMULATION TO L ONGER T IMES 30
x1 x2 x3 x4
25
State variables
20
15
10
5
0
0
10
20
30
40
50
60
Time
F IGURE : The problem simulation to longer times (tF = 60) without more stimuli for the calcium oscillator problem. Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
24 / 43
Hybrid Strategy
Hybrid Strategy
H YBRID S TRATEGY Hybrid Strategy W HAT IS NEEDED TO BE DONE IS JUST TO ADD OR CHANGE THE OPTION IN THE USER INPUT FILE AS FOLLOWS data.options.action=’hybrid-strategy’ T HIS PROBLEM CAN BE RUN FROM THE TOOLBOX WITH THE FOLLOWING NAME cdop_DrugDisplacementProblemB.m < input file with all options cdop_DrugDisplacementProblemB_simple.m < input file with minimum options, undefined options are taken from the default file T HE FILE WITH THE DEFAULT SETTINGS FOR THE PRESENTED MODULE IS THE FOLLOWING dotcvp_hybrid_strategy_default.m
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
25 / 43
Hybrid Strategy
Hybrid Strategy
H YBRID S TRATEGY Hybrid Strategy W HAT IS NEEDED TO BE DONE IS JUST TO ADD OR CHANGE THE OPTION IN THE USER INPUT FILE AS FOLLOWS data.options.action=’hybrid-strategy’ T HIS PROBLEM CAN BE RUN FROM THE TOOLBOX WITH THE FOLLOWING NAME cdop_DrugDisplacementProblemB.m < input file with all options cdop_DrugDisplacementProblemB_simple.m < input file with minimum options, undefined options are taken from the default file T HE FILE WITH THE DEFAULT SETTINGS FOR THE PRESENTED MODULE IS THE FOLLOWING dotcvp_hybrid_strategy_default.m
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
25 / 43
Hybrid Strategy
Hybrid Strategy
H YBRID S TRATEGY Hybrid Strategy W HAT IS NEEDED TO BE DONE IS JUST TO ADD OR CHANGE THE OPTION IN THE USER INPUT FILE AS FOLLOWS data.options.action=’hybrid-strategy’ T HIS PROBLEM CAN BE RUN FROM THE TOOLBOX WITH THE FOLLOWING NAME cdop_DrugDisplacementProblemB.m < input file with all options cdop_DrugDisplacementProblemB_simple.m < input file with minimum options, undefined options are taken from the default file T HE FILE WITH THE DEFAULT SETTINGS FOR THE PRESENTED MODULE IS THE FOLLOWING dotcvp_hybrid_strategy_default.m
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
25 / 43
Hybrid Strategy
Hybrid Strategy
S ETTINGS F OR T HE H YBRID S TRATEGY 1 2 3
function [data] = dotcvp_hybrid_strategy_default(data) switch data.option.Hybrid_method
4 5
case{’stochastic’} % first step [a stochastic solver]: please fill basic settings for % a stochastic solver, otherwise they will be taken from the user % input file
6 7 8 9 10
data.option.HybridStrategy.IVPRelTol data.option.HybridStrategy.IVPAbsTol data.option.HybridStrategy.NLPTol data.option.HybridStrategy.NLPSolver data.option.HybridStrategy.NLPsettings data.option.HybridStrategy.MaxIter data.option.HybridStrategy.MaxCPUTime data.option.HybridStrategy.intermediate
11 12 13 14 15 16 17 18
= = = = = = = =
1e-005; 1e-005; 1e-003; ’DE’; ’None’; 50; inf; ’off’;
% % % % % % % %
IVP relative tolerance level IVP absolute tolerance level NLP tolerance level chose a solver [’FMINCON’|’IPOPT’|’SRES’|’DE’|’ACOMI’|’MISQP’|’MITS’] insert the file name that contains settings for NLP solver, otherwise ’None’ maximum number of iterations maximum CPU time of the optimization (60*60*0.25) = 15 minutes [’on’|’off’|’silent’] display of the intermediate results
case{’deterministic’} % second step [a deterministic solver]: all settings for a % deterministic solver are taken from the user input file, but the % user can introduce some new or special settings, which rewrites % those from the input file. The name of the structure is the same % as the name in the user input file, e.g. data.nlp.RHO, etc.
19 20 21 22 23 24 25 26
end
27 28
end
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
26 / 43
Hybrid Strategy
Drug Displacement Problem with the path constraint
E XAMPLE 3: D RUG D ISPLACEMENT P ROBLEM WITH THE PATH CONSTRAINT
Example 3: Drug Displacement Problem with the path constraint
Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
Brief Tutorial on Using DOTcvpSB
April 5, 2009
27 / 43
Hybrid Strategy
Drug Displacement Problem with the path constraint
P ROBLEM D EFINITION The problem consists of the right rate projection of phenylbutazone infusion to minimize the time needed to reach in a patient’s bloodstream a desired level of two drugs min J0 {tF } ui ,ti
subject to x˙ 1 = g1 (g4 (0.02 − x1 ) + 46.4x1 (u − 2x2 )) x˙ 2 = g1 (g3 (u − 2x2 )) + 46.4(0.02 − x1 ) with gi , i = 1, 4 defined as follows g2 = 1 + 0.2(x1 + x2 ),
g3 = g22 + 232 + 46.4x2 ,
g4 = g22 + 232 + 46.4x1 ,
g1 =
g22 g3 g4 − 2152.96x1 x2
where the state variables represent the concentration of warfarin and phenylbutazone drugs. The initial values were set for the process and decisions variables at the value of x0 = [0.02; 2.00] and u0 = [4], respectively. The boundaries of the decision variables are as follows: u ∈ [0; 8]. The equality point constraints on the final amount of displacement drugs are given by x1 (tF ) = 0.02, Tomáš Hirmajer, Eva Balsa-Canto, and Julio R. Banga
()
x2 (tF ) = 2.00, Brief Tutorial on Using DOTcvpSB
x1 (t) ≤ 0.026 April 5, 2009
28 / 43
Hybrid Strategy
Drug Displacement Problem with the path constraint
U SER I NPUT: I NEQUALITY C ONSTRAINTS AND SOME F INAL O; PTIONS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
% --------------------------------------------------- % % Inequality /path/ constraints (INECs): % --------------------------------------------------- % data.nlp.ineq.status = ’on’; %[’on’|’off’] INECs data.nlp.ineq.NEC = 1; %number of active INECs data.nlp.ineq.InNUM = 0; %how many inequality constraints are ’>’ else ’’ else ’