Differential equation system in Optimization Toolbox

조회 수: 1 (최근 30일)
Artyom
Artyom 2012년 4월 30일
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
Richard Brown
Richard Brown 2012년 4월 30일
Are the z variables constrained to take on integer values?
Artyom
Artyom 2012년 4월 30일
No, it can take any values. Except constraints of course.

댓글을 달려면 로그인하십시오.

답변 (1개)

Richard Brown
Richard Brown 2012년 5월 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)

카테고리

Help CenterFile Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by