Get Lagrange multipliers from Ipopt with Optimization.jl

Hi everyone!

I’m working with the Julia packages Optimization.jl and Ipopt.jl to solve a nonlinear programming (NLP) problem.

I’m successfully solving the problem, but I need to extract the final Lagrange multipliers (dual variables) associated with the constraints.

Specifically, how can I retrieve the duals (\lambda) for the general nonlinear constraints, defined as:
l_c \le c(\mathbf{x}) \le u_c

The solution object (sol) from Optimization.solve() doesn’t have a direct dual() function like JuMP.

Could anyone provide a concise example of how to access these dual values from the sol object?

Thanks in advance for your help!

See How can you get the Lagrange/KKT multipliers out of JuMP when using Ipopt? - #3 by stevengj and Lagrangian Function - #19 by stevengj