plasmo-dev / Plasmo.jl

A Platform for Scalable Modeling and Optimization
Other
150 stars 21 forks source link

function optimize!(...) does not return JuMP termination status #22

Closed etatara closed 3 years ago

etatara commented 3 years ago

in the plasmo solve.jl, the function function JuMP.optimize!(graph::OptiGraph,optimizer;kwargs...) always return an empty (nothing) status from the JuMP.optimize!(...) call. Using the JuMP.termination_status however does work as follows:

model = Plasmo.getmodel(optinode)
JuMP.set_optimizer(optinode,optimizer)
JuMP.optimize!(model)  #,optimizer;kwargs...)
status = JuMP.termination_status(model)

It would be nice to update this function as there's no other way to get the JuMP termination status of the model from the Plasmo.optimize!() functions.

jalving commented 3 years ago

Before the major transition to MOI, JuMP returned the status, which just got passed through to Plasmo.jl. I think in the short term, I will go ahead and cache a reference to the underlying JuMP model that gets constructed in an optigraph. Then we can just write a few functions to get termination_status, primal_status, etc... that will work for an optigraph. I should be able to update the master branch to try out this week.

One of the improvements I would like to make is to make a more direct interface to MathOptInterface. This would also make model construction faster when using standard solvers. We can always keep the option to build a JuMP model too.

jalving commented 3 years ago

I went ahead and added JuMP.termination_status(::OptiGraph). I also added primal_status,dual_status, and raw_status for convenience. All of these functions just reference the internal optinode model that gets built during aggregation. You can access the internal model with getmodel(::OptiGraph) after you run optimize!

You can also look at the current optinode and reference map in the optigraph obj_dict after you run optimize!. The reference map is mapping between variables and constraints created on optinodes to the variables and constraints in the internal model.

I updated to v0.3.2. You should be able to just update to try it out.

jalving commented 3 years ago

Closing now that optigraph uses termination status.