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 x+2*y end
The macro @NLobjective however can be used only as:
@NLobjective(model, Min, exp(x)+y)
But NOT as:
@NLobjective model Min begin exp(x)+y end
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…