@@ -142,7 +142,7 @@ MOI.attribute_value_type(::ListOfNonstandardBridges) = Vector
142142
143143MOI. is_copyable (:: ListOfNonstandardBridges ) = false
144144
145- MOI. get_fallback (model :: MOI.ModelLike , :: ListOfNonstandardBridges ) = Type[]
145+ MOI. get_fallback (:: MOI.ModelLike , :: ListOfNonstandardBridges ) = Type[]
146146
147147function _test_structural_identical (
148148 a:: MOI.ModelLike ,
@@ -191,12 +191,8 @@ function _test_structural_identical(
191191 f_b = try
192192 MOI. get (b, MOI. ConstraintFunction (), ci)
193193 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
200196 end
201197 f_b = MOI. Utilities. map_indices (x_map, f_b)
202198 s_b = MOI. get (b, MOI. ConstraintSet (), ci)
227223_runtests_error_handler (err, :: Bool ) = rethrow (err)
228224
229225function _runtests_error_handler (
230- err:: MOI.GetAttributeNotAllowed{MOI.ConstraintFunction} ,
226+ err:: Union {
227+ MOI. GetAttributeNotAllowed{MOI. ConstraintFunction},
228+ MOI. GetAttributeNotAllowed{MOI. ConstraintPrimalStart},
229+ },
231230 cannot_unbridge:: Bool ,
232231)
233232 if cannot_unbridge
@@ -328,7 +327,15 @@ function runtests(
328327 Test. @test MOI. get (model, attr, ci) === nothing
329328 start = _fake_start (constraint_start, set)
330329 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
332339 end
333340 end
334341 end
@@ -416,7 +423,7 @@ _fake_start(value, ::MOI.AbstractScalarSet) = value
416423
417424_fake_start (value, set:: MOI.AbstractVectorSet ) = fill (value, MOI. dimension (set))
418425
419- _fake_start (value:: AbstractVector , set :: MOI.AbstractVectorSet ) = value
426+ _fake_start (value:: AbstractVector , :: MOI.AbstractVectorSet ) = value
420427
421428function _bridged_model (Bridge:: Type{<:Constraint.AbstractBridge} , inner)
422429 return Constraint. SingleBridgeOptimizer {Bridge} (inner)
0 commit comments