I am trying to run solve an optimization problem involving inverse of a matrix in one of its constraints. A simplified version is as follows:
a = [1 1e-3;1e-3 1]
n = 2
f(Q...) = inv(reshape(collect(Q), (n, n)))
g(x...) = reshape(collect(x), (n,n))
NSD = Model(with_optimizer(Ipopt.Optimizer))
@variable(NSD, Q[1:n, 1:n])
@variable(NSD, aux[1:n, 1:n])
register(NSD, :f, n*n, f, autodiff=true)
register(NSD, :g, n*n, g, autodiff=true)
@constraint(NSD, aux .== a)
@NLconstraint(NSD, invconst[i=1:n, j=1:n], f(Q...)[i,j] >= g(aux...)[i,j])
@objective(NSD, Max, 0)
optimize!(NSD)
However, this code keeps showing me the following error message which I am unable to resolve:
LoadError: Cannot divide a quadratic expression by an aff. expression
Can someone please help me figure out the problem here?