what can substitute max function?

Problems with modeling
Post Reply
omnia_nabil
User
User
Posts: 5
Joined: 4 years ago

what can substitute max function?

Post by omnia_nabil »

Hello, could you please help me?
How can I model the following equations without using max function?
image.png
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: what can substitute max function?

Post by abhosekar »

Problem specific solution to the problem may be difficult to understand. However, for a constraint such as z=max(x, y), this problem can be solved and the same idea can be extended to model the constraints shown in the question.

z = max(x, y) can be modelled as z =g=x and z =g= y if the objective is to minimize z (the problem structure helps minimization of z).
If that's not the case, a more elaborate approach is needed.
Assume x_l and x_u are lower and upper bounds on the variable x.
Similarly, y_l and y_u are lower and upper bounds on the variable y.

Following constraints need to be added to replace z = max(x, y) where p is a binary variable.
z =g= x; z =g= y;
z =l= x + (y_u - x_l)*p;
z =l= y + (x_u - y_l)*(1-p);

Here, p automatically takes the value of 1 if y > x and 0 otherwise.
Post Reply