@@ -16,28 +16,28 @@ abstract type AbstractBridgeOptimizer <: MOI.AbstractOptimizer end
16
16
# AbstractBridgeOptimizer interface
17
17
18
18
"""
19
- isbridged (b::AbstractBridgeOptimizer, F::Type{<:MOI.AbstractFunction},
19
+ is_bridged (b::AbstractBridgeOptimizer, F::Type{<:MOI.AbstractFunction},
20
20
S::Type{<:MOI.AbstractSet})::Bool
21
21
22
22
Return a `Bool` indicating whether `b` tries to bridge `F`-in-`S` constraints
23
23
instead of passing it as is to its internal model.
24
24
"""
25
- function isbridged end
25
+ function is_bridged end
26
26
# Syntactic sugar
27
- function isbridged (b:: AbstractBridgeOptimizer , :: Type{CI{F, S}} ) where {F, S}
28
- return isbridged (b, F, S)
27
+ function is_bridged (b:: AbstractBridgeOptimizer , :: Type{CI{F, S}} ) where {F, S}
28
+ return is_bridged (b, F, S)
29
29
end
30
30
# We don't bridge variables.
31
- isbridged (b:: AbstractBridgeOptimizer , :: Type{VI} ) = false
31
+ is_bridged (b:: AbstractBridgeOptimizer , :: Type{VI} ) = false
32
32
33
33
"""
34
- supportsbridgingconstraint (b::AbstractBridgeOptimizer,
34
+ supports_bridging_constraint (b::AbstractBridgeOptimizer,
35
35
F::Type{<:MOI.AbstractFunction},
36
36
S::Type{<:MOI.AbstractSet})::Bool
37
37
38
38
Return a `Bool` indicating whether `b` supports bridging `F`-in-`S` constraints.
39
39
"""
40
- function supportsbridgingconstraint (:: AbstractBridgeOptimizer ,
40
+ function supports_bridging_constraint (:: AbstractBridgeOptimizer ,
41
41
:: Type{<:MOI.AbstractFunction} ,
42
42
:: Type{<:MOI.AbstractSet} )
43
43
return false
49
49
S::Type{<:MOI.AbstractSet})
50
50
51
51
Return the `AbstractBridge` type to be used to bridge `F`-in-`S` constraints.
52
- This function should only be called if `isbridged (b, F, S)`.
52
+ This function should only be called if `is_bridged (b, F, S)`.
53
53
"""
54
54
function bridge_type end
55
55
94
94
# References
95
95
MOI. is_valid (b:: AbstractBridgeOptimizer , vi:: VI ) = MOI. is_valid (b. model, vi)
96
96
function MOI. is_valid (b:: AbstractBridgeOptimizer , ci:: CI )
97
- if isbridged (b, typeof (ci))
97
+ if is_bridged (b, typeof (ci))
98
98
return MOI. is_valid (b. bridged, ci)
99
99
else
100
100
return MOI. is_valid (b. model, ci)
101
101
end
102
102
end
103
103
MOI. delete (b:: AbstractBridgeOptimizer , vi:: VI ) = MOI. delete (b. model, vi)
104
104
function MOI. delete (b:: AbstractBridgeOptimizer , ci:: CI )
105
- if isbridged (b, typeof (ci))
105
+ if is_bridged (b, typeof (ci))
106
106
if ! MOI. is_valid (b, ci)
107
107
throw (MOI. InvalidIndex (ci))
108
108
end
117
117
# Attributes
118
118
function MOI. get (b:: AbstractBridgeOptimizer ,
119
119
attr:: MOI.ListOfConstraintIndices{F, S} ) where {F, S}
120
- if isbridged (b, F, S)
120
+ if is_bridged (b, F, S)
121
121
list = MOI. get (b. bridged, attr)
122
122
else
123
123
list = MOI. get (b. model, attr)
@@ -145,7 +145,7 @@ function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.NumberOfVariables)
145
145
end
146
146
function MOI. get (b:: AbstractBridgeOptimizer ,
147
147
attr:: MOI.NumberOfConstraints{F, S} ) where {F, S}
148
- if isbridged (b, F, S)
148
+ if is_bridged (b, F, S)
149
149
# The constraints contained in `b.bridged` may have been added by
150
150
# bridges
151
151
return _numberof (b, b. bridged, attr)
209
209
function MOI. get (b:: AbstractBridgeOptimizer ,
210
210
attr:: MOI.AbstractConstraintAttribute ,
211
211
ci:: CI )
212
- if isbridged (b, typeof (ci))
212
+ if is_bridged (b, typeof (ci))
213
213
if MOIU. is_result_attribute (attr)
214
214
MOI. get (b, attr, bridge (b, ci))
215
215
else
@@ -222,15 +222,15 @@ end
222
222
# # Setting names
223
223
function MOI. supports (b:: AbstractBridgeOptimizer , attr:: MOI.ConstraintName ,
224
224
Index:: Type{<:CI} )
225
- if isbridged (b, Index)
225
+ if is_bridged (b, Index)
226
226
return MOI. supports (b. bridged, attr, Index)
227
227
else
228
228
return MOI. supports (b. model, attr, Index)
229
229
end
230
230
end
231
231
function MOI. set (b:: AbstractBridgeOptimizer , attr:: MOI.ConstraintName ,
232
232
constraint_index:: CI , name:: String )
233
- if isbridged (b, typeof (constraint_index))
233
+ if is_bridged (b, typeof (constraint_index))
234
234
MOI. set (b. bridged, attr, constraint_index, name)
235
235
else
236
236
MOI. set (b. model, attr, constraint_index, name)
240
240
function MOI. supports (b:: AbstractBridgeOptimizer ,
241
241
attr:: Union{MOI.ConstraintFunction, MOI.ConstraintSet} ,
242
242
:: Type{CI{F, S}} ) where {F, S}
243
- if isbridged (b, CI{F, S})
243
+ if is_bridged (b, CI{F, S})
244
244
return MOI. supports (b. bridged, attr, CI{F, S}) &&
245
245
MOI. supports (b, attr, concrete_bridge_type (b, F, S))
246
246
else
@@ -249,7 +249,7 @@ function MOI.supports(b::AbstractBridgeOptimizer,
249
249
end
250
250
function MOI. set (b:: AbstractBridgeOptimizer , :: MOI.ConstraintSet ,
251
251
constraint_index:: CI{F, S} , set:: S ) where {F, S}
252
- if isbridged (b, typeof (constraint_index))
252
+ if is_bridged (b, typeof (constraint_index))
253
253
MOI. set (b, MOI. ConstraintSet (), bridge (b, constraint_index), set)
254
254
MOI. set (b. bridged, MOI. ConstraintSet (), constraint_index, set)
255
255
else
@@ -258,7 +258,7 @@ function MOI.set(b::AbstractBridgeOptimizer, ::MOI.ConstraintSet,
258
258
end
259
259
function MOI. set (b:: AbstractBridgeOptimizer , :: MOI.ConstraintFunction ,
260
260
constraint_index:: CI{F, S} , func:: F ) where {F, S}
261
- if isbridged (b, typeof (constraint_index))
261
+ if is_bridged (b, typeof (constraint_index))
262
262
MOI. set (b, MOI. ConstraintFunction (), bridge (b, constraint_index), func)
263
263
MOI. set (b. bridged, MOI. ConstraintFunction (), constraint_index, func)
264
264
else
269
269
# Name
270
270
function MOI. get (b:: AbstractBridgeOptimizer , IdxT:: Type{<:MOI.Index} ,
271
271
name:: String )
272
- if isbridged (b, IdxT)
272
+ if is_bridged (b, IdxT)
273
273
return MOI. get (b. bridged, IdxT, name)
274
274
else
275
275
return MOI. get (b. model, IdxT, name)
@@ -292,16 +292,16 @@ end
292
292
function MOI. supports_constraint (b:: AbstractBridgeOptimizer ,
293
293
F:: Type{<:MOI.AbstractFunction} ,
294
294
S:: Type{<:MOI.AbstractSet} )
295
- if isbridged (b, F, S)
296
- return supportsbridgingconstraint (b, F, S) &&
295
+ if is_bridged (b, F, S)
296
+ return supports_bridging_constraint (b, F, S) &&
297
297
MOI. supports_constraint (b. bridged, F, S)
298
298
else
299
299
return MOI. supports_constraint (b. model, F, S)
300
300
end
301
301
end
302
302
function MOI. add_constraint (b:: AbstractBridgeOptimizer , f:: MOI.AbstractFunction ,
303
303
s:: MOI.AbstractSet )
304
- if isbridged (b, typeof (f), typeof (s))
304
+ if is_bridged (b, typeof (f), typeof (s))
305
305
ci = MOI. add_constraint (b. bridged, f, s)
306
306
@assert ! haskey (b. bridges, ci)
307
307
b. bridges[ci] = concrete_bridge_type (b, typeof (f), typeof (s))(b, f, s)
@@ -312,7 +312,7 @@ function MOI.add_constraint(b::AbstractBridgeOptimizer, f::MOI.AbstractFunction,
312
312
end
313
313
function MOI. modify (b:: AbstractBridgeOptimizer , ci:: CI ,
314
314
change:: MOI.AbstractFunctionModification )
315
- if isbridged (b, typeof (ci))
315
+ if is_bridged (b, typeof (ci))
316
316
MOI. modify (b, bridge (b, ci), change)
317
317
MOI. modify (b. bridged, ci, change)
318
318
else
0 commit comments