@@ -2111,6 +2111,47 @@ function test_constrained_variables()
21112111 return
21122112end
21132113
2114+ function test_constraint_bridging_cost_quadratic ()
2115+ # POI rewrites `Vector/ScalarQuadraticFunction` constraints into their
2116+ # affine counterparts at solve time, so `supports_constraint` for the
2117+ # quadratic variant delegates to the affine one. `ConstraintBridgingCost`
2118+ # must do the same: otherwise `LazyBridgeOptimizer` sees
2119+ # `supports = true, cost = Inf` and treats the node as unreachable when
2120+ # building the bridge graph.
2121+ optimizer = POI. Optimizer (SCS. Optimizer)
2122+ for S in (MOI. Zeros, MOI. Nonnegatives, MOI. SecondOrderCone)
2123+ @test MOI. supports_constraint (
2124+ optimizer,
2125+ MOI. VectorQuadraticFunction{Float64},
2126+ S,
2127+ )
2128+ @test MOI. get (
2129+ optimizer,
2130+ MOI. ConstraintBridgingCost {MOI.VectorQuadraticFunction{Float64},S} (),
2131+ ) == MOI. get (
2132+ optimizer,
2133+ MOI. ConstraintBridgingCost {MOI.VectorAffineFunction{Float64},S} (),
2134+ )
2135+ end
2136+ optimizer = POI. Optimizer (HiGHS. Optimizer)
2137+ for S in
2138+ (MOI. LessThan{Float64}, MOI. GreaterThan{Float64}, MOI. EqualTo{Float64})
2139+ @test MOI. supports_constraint (
2140+ optimizer,
2141+ MOI. ScalarQuadraticFunction{Float64},
2142+ S,
2143+ )
2144+ @test MOI. get (
2145+ optimizer,
2146+ MOI. ConstraintBridgingCost {MOI.ScalarQuadraticFunction{Float64},S} (),
2147+ ) == MOI. get (
2148+ optimizer,
2149+ MOI. ConstraintBridgingCost {MOI.ScalarAffineFunction{Float64},S} (),
2150+ )
2151+ end
2152+ return
2153+ end
2154+
21142155function test_parameter_index_error ()
21152156 model = POI. Optimizer (MOI. Utilities. Model {Float64} ())
21162157 POI. _add_variable (model, MOI. VariableIndex (1 ))
0 commit comments