分段函数线性化建模

Modeling piecewise linear functions

Piecewise linear functions can be modeled using variables that satisfy what is known as a special order set (SOS) constraint of type 2. Consider the following example of a continuous piecewise linear function: 

 

\begin{displaymath}z = \left\{ \begin{array}{rl}3+4x & \mbox{for } 0 \leq x \l......q 3 \\6+x & \mbox{for } 3 \leq x \leq 7.\end{array} \right.\end{displaymath}

 

 

The variable x is restricted to lie between 0 and 7.

 

We introduce four nonnegative continuous variables x1, x2, x3, and x4. We require 

 

x = 0x1 + 2x1 + 3x2 + 7x3, (1)

 

 

so the coefficients are the endpoints of the three intervals in the function. We also require 

 

 

 

 

x1+x2+x3+x4 = 1, (2)

 

 

the same method we used for modeling a variable that takes a number of distinct values. Here, x is continuous, so we allow the xi to be continuous. We can now define z as 

 

 

 

 

z = 3x1+11x2+9x3+13x4 (3)

 

 

so the coefficients are the values of z at the breakpoints.

 

The calculated value of z is not accurate if, for example, x1=0.5 and x4=0.5. The restriction we need to impose is that at most two of the xi can be nonzero, and the two nonzero xi must be adjacent. This is known as a SOS-2 constraint, that is, a special order set of type 2 constraint.

The SOS-2 restriction can be modeled using binary variables yi$i=1,\ldots,4$:

 

 

分段函数线性化建模_第1张图片

 

 

 

转自     John Mitchell    [email protected]

联系我:ligong15 AT foxmail.com

你可能感兴趣的:(数学建模)