Optim.jl icon indicating copy to clipboard operation
Optim.jl copied to clipboard

JuMP Interface, Incorrect Status Returned

Open ccoffrin opened this issue 1 year ago • 5 comments

There seems to be an issue when using Optim as a solver for JuMP in a constrained optimization setting.

If the algorithm terminates but does not satisfy the constraints it currently returns,

  • termination_status of LOCALLY_SOLVED
  • primal status of FEASIBLE_POINT

Per this guide, https://jump.dev/MathOptInterface.jl/stable/manual/solutions/#Local-search-solvers

In this situation it should probably return,

  • termination_status of LOCALLY_INFEASIBLE
  • primal status of INFEASIBLE_POINT

The issue can be reproduced by running this example, https://github.com/lanl-ansi/rosetta-opf/blob/main/debug/optim-jump.jl

CC @blegat

ccoffrin avatar Jan 27 '24 13:01 ccoffrin

Thanks for reporting it!

pkofod avatar Jan 27 '24 15:01 pkofod

We are assuming that converged means LOCALLY_SOLVED: https://github.com/JuliaNLSolvers/Optim.jl/blob/1a649e885c887e84043a48c013130d1a1bdc7ab1/src/MOI_wrapper.jl#L337-L338 Is this an incorrect assumption or should converged be false here ?

blegat avatar Jan 28 '24 08:01 blegat

I am surely not on expert in Optim but based on my brief experience using it, I suspect this function should look something like,

if converged, 
    check if the constraints are satisfied up to the prescribed tolerance
    if yes return `LOCALLY_SOLVED` otherwise return `LOCALLY_INFEASIBLE`

ccoffrin avatar Jan 28 '24 15:01 ccoffrin

Is it possible to give a reproducer here? Then it'd be a bit easier to look into.

pkofod avatar Jan 29 '24 08:01 pkofod

It's not a steam lined example but this code can be used to reproduce,

The issue can be reproduced by running this example, https://github.com/lanl-ansi/rosetta-opf/blob/main/debug/optim-jump.jl

ccoffrin avatar Jan 30 '24 04:01 ccoffrin