@@ -530,6 +530,48 @@ function test_set_inner_constraint_attribute()
530530 return
531531end
532532
533+ function test_bridging_cost_consistent_with_supports ()
534+ # `UniversalFallback.supports_constraint` and
535+ # `supports_add_constrained_variable(s)` accept absolutely anything by
536+ # forwarding through their `is_bridged`-style catch-all. The bridging-cost
537+ # attributes must agree: they should never return `Inf` for a pair that
538+ # `supports_*` claims to support, because that would make
539+ # `LazyBridgeOptimizer` treat the node as unreachable and break graph
540+ # construction. Use `Model{BigFloat}` so the inner model genuinely does
541+ # not support `*Cone{Float64}`, exercising the case where
542+ # `UniversalFallback` extends support beyond the inner.
543+ model = MOI. Utilities. UniversalFallback (MOI. Utilities. Model {BigFloat} ())
544+ for (F, S) in (
545+ # inner supports natively
546+ (MOI. ScalarAffineFunction{BigFloat}, MOI. LessThan{BigFloat}),
547+ (MOI. VectorOfVariables, MOI. PowerCone{BigFloat}),
548+ # inner does not support; UF stores in its own dict
549+ (MOI. ScalarAffineFunction{Float64}, MOI. LessThan{Float64}),
550+ (MOI. VectorOfVariables, MOI. PowerCone{Float64}),
551+ (MOI. VectorAffineFunction{BigFloat}, MOI. Test. UnknownVectorSet),
552+ )
553+ @test MOI. supports_constraint (model, F, S)
554+ @test MOI. get (model, MOI. ConstraintBridgingCost {F,S} ()) < Inf
555+ end
556+ for S in (
557+ MOI. GreaterThan{BigFloat},
558+ MOI. Integer,
559+ MOI. GreaterThan{Float64}, # not natively supported by Model{BigFloat}
560+ )
561+ @test MOI. supports_add_constrained_variable (model, S)
562+ @test MOI. get (model, MOI. VariableBridgingCost {S} ()) < Inf
563+ end
564+ for S in (
565+ MOI. Nonnegatives,
566+ MOI. PowerCone{BigFloat},
567+ MOI. PowerCone{Float64}, # not natively supported by Model{BigFloat}
568+ )
569+ @test MOI. supports_add_constrained_variables (model, S)
570+ @test MOI. get (model, MOI. VariableBridgingCost {S} ()) < Inf
571+ end
572+ return
573+ end
574+
533575end # module
534576
535577TestUniversalFallback. runtests ()
0 commit comments