From 9a2cfee4831c99c5458b387c523bf834f8c8c2c7 Mon Sep 17 00:00:00 2001 From: rafabench_psr Date: Fri, 21 Feb 2020 18:50:32 -0300 Subject: [PATCH 1/8] Add new tests for semi continuous and semi integer variables --- src/Test/intlinear.jl | 303 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index 6eae23becd..ec425fb1f7 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -681,6 +681,307 @@ function indicator4_test(model::MOI.ModelLike, config::TestConfig) end end +function semiconttest(model::MOI.ModelLike, config::MOIT.TestConfig{T}) where T + atol = config.atol + rtol = config.rtol + + @test MOIU.supports_default_copy_to(model, #=copy_names=# false) + @test MOI.supports(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}()) + @test MOI.supports(model, MOI.ObjectiveSense()) + @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.MathOptInterface.Semicontinuous{T}) + + # 2 variables + # min x + # st x >= y + # x ∈ {0.0} U [2.0,3.0] + # y = 0.0 + + MOI.empty!(model) + @test MOI.is_empty(model) + + v = MOI.add_variables(model, 2) + @test MOI.get(model, MOI.NumberOfVariables()) == 2 + + vc1 = MOI.add_constraint(model, MOI.SingleVariable(v[1]), MOI.Semicontinuous(T(2), T(3))) + @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Semicontinuous{T}}()) == 1 + + vc2 = MOI.add_constraint(model, MOI.SingleVariable(v[2]), MOI.EqualTo(zero(T))) + @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.EqualTo{T}}()) == 1 + + cf = MOI.ScalarAffineFunction{T}(MOI.ScalarAffineTerm{T}.([one(T), -one(T)], v), zero(T)) + c = MOI.add_constraint(model, cf, MOI.GreaterThan(zero(T))) + @test MOI.get(model, MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},MOI.GreaterThan{T}}()) == 1 + + objf = MOI.ScalarAffineFunction(MOI.ScalarAffineTerm.([1.0, 0.0], v), 0.0) + MOI.set(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}}(), objf) + MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) + + @test MOI.get(model, MOI.ObjectiveSense()) == MOI.MIN_SENSE + + if config.solve + @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED + + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) in [ MOI.FEASIBLE_POINT, MOI.NEARLY_FEASIBLE_POINT ] + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [0,0] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 0.0 + end + + # Change y fixed value + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(one(T))) + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0,1.0] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 1.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 + end + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(2))) + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0,2.0] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 + end + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(5//2))) + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.5 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.5,2.5] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 2.5 + end + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(3))) + + MOI.write_to_file(model.model, "antes3.lp") + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0,3.0] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 + end + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(5))) + + if config.solve + + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == MOI.INFEASIBLE || + MOI.get(model, MOI.TerminationStatus()) == MOI.INFEASIBLE_OR_UNBOUNDED + end +end + +function semiinttest(model::MOI.ModelLike, config::MOIT.TestConfig{T}) where T + atol = config.atol + rtol = config.rtol + + @test MOIU.supports_default_copy_to(model, #=copy_names=# false) + @test MOI.supports(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}()) + @test MOI.supports(model, MOI.ObjectiveSense()) + @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.MathOptInterface.Semiinteger{T}) + + # 2 variables + # min x + # st x >= y + # x ∈ {0.0} U {2.0} U {3.0} + # y = 0.0 + + MOI.empty!(model) + @test MOI.is_empty(model) + + v = MOI.add_variables(model, 2) + @test MOI.get(model, MOI.NumberOfVariables()) == 2 + + vc1 = MOI.add_constraint(model, MOI.SingleVariable(v[1]), MOI.Semiinteger(T(2), T(3))) + @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Semiinteger{T}}()) == 1 + + vc2 = MOI.add_constraint(model, MOI.SingleVariable(v[2]), MOI.EqualTo(zero(T))) + @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.EqualTo{T}}()) == 1 + + cf = MOI.ScalarAffineFunction{T}(MOI.ScalarAffineTerm{T}.([one(T), -one(T)], v), zero(T)) + c = MOI.add_constraint(model, cf, MOI.GreaterThan(zero(T))) + @test MOI.get(model, MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},MOI.GreaterThan{T}}()) == 1 + + objf = MOI.ScalarAffineFunction(MOI.ScalarAffineTerm.([1.0, 0.0], v), 0.0) + MOI.set(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}}(), objf) + MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) + + @test MOI.get(model, MOI.ObjectiveSense()) == MOI.MIN_SENSE + + if config.solve + @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED + + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) in [ MOI.FEASIBLE_POINT, MOI.NEARLY_FEASIBLE_POINT ] + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [0,0] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 0.0 + end + + # Change y fixed value + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(one(T))) + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0,1.0] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 1.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 + end + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(2))) + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0,2.0] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 + end + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(5//2))) + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0,2.5] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.5 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 + end + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(3))) + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status + + @test MOI.get(model, MOI.ResultCount()) >= 1 + + @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT + + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0,3.0] atol=atol rtol=rtol + + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol + + @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 + end + + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(4))) + + if config.solve + MOI.optimize!(model) + + @test MOI.get(model, MOI.TerminationStatus()) == MOI.INFEASIBLE || + MOI.get(model, MOI.TerminationStatus()) == MOI.INFEASIBLE_OR_UNBOUNDED + end +end + const intlineartests = Dict("knapsack" => knapsacktest, "int1" => int1test, "int2" => int2test, @@ -689,6 +990,8 @@ const intlineartests = Dict("knapsack" => knapsacktest, "indicator2" => indicator2_test, "indicator3" => indicator3_test, "indicator4" => indicator4_test, + "semiconttest" => semiconttest, + "semiinttest" => semiinttest ) @moitestset intlinear From 701caa6c216289c752006db89fbf5bd7140173af Mon Sep 17 00:00:00 2001 From: rafabench_psr Date: Fri, 21 Feb 2020 19:05:28 -0300 Subject: [PATCH 2/8] Bug fix --- src/Test/intlinear.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index ec425fb1f7..531f23e1f4 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -681,7 +681,7 @@ function indicator4_test(model::MOI.ModelLike, config::TestConfig) end end -function semiconttest(model::MOI.ModelLike, config::MOIT.TestConfig{T}) where T +function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T atol = config.atol rtol = config.rtol @@ -833,7 +833,7 @@ function semiconttest(model::MOI.ModelLike, config::MOIT.TestConfig{T}) where T end end -function semiinttest(model::MOI.ModelLike, config::MOIT.TestConfig{T}) where T +function semiinttest(model::MOI.ModelLike, config::TestConfig{T}) where T atol = config.atol rtol = config.rtol From ef3fbc24dbf44e28cacfffdb203d220da271797c Mon Sep 17 00:00:00 2001 From: Rafael Date: Sat, 22 Feb 2020 14:46:27 -0300 Subject: [PATCH 3/8] Fix typos and remove debug line Fix typos and remove debug line --- src/Test/intlinear.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index 531f23e1f4..d615b7ee1f 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -688,7 +688,7 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T @test MOIU.supports_default_copy_to(model, #=copy_names=# false) @test MOI.supports(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}()) @test MOI.supports(model, MOI.ObjectiveSense()) - @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.MathOptInterface.Semicontinuous{T}) + @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.Semicontinuous{T}) # 2 variables # min x @@ -802,8 +802,6 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(3))) - MOI.write_to_file(model.model, "antes3.lp") - if config.solve MOI.optimize!(model) @@ -840,7 +838,7 @@ function semiinttest(model::MOI.ModelLike, config::TestConfig{T}) where T @test MOIU.supports_default_copy_to(model, #=copy_names=# false) @test MOI.supports(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}()) @test MOI.supports(model, MOI.ObjectiveSense()) - @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.MathOptInterface.Semiinteger{T}) + @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.Semiinteger{T}) # 2 variables # min x From a777f9193911760a3c0e78b20fba85dd8c1fcf23 Mon Sep 17 00:00:00 2001 From: Rafael Date: Sat, 22 Feb 2020 16:36:47 -0300 Subject: [PATCH 4/8] Add MockOptimizer tests for semiconttest and semiinttest --- test/Test/intlinear.jl | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/Test/intlinear.jl b/test/Test/intlinear.jl index 9be16695b2..a26a6b2c18 100644 --- a/test/Test/intlinear.jl +++ b/test/Test/intlinear.jl @@ -42,3 +42,51 @@ MOIU.set_mock_optimize!(mock, (mock::MOIU.MockOptimizer) -> MOIU.mock_optimize!(mock, [1.25, 8.75, 0., 1.]) ) MOIT.indicator4_test(mock, config) +MOIU.set_mock_optimize!(mock, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 0.0) + MOIU.mock_optimize!(mock, [0.0,0.0]) + end, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 2.0) + MOIU.mock_optimize!(mock, [2.0,1.0]) + end, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 2.0) + MOIU.mock_optimize!(mock, [2.0,2.0]) + end, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 2.5) + MOIU.mock_optimize!(mock, [2.5,2.5]) + end, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 3.0) + MOIU.mock_optimize!(mock, [3.0,3.0]) + end, + (mock::MOIU.MockOptimizer) -> MOI.set(mock, MOI.TerminationStatus(), MOI.INFEASIBLE) +) +MOIT.semiconttest(mock,config) +MOIU.set_mock_optimize!(mock, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 0.0) + MOIU.mock_optimize!(mock, [0.0,0.0]) + end, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 2.0) + MOIU.mock_optimize!(mock, [2.0,1.0]) + end, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 2.0) + MOIU.mock_optimize!(mock, [2.0,2.0]) + end, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 3.0) + MOIU.mock_optimize!(mock, [3.0,2.5]) + end, + (mock::MOIU.MockOptimizer) -> begin + MOI.set(mock, MOI.ObjectiveBound(), 3.0) + MOIU.mock_optimize!(mock, [3.0,3.0]) + end, + (mock::MOIU.MockOptimizer) -> MOI.set(mock, MOI.TerminationStatus(), MOI.INFEASIBLE) +) +MOIT.semiinttest(mock,config) \ No newline at end of file From d2f230589019d3f088a88b9520bedb926e8f74e1 Mon Sep 17 00:00:00 2001 From: rafabench_psr Date: Fri, 28 Feb 2020 10:35:43 -0300 Subject: [PATCH 5/8] Fix indentation and remove empty lines --- src/Test/intlinear.jl | 81 ++++++------------------------------------ test/Test/intlinear.jl | 40 ++++++++++----------- 2 files changed, 30 insertions(+), 91 deletions(-) diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index d615b7ee1f..8187022956 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -724,17 +724,11 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) in [ MOI.FEASIBLE_POINT, MOI.NEARLY_FEASIBLE_POINT ] - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 0.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [0,0] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [0, 0] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 0.0 end @@ -746,17 +740,11 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0,1.0] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0, 1.0] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 1.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 end @@ -766,17 +754,11 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0,2.0] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0, 2.0] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 end @@ -786,17 +768,11 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.5 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.5,2.5] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.5, 2.5] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 2.5 end @@ -806,24 +782,17 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0,3.0] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0, 3.0] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 end MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(5))) if config.solve - MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == MOI.INFEASIBLE || @@ -874,17 +843,11 @@ function semiinttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) in [ MOI.FEASIBLE_POINT, MOI.NEARLY_FEASIBLE_POINT ] - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 0.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [0,0] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [0, 0] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 0.0 end @@ -896,17 +859,11 @@ function semiinttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0,1.0] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0, 1.0] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 1.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 end @@ -916,17 +873,11 @@ function semiinttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0,2.0] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0, 2.0] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 end @@ -936,17 +887,11 @@ function semiinttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0,2.5] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0, 2.5] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.5 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 end @@ -956,17 +901,11 @@ function semiinttest(model::MOI.ModelLike, config::TestConfig{T}) where T MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol - - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0,3.0] atol=atol rtol=rtol - + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0, 3.0] atol=atol rtol=rtol @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 end diff --git a/test/Test/intlinear.jl b/test/Test/intlinear.jl index a26a6b2c18..4b36e1edd7 100644 --- a/test/Test/intlinear.jl +++ b/test/Test/intlinear.jl @@ -44,48 +44,48 @@ MOIU.set_mock_optimize!(mock, MOIT.indicator4_test(mock, config) MOIU.set_mock_optimize!(mock, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 0.0) - MOIU.mock_optimize!(mock, [0.0,0.0]) + MOI.set(mock, MOI.ObjectiveBound(), 0.0) + MOIU.mock_optimize!(mock, [0.0, 0.0]) end, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 2.0) - MOIU.mock_optimize!(mock, [2.0,1.0]) + MOI.set(mock, MOI.ObjectiveBound(), 2.0) + MOIU.mock_optimize!(mock, [2.0, 1.0]) end, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 2.0) - MOIU.mock_optimize!(mock, [2.0,2.0]) + MOI.set(mock, MOI.ObjectiveBound(), 2.0) + MOIU.mock_optimize!(mock, [2.0, 2.0]) end, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 2.5) - MOIU.mock_optimize!(mock, [2.5,2.5]) + MOI.set(mock, MOI.ObjectiveBound(), 2.5) + MOIU.mock_optimize!(mock, [2.5, 2.5]) end, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 3.0) - MOIU.mock_optimize!(mock, [3.0,3.0]) + MOI.set(mock, MOI.ObjectiveBound(), 3.0) + MOIU.mock_optimize!(mock, [3.0, 3.0]) end, (mock::MOIU.MockOptimizer) -> MOI.set(mock, MOI.TerminationStatus(), MOI.INFEASIBLE) ) MOIT.semiconttest(mock,config) MOIU.set_mock_optimize!(mock, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 0.0) - MOIU.mock_optimize!(mock, [0.0,0.0]) + MOI.set(mock, MOI.ObjectiveBound(), 0.0) + MOIU.mock_optimize!(mock, [0.0, 0.0]) end, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 2.0) - MOIU.mock_optimize!(mock, [2.0,1.0]) + MOI.set(mock, MOI.ObjectiveBound(), 2.0) + MOIU.mock_optimize!(mock, [2.0, 1.0]) end, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 2.0) - MOIU.mock_optimize!(mock, [2.0,2.0]) + MOI.set(mock, MOI.ObjectiveBound(), 2.0) + MOIU.mock_optimize!(mock, [2.0, 2.0]) end, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 3.0) - MOIU.mock_optimize!(mock, [3.0,2.5]) + MOI.set(mock, MOI.ObjectiveBound(), 3.0) + MOIU.mock_optimize!(mock, [3.0, 2.5]) end, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.ObjectiveBound(), 3.0) - MOIU.mock_optimize!(mock, [3.0,3.0]) + MOI.set(mock, MOI.ObjectiveBound(), 3.0) + MOIU.mock_optimize!(mock, [3.0, 3.0]) end, (mock::MOIU.MockOptimizer) -> MOI.set(mock, MOI.TerminationStatus(), MOI.INFEASIBLE) ) From 7032a87eecadaf037551bb974250a0d2a3433d56 Mon Sep 17 00:00:00 2001 From: rafabench_psr Date: Tue, 3 Mar 2020 12:45:42 -0300 Subject: [PATCH 6/8] Use an auxiliary _semitest function --- src/Test/intlinear.jl | 139 +++++------------------------------------- 1 file changed, 15 insertions(+), 124 deletions(-) diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index 8187022956..de5073a62a 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -681,7 +681,7 @@ function indicator4_test(model::MOI.ModelLike, config::TestConfig) end end -function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T +function _semitest(model::MOI.ModelLike, config::TestConfig{T}, int::Bool) where T atol = config.atol rtol = config.rtol @@ -770,10 +770,17 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status @test MOI.get(model, MOI.ResultCount()) >= 1 @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.5 atol=atol rtol=rtol - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.5, 2.5] atol=atol rtol=rtol - @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 2.5 + if !int + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.5 atol=atol rtol=rtol + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.5, 2.5] atol=atol rtol=rtol + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol + @test MOI.get(model, MOI.ObjectiveBound()) <= 2.5 + else + @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol + @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0, 2.5] atol=atol rtol=rtol + @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.5 atol=atol rtol=rtol + @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 + end end MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(3))) @@ -790,7 +797,7 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 end - MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(5))) + MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(4))) if config.solve MOI.optimize!(model) @@ -800,124 +807,8 @@ function semiconttest(model::MOI.ModelLike, config::TestConfig{T}) where T end end -function semiinttest(model::MOI.ModelLike, config::TestConfig{T}) where T - atol = config.atol - rtol = config.rtol - - @test MOIU.supports_default_copy_to(model, #=copy_names=# false) - @test MOI.supports(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}()) - @test MOI.supports(model, MOI.ObjectiveSense()) - @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.Semiinteger{T}) - - # 2 variables - # min x - # st x >= y - # x ∈ {0.0} U {2.0} U {3.0} - # y = 0.0 - - MOI.empty!(model) - @test MOI.is_empty(model) - - v = MOI.add_variables(model, 2) - @test MOI.get(model, MOI.NumberOfVariables()) == 2 - - vc1 = MOI.add_constraint(model, MOI.SingleVariable(v[1]), MOI.Semiinteger(T(2), T(3))) - @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Semiinteger{T}}()) == 1 - - vc2 = MOI.add_constraint(model, MOI.SingleVariable(v[2]), MOI.EqualTo(zero(T))) - @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.EqualTo{T}}()) == 1 - - cf = MOI.ScalarAffineFunction{T}(MOI.ScalarAffineTerm{T}.([one(T), -one(T)], v), zero(T)) - c = MOI.add_constraint(model, cf, MOI.GreaterThan(zero(T))) - @test MOI.get(model, MOI.NumberOfConstraints{MOI.ScalarAffineFunction{T},MOI.GreaterThan{T}}()) == 1 - - objf = MOI.ScalarAffineFunction(MOI.ScalarAffineTerm.([1.0, 0.0], v), 0.0) - MOI.set(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}}(), objf) - MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) - - @test MOI.get(model, MOI.ObjectiveSense()) == MOI.MIN_SENSE - - if config.solve - @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED - - MOI.optimize!(model) - - @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) in [ MOI.FEASIBLE_POINT, MOI.NEARLY_FEASIBLE_POINT ] - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [0, 0] atol=atol rtol=rtol - @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 0.0 - end - - # Change y fixed value - - MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(one(T))) - - if config.solve - MOI.optimize!(model) - - @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0, 1.0] atol=atol rtol=rtol - @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 1.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 - end - - MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(2))) - - if config.solve - MOI.optimize!(model) - - @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 2.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [2.0, 2.0] atol=atol rtol=rtol - @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 2.0 - end - - MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(5//2))) - - if config.solve - MOI.optimize!(model) - - @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0, 2.5] atol=atol rtol=rtol - @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.5 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 - end - - MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(3))) - - if config.solve - MOI.optimize!(model) - - @test MOI.get(model, MOI.TerminationStatus()) == config.optimal_status - @test MOI.get(model, MOI.ResultCount()) >= 1 - @test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT - @test MOI.get(model, MOI.ObjectiveValue()) ≈ 3.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.VariablePrimal(), v) ≈ [3.0, 3.0] atol=atol rtol=rtol - @test MOI.get(model, MOI.ConstraintPrimal(), c) ≈ 0.0 atol=atol rtol=rtol - @test MOI.get(model, MOI.ObjectiveBound()) <= 3.0 - end - - MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(T(4))) - - if config.solve - MOI.optimize!(model) - - @test MOI.get(model, MOI.TerminationStatus()) == MOI.INFEASIBLE || - MOI.get(model, MOI.TerminationStatus()) == MOI.INFEASIBLE_OR_UNBOUNDED - end -end +semiconttest(model::MOI.ModelLike, config::TestConfig) = _semitest(model, config, false) +semiinttest(model::MOI.ModelLike, config::TestConfig) = _semitest(model, config, true) const intlineartests = Dict("knapsack" => knapsacktest, "int1" => int1test, From 2d943f2c93b5c875971d9fd0bbf02dd440169485 Mon Sep 17 00:00:00 2001 From: rafabench_psr Date: Tue, 3 Mar 2020 15:23:17 -0300 Subject: [PATCH 7/8] Fix variable type in _semitest --- src/Test/intlinear.jl | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index de5073a62a..c37df09ac2 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -688,13 +688,25 @@ function _semitest(model::MOI.ModelLike, config::TestConfig{T}, int::Bool) where @test MOIU.supports_default_copy_to(model, #=copy_names=# false) @test MOI.supports(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}()) @test MOI.supports(model, MOI.ObjectiveSense()) - @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.Semicontinuous{T}) + if !int + @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.Semicontinuous{T}) + else + @test MOI.supports_constraint(model, MOI.SingleVariable, MOI.Semiinteger{T}) + end # 2 variables + # + # If int == false # min x # st x >= y # x ∈ {0.0} U [2.0,3.0] # y = 0.0 + # + # If int == true + # min x + # st x >= y + # x ∈ {0.0} U {2.0} U {3.0} + # y = 0.0 MOI.empty!(model) @test MOI.is_empty(model) @@ -702,9 +714,14 @@ function _semitest(model::MOI.ModelLike, config::TestConfig{T}, int::Bool) where v = MOI.add_variables(model, 2) @test MOI.get(model, MOI.NumberOfVariables()) == 2 - vc1 = MOI.add_constraint(model, MOI.SingleVariable(v[1]), MOI.Semicontinuous(T(2), T(3))) - @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Semicontinuous{T}}()) == 1 - + if !int + vc1 = MOI.add_constraint(model, MOI.SingleVariable(v[1]), MOI.Semicontinuous(T(2), T(3))) + @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Semicontinuous{T}}()) == 1 + else + vc1 = MOI.add_constraint(model, MOI.SingleVariable(v[1]), MOI.Semiinteger(T(2), T(3))) + @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.Semiinteger{T}}()) == 1 + end + vc2 = MOI.add_constraint(model, MOI.SingleVariable(v[2]), MOI.EqualTo(zero(T))) @test MOI.get(model, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.EqualTo{T}}()) == 1 From 6c2d48a546986e72d0087cb9e1dbf5c11e3c2fe7 Mon Sep 17 00:00:00 2001 From: rafabench_psr Date: Tue, 3 Mar 2020 17:22:22 -0300 Subject: [PATCH 8/8] Update model description --- src/Test/intlinear.jl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index c37df09ac2..d6f4587ac4 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -696,16 +696,12 @@ function _semitest(model::MOI.ModelLike, config::TestConfig{T}, int::Bool) where # 2 variables # - # If int == false # min x # st x >= y - # x ∈ {0.0} U [2.0,3.0] - # y = 0.0 - # - # If int == true - # min x - # st x >= y - # x ∈ {0.0} U {2.0} U {3.0} + # if !int + # x ∈ {0.0} U [2.0,3.0] + # if int + # x ∈ {0.0} U {2.0} U {3.0} # y = 0.0 MOI.empty!(model)