I am trying to optimize an objective function using integer programming, I have to use Max
operator in my function, I want to know is there any way to deal with that?
Actually my question is similar to Using min/max within an Integer Linear Program but is different in some aspects:
- All variables are binary.
- Note that
x4
andx5
are presented in two place. - One possible solution is using auxiliary variables like the answer of similar question, but I am confused when using this solution for my example.
Example:
Minimize (c1 * x1) + (c2 * x2) + (c3 * x3) + Max(c4 * x4, c5 * x5) + (c6 * x4) + (c7 * x5)
subject to
some equality and inequality constraints
Use the approach in the question you linked. The expression
can be replaced by a variable
x6
, provided that you add the following additional constraints:So you total set becomes:
subject to:
and the new requirements:
This works since
Max(c4 * x4, c5 * x5)
will either take the valuec4 * x4
orc5 * x5
. The introduced variablex6
will always be larger or equal to both of these expressions, and so will always be larger or equal to the total max-expression. When properly minimized, x6 will bottom out at the value of the max-expression. So when minimized, the two forms are equivalent.