sábado, 18 de outubro de 2014

An introduction to optimal control problems in life sciences and economics



Review by
Jorge Guerra Pires
Department of Information Engineering, Computer Science and Mathematics
University of L'Aquila, Italy
Institute of Systems Analysis and Computer Science (IASI)
Cosiglio Nazionale  delle Ricerche (CNR) Rome, Italy
CAPES Foundation, Ministry of Education of Brazil
Email: jorgeguerrapires@yahoo.com.br

Created on: 17/10/2014
Comment: this is mathematical based approach. It is a interesting reading for people studying optimal control from a practical point of view, but mathematical driven studies. For a more engineering driven approach, see S Lenhart, J T Workman, Optimal Control Applied to biological models, Chapman & Hall/ CRC, Mathematical and Computational Biology Series, 2007 (review on the way). This is a nice reading for being done in parallel with this or even after.  George W Swan, Applications of optimal control theory in biomedicine, Pure and Applied Mathematics. Marcel Dekker Inc, 1984 is a second nice reading to accompany the same book (review on the way).

Last review: 17/10/2014
Review class: short.
Keywords:  Finite Differences Method, Numerical Schemes, Applied Optimal Control, Pontryagin's Principle, age-structured population models, diffusive models.

For a complete text, please, download the PDF.

========
Sebastian Anița, Viorel Arnăutu, Vincenzo Capasso, An introduction to optimal control problems in life sciences and economics: from mathematical models to numerical simulation with Matlab®, Modeling and Simulation in Science, Engineering and Technology, Birkhäuser, 2011. 
========

An introduction to MATLAB®. Elementary models with applications

MATLAB (MATrix LABoratory) is a very flexible and simple programming language tool. But it can be used as high-level programming language. Matlab is our choice because it offers some important advantages in comparison to other programming languages.

Arrays and matrix algebra

The basic element of MATLAB, hereafter written as Matlab for simplicity, is the matrix. Even a simple variable is considered as a 1-by-1 matrix. The basic type is double (8 bytes).
Some commands:

  • Format short: this will make Matlab uses a short number representation;
  • Format long: this will make Matlab releases a long number representation;
  • Format short e: this will make Matlab uses floating point, the style sometimes is referred as scientific notation;
  • Format long e: this will make Matlab uses floating point, the style sometimes is referred as scientific notation. For short it uses 5 digits whereas for long it uses 15 digits;
  • Format short g: best between fixed or floating point representation with 5 digits;
  • Format long g: best between fixed or floating point representation with 15 digits;

The first is the Matlab default choice. See as well printf and vpa for further numerical representation capability. 

Arrays. There are no statements for declaring the dimensions of an array. The components of an array may be real numbers, complex numbers, or any Matlab expression. Important. if you give value for a component for which the predecessors were not initiated, the same ones will be given zero as value.  [] can be used to eliminate rows and columns at once, this is not necessary to make it step by step such as in C++ or Java, do it directly. See ones and eye functions, the former creates a vector or matrix of ones and the latter the identity. For matrix dimensionality measures, see length and size functions, the former gives you the vector/matrix length in number of elements whereas the latter gives you the line and the column number. For matrix manipulations, the interesting to mention is: P=A.*B, gives a matrix with the same dimension in which the elements are multiplied one by one, aij*bij, this is not the conventional matrix multiplication. For P=A./B it follows the same rule, but division rather than multiplication.

Important. The Gaussian elimination algorithm is implemented to solve linear algebraic systems. You can alternatively apply: A_aux=inv(A), and T=A_aux*D, where the linear system to be solved is AT=D; in this case you are using the inverse of the coefficient matrix instead, theoretically this approach is more probe to roundoff errors. And another possibility is using the LU decomposition: [L,U]=lu(A), L_aux=inv(L) and U_aux=inv(U), A_aux=L_aux* L_aux, and finally T=A_aux*D. Apparently the results are the same.  

Simple 2D graphics. By plot (x,y), given they have the same dimensions, we get a graph of  x vs. y, whereas by plot (y) we get a graph of y vs. its indexes. Several others functions for plot  is available such as xLabel, that gives a name for the x-axis.

Script files and function files. All Matlab files have the extension m, e.g rootfiders.m . Type edit for accessing the editor window. A script file is the main routine of a program, the driver directions. On the other hand, the function files contain specific direction such as the ones in Matlab, the built-in functions. The script files can follow any template you please, but the function file should start with function and has the same name as the file itself, for who is familiar with Java this is the same as it happens with the main class. Functions can be either void, just input and no output, or returning type, it returns the calculations. For the former the template is function name (inputs), whereas for the latter it is function outputs = name (inputs). This is a good programming practice to write down support to the users, it serves even for you in a memory failure. For that, just use % in each line you want to comment, the first comments after the function header will be displayed as help for the user when they type help and the function name, the same way it occurs with conventional Matlab functions.

I/O statements. In Matlab you can ask the user to enter data just by using: variable=input (‘please, enter the value for variable 1’). Use \n for jumping one line. For strings, we must use: name=input(‘what is your name’, ‘s’). num2string(a) transforms the string a into a numerical variable.

Roots and minimum points of 1D functions. For root finding, just use fzero (‘f’,r0), where f is the function name, defined in a m-file like style and r0 is the initial guess for the root of the function. Further, fzero (‘f’,[r0 r1])  can be used to represents an interval for searching rather than a singled-value guess. An alternative approach for the m-file creation is using inline function. Just use f=inline (‘x*x-3’) and procedure normally. For polynomial functions, we can additionally use roots, the input is a vector with the coefficients from the higher degree to the smallest. For finding the optimal of a function, just apply fminbnd (f, -1, 1, 1), where is a inline function therefore no prime is used, the first two numbers are the bounds for the optimal search, and the last activates the storing-pathway search.

Arrays-smart function. All built-in functions in Matlab is array-smart, this means that you do not have to write for sentences for entering a vector values, just enter the value normally the output will be a vector or matrix correspondent in dimension. This is suggested that whenever one programs its own function, use array-smart tricks such as x.*x, the dot is used in Matlab for “discretizing” the operation, element by element.

Global Variables. Any variable can be shared by all function and the workplace, just declare it as global. See that several books in computer programming practices does not advise the usage of global variables, besides this is widely used by Matlab programmers.

Models with Ordinary Differential Equations ODEs. The ODE23 is a ODE solver by Runge-Kutta method is other 2 or 3, by adapting steps. Equally one can apply ODE34.  


  
Optimal Control of ordinary differential systems. Optimality conditions

            This chapter and the next one are devoted to some basic ideas and techniques in optimal control theory of ordinary differential systems. We do not treat the optimal control problem or Pontryagin's principle in their most general form; instead we prefer  direct approach to some significant optimal control problems in life sciences and economics governed by ordinary differential systems. The main goal of this chapter is to prove the existence of an optimal control and to obtain first-order necessary conditions of optimality (Pontryagin's principle) for some significant optimal control problems.

 =========

Comments section

As mentioned before the authors have decided to use Matlab as their software, indeed this is a good choice. However, I myself would pinpoint two points regarding Matlab, firstly this is not free, this could limit the usability of the theory presented. This is not always the case, on Lenhart and Workman (2007) they use Matlab as well, but the code is so generic that it can be adapted to any other language, you just need a txt of the code and knowledge of Matlab syntax. Secondly, even if this is not the case, in some situations Matlab indeed can be slow. One of the biggest advantage of using Matlab, besides its simplicity in the programming syntax, is the graphical capability, it is easy and nice to use.
=================



general optimal control problem


Lotka-Volterra system

Nenhum comentário:

Postar um comentário