model a condition in the objective function

Problems with modeling
Post Reply
Gunners
User
User
Posts: 3
Joined: 4 years ago

model a condition in the objective function

Post 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
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: model a condition in the objective function

Post 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
Post Reply