问题
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
回答1:
Use the approach in the question you linked. The expression
Max(c4 * x4, c5 * x5)
can be replaced by a variable x6
, provided that you add the following additional constraints:
x6 >= c4 * x4
x6 >= c5 * x5
So you total set becomes:
Minimize (c1 * x1) + (c2 * x2) + (c3 * x3) + x6 + (c6 * x4) + (c7 * x5)
subject to:
some equality and inequality constraints
and the new requirements:
x6 >= c4 * x4
x6 >= c5 * x5
This works since Max(c4 * x4, c5 * x5)
will either take the value c4 * x4
or c5 * x5
. The introduced variable x6
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.
来源:https://stackoverflow.com/questions/20831074/using-min-max-operator-in-integer-programming