-
Notifications
You must be signed in to change notification settings - Fork 63
Description
I have a dict container of VariableRef and it looks like this
model[:a] = Dict{Int64,Vector{ConstraintRef}}()and it is populated as below
model[:a][k] = @inbounds @constraint(model, [i = 1:num_of_blocks], x[i] <= mws[i] * (1 - u[i]))where x is a vector of continuous vars and u is a vector of binary vars. When I tried to fix u JUST in this constraint container (instead of fix globally) by removing the constraints using delete(model, model[:a][k]) and then adding the "fixed" constraints again like
model[:a][k] = @inbounds @constraint(model, [i = 1:num_of_blocks], x[i] <= mws[i] * (1 - uv[i])) # uv is the value.(u)I would get weird dual value (0.0) from an equality constraint in the relaxed model (the context is optimal power flow so you need relaxed model in order to calculate the system lambda). The correct dual value should be 30-ish and I can get the correct result if 1) I added the above "fixed" constraints as additional cut instead of deleting the original constraints, or 2) I dont delete and add any constraints. I know its very hard to reproduce based on the description, but I am just wondering if this delete&add anonymous constraints in direct model has some potential issues.