coin-or / SHOT

A solver for mixed-integer nonlinear optimization problems
https://shotsolver.dev
Eclipse Public License 2.0
119 stars 25 forks source link

Constants in objective is not passed on from CoinModel to OsiClpSolverInterface #131

Closed andreaslundell closed 3 years ago

andreaslundell commented 3 years ago

A constant to the coinModelobject at https://github.com/coin-or/SHOT/blob/4742193a15b0401ebec5953cd481168c9ba3f6b0/src/MIPSolver/MIPSolverCbc.cpp#L211

does not seem to get passed on to the osiInterface object at

https://github.com/coin-or/SHOT/blob/4742193a15b0401ebec5953cd481168c9ba3f6b0/src/MIPSolver/MIPSolverCbc.cpp#L289

I am unsure if this is a bug, or that the OsiClpSolverInterface class does not support constants in the objective (I cannot seem to find a way to manually set a constant in the OsiClpSolverInterface class).

I can work around this by manually adding the constant here and there in the MIPSolverCbc class, but if there is an easier way I would prefer it... Any suggestions @svigerske?

svigerske commented 3 years ago

There is a parameter in Osi to set an objective offset: https://github.com/coin-or/Osi/blob/master/src/Osi/OsiSolverParameters.hpp#L77 I haven't look whether loadFromCoinModel sets this parameter, or whether OsiClp is ignoring it.

andreaslundell commented 3 years ago

Fixed in c898dd847e5d779be9760d3c31abaa1a09509557