1
votes

Is it possible to model a non-linear piece-wise cost function in Cplex?

For example something like the figures I put here:

enter image description here

non linear piece wise Cost function (black line)

I know one way is to linearising the quadratic part to linear one, but, I want to use the quadratic part as it is.

You can see that the condition is on the decision variable itself, the cost function can be formulated as follows:

if x ≲ x0 Then cost is quadratic part;

else cost is linear part.

Thanks in advance :)

1

1 Answers

1
votes

One way is to pick the cheapest curve at x:

 min cost
 cost ≥ f(x) − Mδ
 cost ≥ g(x) − M(1−δ)
 δ ϵ {0,1}

M is a constant: the largest difference between the two curves (i.e. M=|f(xmax)−g(xmax)|). δ is a binary variable. I assumed we are minimizing cost and that the quadratic function is convex.

This construct implements

 min cost
 cost ≥ f(x)  or  cost ≥ g(x)

The solver will always drop the most expensive function, and keep the cheapest. In your picture this is exactly what we want: on the left of x0 the quadratic function is the cheapest, and on the right of x0, the linear function is cheaper. This formulation will automatically pick the cheaper option.