Good evening!
I have set my objective function as a constant to check if the constraints set is feasible and JuMP returns an error. It seems like JuMP does not allow constant objective functions.
Here is an example.
using JuMP, Gurobi
m = Model(with_optimizer(Gurobi.Optimizer))
@variable(m, x)
@objective(m, Min, 3)
optimize!(m)
This returns an error:
ERROR: LoadError: The objective function `3` is not supported by JuMP.
Stacktrace:
[1] set_objective(::Model, ::MathOptInterface.OptimizationSense, ::Int64) at /Users/jipkim/.julia/packages/JuMP/jnmGG/src/objective.jl:87
[2] top-level scope at /Users/jipkim/.julia/packages/JuMP/jnmGG/src/macros.jl:977
However, if I replace the constant objective by 0*x, then it works fine.
@objective(m, Min, 0*x)
I just verified that this does not happen on Julia 0.6.4/ JuMP v.018.
Is a constant objective function depreciated on JuMP v0.19? If so, is there any better way to check the model feasibility?
Thanks!