Page 1 of 1

model a condition in the objective function

Posted: Sat Nov 07, 2020 6:18 pm
by Gunners
hi, I would like to model a condition in my objective function.
I explain the problem to make myself better understood.
I would like to model how energy exchange works in place. this says that if the emergency introduced into the network (Es) is less than that taken from the network (Ep), it will appear at a certain price (0.15). if, on the other hand, I put on the network a quantity higher than the one I withdraw, the excess part (Es-Ep) I sell it at a lower price (0.05).

So my OF: 0.15 * min (Ep; Es) + 0.05 * min (0; Es-Ep).

or to explain myself better: 0.15*Es if Es<Ep
0.15*Ep+0.05*(Es-Ep) if Es>Ep

Re: model a condition in the objective function

Posted: Sun Nov 08, 2020 7:23 pm
by abhosekar
The last two conditions that are mentioned are not consistent. I assume your objective function is following:
0.15 * min (Ep; Es) + 0.05 * max (0; Es-Ep).
Also, since you are selling, I assume you want to maximize your objective function.

One way to do this is following:
Rewrite the objective as follows:
0.15 * E1 + 0.05 * E2
Define a binary variable y which is 1 if Ep is higher and 0 otherwise.
E1 =l =Ep;
E1 =l= Es;
E1 =g= Ep - M1*y;
E1 =g= Es - M2*(1-y);

M1 and M2 can be chosen wisely using the bounds on Es and Ep.

M1, M2 are big-M constants (not too big).Since your objective is maximization, you can replace max with just two constraints as follows:
E2 =g= 0;
E2 =g= Es - Ep;

- Atharv