Dear All,
Is there any other way to apply an If - Else function for any constraint in Gurobi?
I'm doing a Linear Program optimization, where one of the variables would only be made If a certain condition was met.
The code looks like this:
Buy = m.addVar(...)
Sell = m.addVar(...)
Battery Status = m.addVar (...)
If Battery Status == 100:
con1 = m.addConstr(Sell == Generation - Consumption)
else:
con2 = m.addConstr(Sell == 0)
con3 = m.addConstr(Buy == Consumption - Generation)
data = The consumption could be higher or lower than the generation
So I'm pretty stuck with this as I know that If Else was not allowed for an LP
Any ideas would be very much welcomed!
Thank you!