How to model simply an objective piecewise linear?

333 Views Asked by At

I want to model a linear optimization problem where the objective is piecewise linear i.e.

$ f(x) = A*x+b $ if $x \leq x^*$

$ f(x) = C*x+d $ if $x > x^*$

How can I model it as a linear objective that could "automatically" affect the right value depending on $x$ value (i.e. : how to "give it" to a solver) ?

Thanks for help !