I have to define a variable based on the decision variable (Var[i]), this is what I want to express: if var[i] >= 0, b[i] = 1.08; else b[i] = 0.91 What I wrote was :
var=LpVariable.dicts("Var", df.index, lowBound=-2, upBound=2, cat="Continuous")
b={}
for i in df.index:
if var[i] >= 0.0:
b[i] = 1.08
else:
b[i] = 0.91
However, it turned out that all b[i] were 1.08...; I searched for the problems, and found that it should be repleced by Big M method. But I still can't catch how to derive it.
Aucun commentaire:
Enregistrer un commentaire