Closed ccoffrin closed 2 years ago
You should look at termination_status(model)
and then raw_status_string(model)
. We've gone the route of not throwing an error in optimize!
.
Ok. So if my workflow was originally,
model = JuMP.Model(() -> AmplNLWriter.Optimizer("foo"))
...
JuMP.optimize!(model)
cost = JuMP.objective_value(model)
I am thinking it should be instead,
model = JuMP.Model(() -> AmplNLWriter.Optimizer("foo"))
...
JuMP.optimize!(model)
if JuMP.primal_status(model) == JuMP.NO_SOLUTION
error("my helpful message...")
end
cost = JuMP.objective_value(model)
Yes. You should never query solutions without check the status. Perhaps something like:
if JuMP.primal_status(model) == JuMP.NO_SOLUTION
error("No solution found. Solver reports: $(JuMP.raw_status(model))")
end
Got it! Thanks.
This program's output confused me,
I was expecting at the point of
optimize!(model)
to get an error if there was some issue callingfoo
. Instead the issue does not appear to come up untilobjective_value(model)
. In a less obvious example, it took some time for me to understand thatfoo
was the root cause.Thoughts?