There appears to be an issue with the barrier solver when using the PWLObj functionality.
A pair of reproductions of the issue is attached.
Model A:
Model A0 and model A1 logically describe the exact same QP model, the only difference is that A1 uses PWLObj, while A0 does not. However, Gurobi returns -15.28 for the objective function for A0, and -12.54 for A1 (See the attached files model-a[0|1].[lp|sol])
Manually computing the value of the objective function for the solutions provided show that -15.28 is indeed the correct value for A0, while -16.63 is the true value of the objective function at the solution provided by Gurobi for model A1, not -12.54 as claimed.
To see that it is the combination of the barrier solver and the PWLObj which is causing the error, note that:
- If the quadratic term from the objective function is removed ([ - 20 xp_1 ^2 - 40 xp_1 * xn_1 - 20 xn_1 ^2 - 2 dp_1 ^2 ] / 2) from both models, then the LP solver is used instead of the barrier solver, and both modified models give the same answer (-15.28) (See the attached files model-a[0|1]-noq.[lp|sol]). Note that this is the same value of the objective function above, as it turns out that the quadratic term is zero at the solution, although the values of the variables at the solution are different.
- Alternatively, if the PWLObj terms are removed instead of the quadratic terms, the barrier solver gives the same answer for both modified models (-13.49) (See the attached files model-a[0|1]-nopwl.[lp|sol])
Model B:
Model B0 and B1 logically describe the same QCP model, again the only difference is that B1 uses PWLObj, while B0 does not. However, Gurobi returns 0.134 for the objective function for B0, and 0.321 for B1.
Manually computing the value of the objective function for the solutions provided show that 0.134 is indeed the correct value for B0, while -1.092 is the true value of the objective function at the solution for model B1, not 0.321 as claimed.
In fact, the sum of all terms in the objective function except for the piecewise linear terms at the solution for B1 is 0.321, which suggests that the piecewise linear terms are somehow being left out of the optimization. This is despite the fact that the Gurobi console output states "Model has 58 piecewise-linear objective terms" when loading the model.
If the quadratic constraint is removed from both models, then the LP solver is used and both modified models return 0.134 for the final value of the objective function, indicating again that the issue lies with the barrier solver.
If the piecewise linear terms are removed from both models, then both modified models return 0.321 for the final value of the objective function - which matches the value returned for unmodified B1 model, again indicating that the piecewise linear terms are not being taken into account in the optimization by the barrier algorithm for the unmodified model B1.