JuMP--how to take the gradient of quadratic constraints?

You can do something similar, and get the coefficient of a quadratic expression: Expressions · JuMP

func_set = constraint_object(r)
c = coefficient(func_set.func, x, y)  # quadratic coefficient of x * y
c = coefficient(func_set.func, x)     # affine coefficient of x

See also Computing Hessians · JuMP

1 Like