This is a follow up to this question: Non-Linear objective function due to piecewise component

Consider a piecewise function but now with three segments but the objective remains the same as:


Where $x_n$ is the decision variable. However, $prob_n$ is now defined as:

$prob_{n} = $

\begin{cases} 0.25, & x_n \geq 2 \\ 0, & 0 < x_n < 2 \\ 0.05, & x \leq 0 \\ \end{cases} I tried modifying the approach outlined by @Reinderien but I am unsure if I am on the right path.

First I re-write the objective as:

$\sum_{n}(1-0.05 - (0.20 d_{1,n} - 0.05 d_{2,n}))(1+x_n)$

Where $d_{1,n}$ and $d_{2,n}$ are binary variables.

Expanding this further I re-write it as:

$\sum_{n}(0.95 + 0.95x_{n} - 0.2d_{1,n} - 0.2x_{n}d_{1,n} + 0.05d_{2,n} + 0.05x_{n}d_{2,n})$

Now we have two non-linear terms so my guess is that I need two auxiliary variables, $x_{n}^{'}$ and $x_{n}^{''}$. But before introducing the auxiliary variables, my problem is that I am unsure how to re-write this using big-M. This is my initial attempt:

$x_n \geq M_1d_{1,n}$

$x_n \geq 2 - M_2(1-d_{1,n})$

$x_{n} \leq 2 - M_{3}d_{2}$

$x_{n} \leq M_{4} (1 - d_{1,n} - d_{2,n})$

But after this I am not sure how to continue. I was able to verify the constraints suggested by @Reinderien but I cannot extend it to the three segment case.

  • $\begingroup$ I would suggest trying with 3 binary variables, one for each segment. $\endgroup$
    – BenBernke
    Commented Nov 4, 2023 at 20:03


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.