Solving nonlinear constrained optimization problem

Please don’t :laughing: the @NL interface is now legacy (see ANN: JuMP v1.15 is released) and it should not be encouraged for new uses. Also, it means the constraint is added as a generic nonlinear constraint. If you use @constraint JuMP and Ipopt can detect it as quadratic.

global x1 =value.(x);

Also, don’t use global. Return the value from the function with

    return value.(x), JuMP.objective_value(model)

and then call it as

x1, obj = main(A)

model.xtol_rel = 1e-6;

This I not valid JuMP syntax.

You can see the full list of Ipopt options here: Ipopt: Ipopt Options

The way to set an option is set_attribute(model, "tol", 1e-6).