linear ODE as a constraint within an milp problem

1 view (last 30 days)
Good Morning,
I have a syntax question regarding a milp problem that I would like to solve with intlinprog function:
My objective function that I would like to minimize is f = 2 x1 + 3 x2 where x1 and x2 are binary variables.
Furthermore,
y01 = 5 x1 & y02 = 5 x2
where y01 and y02 are the initial conditions used to solve following first order linear ODE system:
dy1/dl = -a0 & dy2/dl = b0
y1 and y2 over whole interval L are calculated by iterational solving of the ODE system using ODE45 (since the parameters a0 and b0 are different on each small interval)
Now I have a constraint which is C sum(y1) + D sum(y2) < 100.
Following documentation it is easy to define the objective function and the binary variables:
f=[2;3];
intcon=1:2
However now I have no idea how to integrate the solving of the ODE routine into the constraint expression.
Can you give some hint?
Thanks!!

Accepted Answer

Matt J
Matt J on 24 Sep 2019
Well, I take it that a0, b0, C and D are known constants, so the ODEs have trivial analytical solutions
y1=5*x1-a0*l
y2=5*x2-b0*l
and so the constraint reduces to a simple linear inequality
C*(5*N*x1-a0*sum(l)) + D*(5*N*x2+b0*sum(l))<=100
  1 Comment
Lenilein
Lenilein on 24 Sep 2019
Thank you Matt! I realized I had simplified the problem too much after posting it. Will try to express it again in a new post!

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!