linear programming to solve conditional equations

1 次查看(过去 30 天)
I am solving a Hydro power system optimization and faced a conditional constraint equation of the form below. have a look and send me your ideas.
it is as follows:
I have a Conditional spillage constraint equation of the form:
  • S(r,t) = V(r,t) - Vrmax *
Where V(r,t) = the reservoir level (volume) in time period t, S(r,t) = spill in time period t and Vrmax is the maximum reservoir volume.
Both V(r,t) and S(r,t) are variables whereas Vrmax is a parameter which i already have the data.
The Condition is:
if S(r,t) >= 0
then V(r,t) = Vrmax (that means V(r,t) takes the value of Vrmax)
and s(r,t) = s(r,t) (that means S(r,t) takes its own value)
else If s(r,t) < 0
then V(r,t) = V(r,t) (that means V(r,t) takes its own value)
and s(r,t) =0 (that s(r,t) takes a value of zero)
In addition there are two upper and lower bound equations for the above variables (V and S):
  • V(r,t) <= Vrmax *
  • S(r,t) >=0 *
my questions are:
1. I was attempting to use the function Linprog to solve the equation. But linprog accepts only coefficients of equation in matrix form which makes it difficult for the above equation since it is conditional. Is there any way I can represent such function in MATLAB linear programming platform using matrix? IF not what else can I do?
2. The three equations inside double asterics are standard equations used in water reservioir simulation. but it is clear that the first equation cant hold true if both the second and third holds true. how can this be managed?
Regards Ashenafi
  2 个评论
Matt J
Matt J 2014-8-17
编辑:Matt J 2014-8-17
Is s(r,t) the same thing as S(r,t)? You use them case-insensitively?
2. ... but it is clear that the first equation cant hold true if both the second and third holds true?
Yes it can. They admit a trivial solution S(r,t)=0, V(r,t)=Vrmax. Clearly though, there is something wrong with the way you have formulated the problem. The solution requires no work at all...
Matt J
Matt J 2014-8-17
编辑:Matt J 2014-8-17
and s(r,t) =0 (that s(r,t) takes a value of zero)
But you have said that this condition occurs when s(r,t)<0. How can you simultaneously have s(r,t)<0 and s(r,t)=0?
And why do you even consider the case s(r,t)<0? later, you stipulate the bound S(r,t)>=0. I'm still presuming s(r,t) and S(r,t) are notation for the same thing. You haven't said otherwise...

请先登录,再进行评论。

回答(1 个)

Johan Löfberg
Johan Löfberg 2014-8-18
编辑:Johan Löfberg 2014-8-18
So you want S = min(V,Vmax)?
This can not be represented in a simple linear program (unless it is maximized in the objective, or only is constrained from below). It can however be represented in a mixed-integer linear program, i.e, by adding binary variables to you model to represent the different cases
Let d be a binary variable and you have two cases
d = 0: S = V, V <= Vmax
d = 1: S = Vmax, V>=Vmax
To implement this using mixed-integer linear programming, you typically use something called big-M modelling.
The MATLAB Toolbox YALMIP (disclaimer, I'm the developer)can help you do this if you don't want to do it manually. For reference, the code would be something like
V = sdpvar(1);
S = sdpvar(1);
d1 = binvar(1);
d2 = binvar(1);
Constraints = [0 <= V <= Vupperbound, 0 <= S <= Vmax]
Constraints = [Constraints, implies(d1, S = V, V <= Vmax];
Constraints = [Constraints, implies(d2, S = Vmax, V >= Vmax];
Constraints = [Constraints, d1 + d2 == 1];
or you let YALMIP modelling machinery take over completely
V = sdpvar(1);
S = sdpvar(1);
Constraints = [0 <= V <= Vupperbound, 0 <= S <= Vmax]
Constraints = [Constraints, S = min(V,Vmax)];
  2 个评论
Maryam Bahramipanah
Hi Johan
I am trying to do the same as you explained here using YALMIP (use binary variables). Which solver you suggested to apply for this problem?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by