In a Linear Programming formulation, stating that a punishment is to be introduced in an objective minimization function if a variable $S$ holds a value above a given constant $K$ ($K = 35$ in the below example), is quite easy:
- Variable $M$ is included in (minimize) objective function such that $M\ge0$ and $S-M-35\le0$.
Exemplified explanation: If $S$ gets value $30$, then $M$ may be kept at $0$, so no punishment in objective function. However, if $S$ gets value $40$ in problem solution, $M$ is forced to at least $5$, and consequently a punishment of $5$ is included, just as desired.
But what if we want to include goodness in objective function if $S$ gets value above $35$? E.g. in the previous example, a value of $S$ equal to $30$ should (still) not influence the objective function. But a value of $S$ equal to $40$ should decrease the objective function cost with $5$.
I originally thought this "swap" from badness to goodness would be easy, but I worked on it for almost a full day without finding a solution...