'Linear constraints for nonlinear variable relationship
Assume a mathematical optimization problem with two positive continuous variables:
0 <= x <= 1
0 <= y <= 1000
I am seeking of an efficient way to express in form of linear constraints (possibly with the use of binary/integer variables and big M) the following nonlinear relationship, so the problem can be solved with milp solvers:
when 0 <= y < 200 then x = 0
when y = 200 then 0 <= x <= 1
when 200 < y <= 1000 then x = 1
The numbers 200 and 1000 are indicative.
Are there any direct suggestions or papers/books addressing similar problems?
Solution 1:[1]
I think this will work...
Here's how I think of this. You have 3 states that you need to be aware of, which are the 3 partitions on the domain of y. So, 2 binary variables can capture these 3 states. In order to keep things linear, you will need to work with non-strict inequalities. So define:
y_lb ? {0, 1} and let y_lb = 1 if y >= 200
y_ub ? {0, 1} and let y_ub = 1 if y <= 1000
so now we have our partitions set up in terms of a truth table for y_lb and y_ub:
y y<200 200<=y<=1000 y>1000
y_lb 0 | 1 | 1
y_ub 1 | 1 | 0
Now we can easily link that truth table to constrain x:
x ? Reals
x <= y_lb
x >= 1 - y_ub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AirSquid |
