Getting duals for nonlinear programming problem

history

#1

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?


#2

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)
x

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)
0.5000000071047659

julia> cos(π/3)
0.5000000000000001

If you’re having problems, try posting a small reproducible example (https://stackoverflow.com/help/mcve).


#3

Hi Orscar!

Thanks.

Your example works here as well…

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

Best,