Determinant constraints in JuMP

Hi!

I have a question about using imposing determinant as a constraint in JuMP. Currently, I am trying to solve a problem that involve constraints of the form

\det(A) = c \det(B),

where c is a given scalar. A and B are matrices of the same size.

I am aware that there are functions like RootDetConeSquare that can impose constraints of the form \det(A)^{1/d} \geq t. But this is not what I need. So, I am wondering if there is a nice way to do it.

Besides, I also tried using LinearAlgebra.det directly, but it seems the solvers I tried (e.g., KNITRO, Ipopt) do not register the function properly (I suspect that I did not register the operator correctly). Here is a MWE of what I tried:

model = Model(Ipopt.Optimizer)
@variable(model, x[1:3, 1:3])
@variable(model, y[1:3, 1:3])

dett(x...) = LinearAlgebra.det(reshape(collect(x), 3, 3))
@operator(model, f1, 9, (x...) -> dett(collect(x))[1])

@constraint(model, f1(x...) .== .5 * f1(y...))
@objective(model, Max, 1)

optimize!(model)

Any thoughts on this are very much appreciated. Thank you!

1 Like

Here’s the code you’re tying to write:

using JuMP, Ipopt, LinearAlgebra
function op_det_fn(x...)
    xn = isqrt(length(x))
    return LinearAlgebra.det(reshape(collect(x), xn, xn))
end

model = Model(Ipopt.Optimizer)
n = 3
@variable(model, x[1:n, 1:n])
@variable(model, y[1:n, 1:n])
@operator(model, op_det, n^2, op_det_fn)
@constraint(model, op_det(x...) == 0.5 * op_det(y...))
optimize!(model)

I don’t think it will really scale to larger n though.

I also don’t really know any good tricks for reformulating this constraint. But someone else might.

3 Likes