Linearize a variable have value in one range and 0 otherwise

Occasionally, I encountered a linearization problem: a variable takes one value within a certain range and 0 outside that range. For example,

If \(m_1 \leq x \leq m_2\), then \(y = x\); otherwise, \(y = 0\).

The linearization of this problem is as follows: introduce a binary variable \(z\) and a sufficiently large constant \(M\),

\[\begin{aligned} x&\geq m_1-zM\\ x&\leq m_2+zM\\ y-x&\geq -zM\\ y-x&\leq zM\\ y&\leq (1-z)M\\ y&\geq -(1-z)M \end{aligned}\]



Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Pursuing the paper " Capacitated inventory problems with fixed order costs-some optimal policy structure"
  • Proof for the continuity of a min function
  • A query about one paper
  • Matlab and C++ codes for dynamic programming to solve the knapsack problem
  • Pursuing the paper " cash-flow based dynamic inventory management"