@@ -1235,6 +1235,63 @@ function linear10test(model::MOI.ModelLike, config::TestConfig)
12351235 end
12361236end
12371237
1238+ # inactive ranged constraints
1239+ function linear10btest (model:: MOI.ModelLike , config:: TestConfig )
1240+ atol = config. atol
1241+ rtol = config. rtol
1242+ # minimize x + y
1243+ #
1244+ # s.t. -1 <= x + y <= 10
1245+ # x, y >= 0
1246+
1247+ @test MOIU. supports_default_copy_to (model, #= copy_names=# false )
1248+ @test MOI. supports (model, MOI. ObjectiveFunction {MOI.ScalarAffineFunction{Float64}} ())
1249+ @test MOI. supports (model, MOI. ObjectiveSense ())
1250+ @test MOI. supports_constraint (model, MOI. ScalarAffineFunction{Float64}, MOI. Interval{Float64})
1251+ @test MOI. supports_constraint (model, MOI. SingleVariable, MOI. GreaterThan{Float64})
1252+
1253+ MOI. empty! (model)
1254+ @test MOI. is_empty (model)
1255+
1256+ x = MOI. add_variable (model)
1257+ y = MOI. add_variable (model)
1258+
1259+ vc = MOI. add_constraints (model,
1260+ [MOI. SingleVariable (x), MOI. SingleVariable (y)],
1261+ [MOI. GreaterThan (0.0 ), MOI. GreaterThan (0.0 )]
1262+ )
1263+
1264+ c = MOI. add_constraint (model, MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .([1.0 , 1.0 ], [x,y]), 0.0 ), MOI. Interval (- 1.0 , 10.0 ))
1265+
1266+ MOI. set (model, MOI. ObjectiveFunction {MOI.ScalarAffineFunction{Float64}} (), MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .([1.0 , 1.0 ], [x, y]), 0.0 ))
1267+ MOI. set (model, MOI. ObjectiveSense (), MOI. MIN_SENSE)
1268+
1269+ if config. solve
1270+ @test MOI. get (model, MOI. TerminationStatus ()) == MOI. OPTIMIZE_NOT_CALLED
1271+
1272+ MOI. optimize! (model)
1273+
1274+ @test MOI. get (model, MOI. TerminationStatus ()) == config. optimal_status
1275+ @test MOI. get (model, MOI. PrimalStatus ()) == MOI. FEASIBLE_POINT
1276+ @test MOI. get (model, MOI. ObjectiveValue ()) ≈ 0.0 atol= atol rtol= rtol
1277+ @test MOI. get (model, MOI. ConstraintPrimal (), c) ≈ 0.0 atol= atol rtol= rtol
1278+
1279+ if config. duals
1280+ @test MOI. get (model, MOI. ResultCount ()) >= 1
1281+ @test MOI. get (model, MOI. DualStatus ()) == MOI. FEASIBLE_POINT
1282+ @test MOI. get (model, MOI. ConstraintDual (), c) ≈ 0.0 atol= atol rtol= rtol
1283+ @test MOI. get (model, MOI. ConstraintDual (), vc[1 ]) ≈ 1.0 atol= atol rtol= rtol
1284+ @test MOI. get (model, MOI. ConstraintDual (), vc[2 ]) ≈ 1.0 atol= atol rtol= rtol
1285+ end
1286+
1287+ if config. basis
1288+ @test (MOI. get (model, MOI. ConstraintBasisStatus (), vc[1 ]) == MOI. NONBASIC)
1289+ @test (MOI. get (model, MOI. ConstraintBasisStatus (), vc[1 ]) == MOI. NONBASIC)
1290+ @test MOI. get (model, MOI. ConstraintBasisStatus (), c) == MOI. BASIC
1291+ end
1292+ end
1293+ end
1294+
12381295# changing constraint sense
12391296function linear11test (model:: MOI.ModelLike , config:: TestConfig )
12401297 atol = config. atol
@@ -1611,6 +1668,7 @@ const contlineartests = Dict("linear1" => linear1test,
16111668 " linear8c" => linear8ctest,
16121669 " linear9" => linear9test,
16131670 " linear10" => linear10test,
1671+ " linear10b" => linear10btest,
16141672 " linear11" => linear11test,
16151673 " linear12" => linear12test,
16161674 " linear13" => linear13test,
0 commit comments