Getting duals for nonlinear programming problem

Hi Guys!

I’m having problems getting the dual variables for a nonlinear problem, with Ipopt as the solver…

I just found this post here of 2015, but not working here and a bit old:

Any updates on the topic?

Have you tried? Works for me:

julia> using  JuMP, Ipopt

julia> m=Model(solver=IpoptSolver())
Feasibility problem with:
 * 0 linear constraints
 * 0 variables
Solver is Ipopt

julia> @variable(m, 0 <= x <= π / 2)

julia> c = @constraint(m, x >= π / 3)
x >= 1.0471975511965976

julia> @NLobjective(m, Min, sin(x))

julia> solve(m)
This is Ipopt version 3.12.8, running with linear solver mumps.
... lines omitted ...

julia> getdual(c)

julia> cos(π/3)

If you’re having problems, try posting a small reproducible example (How to create a Minimal, Reproducible Example - Help Center - Stack Overflow).

Hi Orscar!


Your example works here as well…

Now I realized that my problem is that Ipopt is letting down while solving the problem…