Dear team,
I would like to sequentially solve a problem by updating a constraint, the way I do it is to delete and restate the constraint inside a loop. Once the problem is solved and I try to delete the constraint I get the following error “AssertionError: (m.x_sd[ref2id(vi)]).matrix == -1”. I got the error only if I use Mosek as a solver (with SCS everything is ok).
Here is a simple example to replicate the error :
using JuMP
using MosekTools
function error_delete()
m = Model(Mosek.Optimizer)
@variable m x[1:4,1:4]
A = rand(4,4)
#@constraint m c1 A*x*A' in JuMP.PSDCone()
c1 = @constraint(m, A*x*A' in JuMP.PSDCone())
@objective m Min sum(x[i,i] for i=1:4)
for i = 1: 10
delete(m,c1)
#unregister(m,:c1)
B = rand(4,4)
#@constraint m c1 B*x*B' in JuMP.PSDCone()
c1 = @constraint(m,B*x*B' in JuMP.PSDCone())
optimize!(m)
end
end
error_delete()
Am I doing something the wrong way?