@@ -43,7 +43,7 @@ function update_dist!(b::LazyBridgeOptimizer, constraints)
43
43
changed = false
44
44
for BT in b. bridgetypes
45
45
for (F, S) in constraints
46
- if MOI. supports_constraint (BT, F, S) && all (C -> MOI . supports_constraint (b, C[1 ], C[2 ]), added_constraint_types (BT, F, S))
46
+ if MOI. supports_constraint (BT, F, S) && all (C -> supports_constraint_no_update (b, C[1 ], C[2 ]), added_constraint_types (BT, F, S))
47
47
# Number of bridges needed using BT
48
48
dist = 1 + sum (C -> _dist (b, C[1 ], C[2 ]), added_constraint_types (BT, F, S))
49
49
# Is it better that what can currently be done ?
@@ -59,7 +59,7 @@ function update_dist!(b::LazyBridgeOptimizer, constraints)
59
59
end
60
60
61
61
function fill_required_constraints! (required:: Set{Tuple{DataType, DataType}} , b:: LazyBridgeOptimizer , F:: Type{<:MOI.AbstractFunction} , S:: Type{<:MOI.AbstractSet} )
62
- if MOI . supports_constraint (b . model , F, S) || (F, S) in keys (b . best )
62
+ if supports_constraint_no_update (b , F, S)
63
63
return # The constraint is supported
64
64
end
65
65
if (F, S) in required
99
99
function is_bridged (b:: LazyBridgeOptimizer , F:: Type{<:MOI.AbstractFunction} , S:: Type{<:MOI.AbstractSet} )
100
100
! MOI. supports_constraint (b. model, F, S)
101
101
end
102
+ # Same as supports_constraint but do not trigger `update_constraint!`. This is
103
+ # used inside `update_constraint!`.
104
+ function supports_constraint_no_update (b:: LazyBridgeOptimizer , F:: Type{<:MOI.AbstractFunction} , S:: Type{<:MOI.AbstractSet} )
105
+ return MOI. supports_constraint (b. model, F, S) || (F, S) in keys (b. best)
106
+ end
102
107
function supports_bridging_constraint (b:: LazyBridgeOptimizer , F:: Type{<:MOI.AbstractFunction} , S:: Type{<:MOI.AbstractSet} )
103
108
update_constraint! (b, F, S)
104
109
return (F, S) in keys (b. best)
0 commit comments