@@ -142,7 +142,7 @@ MOI.attribute_value_type(::ListOfNonstandardBridges) = Vector
142
142
143
143
MOI. is_copyable (:: ListOfNonstandardBridges ) = false
144
144
145
- MOI. get_fallback (model :: MOI.ModelLike , :: ListOfNonstandardBridges ) = Type[]
145
+ MOI. get_fallback (:: MOI.ModelLike , :: ListOfNonstandardBridges ) = Type[]
146
146
147
147
function _test_structural_identical (
148
148
a:: MOI.ModelLike ,
@@ -191,12 +191,8 @@ function _test_structural_identical(
191
191
f_b = try
192
192
MOI. get (b, MOI. ConstraintFunction (), ci)
193
193
catch err
194
- if cannot_unbridge &&
195
- err isa MOI. GetAttributeNotAllowed{MOI. ConstraintFunction}
196
- continue
197
- else
198
- rethrow (err)
199
- end
194
+ _runtests_error_handler (err, cannot_unbridge)
195
+ continue
200
196
end
201
197
f_b = MOI. Utilities. map_indices (x_map, f_b)
202
198
s_b = MOI. get (b, MOI. ConstraintSet (), ci)
227
223
_runtests_error_handler (err, :: Bool ) = rethrow (err)
228
224
229
225
function _runtests_error_handler (
230
- err:: MOI.GetAttributeNotAllowed{MOI.ConstraintFunction} ,
226
+ err:: Union {
227
+ MOI. GetAttributeNotAllowed{MOI. ConstraintFunction},
228
+ MOI. GetAttributeNotAllowed{MOI. ConstraintPrimalStart},
229
+ },
231
230
cannot_unbridge:: Bool ,
232
231
)
233
232
if cannot_unbridge
@@ -328,7 +327,15 @@ function runtests(
328
327
Test. @test MOI. get (model, attr, ci) === nothing
329
328
start = _fake_start (constraint_start, set)
330
329
MOI. set (model, attr, ci, start)
331
- Test. @test MOI. get (model, attr, ci) ≈ start
330
+ returned_start = try
331
+ MOI. get (model, attr, ci)
332
+ catch err
333
+ # For a Constraint bridge for which the map is not invertible, the constraint primal cannot
334
+ # be inverted
335
+ _runtests_error_handler (err, Bridge <: MOI.Bridges.Constraint.AbstractBridge && cannot_unbridge)
336
+ continue
337
+ end
338
+ Test. @test returned_start ≈ start
332
339
end
333
340
end
334
341
end
@@ -416,7 +423,7 @@ _fake_start(value, ::MOI.AbstractScalarSet) = value
416
423
417
424
_fake_start (value, set:: MOI.AbstractVectorSet ) = fill (value, MOI. dimension (set))
418
425
419
- _fake_start (value:: AbstractVector , set :: MOI.AbstractVectorSet ) = value
426
+ _fake_start (value:: AbstractVector , :: MOI.AbstractVectorSet ) = value
420
427
421
428
function _bridged_model (Bridge:: Type{<:Constraint.AbstractBridge} , inner)
422
429
return Constraint. SingleBridgeOptimizer {Bridge} (inner)
0 commit comments