8
$\begingroup$

This is (hopefully) an easy answer but I haven't dealt with this before.

I have a MILP which includes an unbounded, continuous decision variable. However, I generally don't want this decision variable to take negative values, so I want to include a penalty in the objective function where there is zero penalty incurred for a positive value, but for negative values, the penalty is proportional to the absolute value. Basically, I want a value of -100 to be penalized twice as much as -50, and 10x as much as -10.

Right now I have formulated an indicator variable that is 1 if the decision variable is negative, which incurs a penalty; but this penalty is the same for any negative value.

Any suggestions on how to implement this?

$\endgroup$

2 Answers 2

16
$\begingroup$

If $x$ denotes your free variable, you can penalize the term $f(x)=\max\{-x,0\}$ in your objective function, which you can linearize by replacing it with a variable $y$, and constraints $y\ge -x, y\ge 0$.

$\endgroup$
2
  • $\begingroup$ Another good approach. +1 $\endgroup$
    – RobPratt
    Mar 7, 2022 at 20:46
  • 1
    $\begingroup$ I like this a lot. I'll then just put -y in the objective function (since it's a maximization). Thanks $\endgroup$ Mar 8, 2022 at 2:21
12
$\begingroup$

You do not need to introduce an indicator variable. Suppose $x$ is your free variable. Introduce nonnegative variables $x^+$ and $x^-$, replace $x$ with $x^+-x^-$ throughout, and penalize $x^-$ linearly in the objective.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.