Skip to content

Commit 313eadb

Browse files
committed
Skip modifying constraints that are zero-dimensional
1 parent 83048f2 commit 313eadb

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

src/models.jl

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,24 @@ function modify_subproblem(int_sol::Vector{Int}, opt::Optimizer)
206206
# TODO maybe also modify the objective constant using dot(opt.c_int, int_sol), could be nonzero
207207
moi_model = JuMP.backend(opt.subp_model)
208208

209-
new_b = opt.b_cont - opt.A_int * int_sol
210-
MOI.modify(
211-
moi_model,
212-
JuMP.index(opt.subp_eq),
213-
MOI.VectorConstantChange(new_b),
214-
)
215-
216-
new_h = opt.h - opt.G_int * int_sol
217-
for (cr, idxs) in zip(opt.subp_cones, opt.subp_cone_idxs)
209+
if length(opt.b_cont) > 0
210+
new_b = opt.b_cont - opt.A_int * int_sol
218211
MOI.modify(
219212
moi_model,
220-
JuMP.index(cr),
221-
MOI.VectorConstantChange(new_h[idxs]),
213+
JuMP.index(opt.subp_eq),
214+
MOI.VectorConstantChange(new_b),
222215
)
223216
end
217+
new_h = opt.h - opt.G_int * int_sol
218+
for (cr, idxs) in zip(opt.subp_cones, opt.subp_cone_idxs)
219+
if length(idxs) > 0
220+
MOI.modify(
221+
moi_model,
222+
JuMP.index(cr),
223+
MOI.VectorConstantChange(new_h[idxs]),
224+
)
225+
end
226+
end
224227
return
225228
end
226229

0 commit comments

Comments
 (0)