I find that JuMP already has part of this nice warning Error message integrated in quering functions, just as the following.
import JuMP, Ipopt
model = JuMP.Model(Ipopt.Optimizer)
JuMP.@variable(model, x >= 1)
JuMP.@objective(model, Min, x)
JuMP.optimize!(model)
JuMP.objective_bound(model) # The following ERROR is approving π
# ERROR: MathOptInterface.GetAttributeNotAllowed
Which embodies the idea mentioned by my post above
function improved_value(model) # in place of the existing `JuMP.value`
if normality
return JuMP.value(model) # returns the existing API
else
error("Sorry, this info is unavailable or invalid!")
end
end
In view of this, the JuMP.objective_bound(CR) # 1.0e100
is weird here (Gurobi12 reports obj_value < obj_bound in a Min-Program?), which doesnβt make any sense.
The expected behavior is also an ERROR message. Do you agree? @odow