@@ -222,18 +222,14 @@ function _reformulate_selector(model::Model, func, set::Union{_MOIAtLeast, _MOIA
222
222
dict = _indicator_to_binary (model)
223
223
bvrefs = [dict[lvref] for lvref in func[2 : end ]]
224
224
new_set = _vec_to_scalar_set (set)(func[1 ]. constant)
225
- cref = add_constraint (model,
226
- build_constraint (error, @expression (model, sum (bvrefs)), new_set)
227
- )
225
+ cref = @constraint (model, sum (bvrefs) in new_set)
228
226
push! (_reformulation_constraints (model), cref)
229
227
end
230
228
function _reformulate_selector (model:: Model , func:: Vector{LogicalVariableRef} , set:: Union{_MOIAtLeast, _MOIAtMost, _MOIExactly} )
231
229
dict = _indicator_to_binary (model)
232
230
bvref, bvrefs... = [dict[lvref] for lvref in func]
233
231
new_set = _vec_to_scalar_set (set)(0 )
234
- cref = add_constraint (model,
235
- build_constraint (error, @expression (model, sum (bvrefs) - bvref), new_set)
236
- )
232
+ cref = @constraint (model, sum (bvrefs) - bvref in new_set)
237
233
push! (_reformulation_constraints (model), cref)
238
234
end
239
235
@@ -261,8 +257,7 @@ _isa_literal(v) = false
261
257
function _add_reformulated_proposition (model:: Model , arg:: Union{LogicalVariableRef,_LogicalExpr} )
262
258
func = _reformulate_clause (model, arg)
263
259
if ! isempty (func. terms) && ! all (iszero .(values (func. terms)))
264
- con = build_constraint (error, func, _MOI. GreaterThan (1 ))
265
- cref = add_constraint (model, con)
260
+ cref = @constraint (model, func >= 1 )
266
261
push! (_reformulation_constraints (model), cref)
267
262
end
268
263
return
0 commit comments