Inconsistance between @NLobjective and @objective

Let’s consider the following model:

model = Model(with_optimizer(Ipopt.Optimizer))
@variable(model, x >= 0)
@variable(model, y >= 1)

Then the macro @objective can be used both as:

@objective(model, Min, x+2*y)


@objective model Min begin

The macro @NLobjective however can be used only as:

@NLobjective(model, Min, exp(x)+y)

But NOT as:

@NLobjective model Min begin

The above script would indeed lead to weird error messages.

Should it be reported as a bug ?
The best solution for me would be to uniform the two APIs, but at least a better error message could be provided…

1 Like

Yes, thanks for letting us know. Please file an issue with the error you get.

Thanks, done: Inconsistance between @NLobjective and @objective · Issue #2448 · jump-dev/JuMP.jl · GitHub