Differential equation system in Optimization Toolbox

Hi, everyone.
I'm trying to solve dynamic programming problem. I have differential equation system like that one:
dydt = zeros(2,1);
dydt(1) = z(1);
dydt(2) = z(2)-z(1);
With constraints:
z>=0;
z(1)+z(2)<=x(2);
z(2)<=x(1);
x(2)>=0;
I must maximize x(2) on period T=5.
How can I optimize DES and find z with Optimization Toolbox?
Thank you.

8 comentarios

Crosscheck here: does z>=0 mean z(1) >= 0 and z(2) >= 0 ?
Artyom
Artyom el 30 de Abr. de 2012
Yes.
z(i)>=0; %i=1,2
Which of the values are unknowns? Are z or x intended to be interpreted as being time-dependent, z1(t) ?
If you must maximize x(2) then why not just say x(2) = infinity ?
Artyom
Artyom el 30 de Abr. de 2012
My mistake. System of equation:
x'(1)= z(1); - where x1 - steel capacity
x'(2)= z(2)-z(1); - where x2 - steel stockpile
Value x(1) and x(2) we know.
We take some steel from stockpile (z1) and increase steel capacity at period [0;1]. Than we do it again at period [1;2]. Final period is T=5.
Constraints:
z(1)>=0;z(2)>=0;
z(1)+z(2)<=x(2); - we can't take more steel that we have
z(2)<=x(1); - bottleneck, where capacity greater then z2
x(2)>=0;
Problem: maximize x'(2) at period T=5.
If you have more quastions just ask.
I'm also confused - how do the values of z change over time? Is this a continuous or discrete time problem?
Artyom
Artyom el 30 de Abr. de 2012
Ok, we take, for example, z(1)=3; z(2)=3 on period [0;1], z(1)=5;
z(2)=6 on [1;2] and so on. Our goal to maximize x(2) on [0;T]. So we take decision abou z(i) in moments of time 0,1,2,3,4.
Are the z variables constrained to take on integer values?
Artyom
Artyom el 30 de Abr. de 2012
No, it can take any values. Except constraints of course.

Iniciar sesión para comentar.

Respuestas (1)

Your problem is a linear program in the arrays x1, x2, z1, z2. Because the RHS of the ODEs is piecewise constant, the problem can be reformulated as a series of difference equations. You therefore have the following linear equality constraints:
k = 0, ..., 4:
x1[k+1] = x1[k] + z1[k]
x2[k+1] = x2[k] + z2[k] - z1[k]
where x1[0] and x2[0] are known initial conditions
And you have the following linear inequality constraints:
k = 0, ..., 4:
z1[k] >= 0
z2[k] >= 0
z1[k] + z2[k] <= x2[k]
z2[k] <= x1[k]
z2[k] - z1[k] >= -x2[k]
Your cost is also linear:
c(z1, z2, x1, x2) = x2[5]
All of this defines a linear program that you can solve with linprog. All you require is a little bookkeeping to formulate the constraint matrices (and conversion to ones-based indexing)

Categorías

Más información sobre Quadratic Programming and Cone Programming en Centro de ayuda y File Exchange.

Preguntada:

el 30 de Abr. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by