DiffOpt.jl icon indicating copy to clipboard operation
DiffOpt.jl copied to clipboard

Differentiation of conic programs with nonlinear parametric expressions

Open frapac opened this issue 1 month ago • 1 comments

DiffOpt does not support differentiating a conic program if the problem's data depends nonlinearly from the parameters (e.g. if A(theta) x <= b(theta) with A(.) and b(.) given by nonlinear expressions).

Here is a simple MWE:

using JuMP
using Clarabel
using DiffOpt

model = DiffOpt.diff_model(Clarabel.Optimizer)
@variable(model, x >= 0)
@variable(model, θ ∈ MOI.Parameter(1.0))
@objective(model, Min, x)
@constraint(model, sin(θ) * x >= 1.0)
JuMP.optimize!(model)


If we replace Clarabel by Ipopt, the code works like a charm. But Clarabel works much better than Ipopt if the problem is conic.

We can use the chain-rule to differentiate the problem w.r.t. A instead of theta. However, I think it would be more intuitive to support nonlinear expressions depending on the parameters in DiffOpt. What do you think?

frapac avatar Dec 08 '25 10:12 frapac

I also faced the same issue, we should start by adding support for ScalarNonlinearFunction in ParametricOptInterface.

blegat avatar Dec 09 '25 12:12 blegat