Hi!

I have a complex nonlinear expression built with JuMP variables. And now I want to find gradient of this expression with respect to these variables.

What package will be helpful in this situation?

Hi!

I have a complex nonlinear expression built with JuMP variables. And now I want to find gradient of this expression with respect to these variables.

What package will be helpful in this situation?

There is no good way to do this in JuMP.

What are you trying to do? You could just write a function and use ForwardDiff.jl?

I’m trying to write the code for transforming bilevel optimization problem to one level using KKT conditions. And I need to pass as a constraint a condition that gradient of Lagrangian of lower level problem with respect to decision variables equals to 0.

Have you seen

https://github.com/joaquimg/BilevelJuMP.jl

It’s a little hard to do this with JuMPs nonlinear interface. But if the subproblems are convex you could just formulate it as a conic program.