From d3269a6666dca3b897758428fd3531c71a40bb74 Mon Sep 17 00:00:00 2001 From: odow Date: Wed, 8 Sep 2021 12:34:51 +1200 Subject: [PATCH 1/2] [Test] change exact comparison to approx --- src/Test/test_conic.jl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Test/test_conic.jl b/src/Test/test_conic.jl index ccce3a35a6..1fd2418e25 100644 --- a/src/Test/test_conic.jl +++ b/src/Test/test_conic.jl @@ -6529,7 +6529,7 @@ function test_conic_SecondOrderCone_no_initial_bound( MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), t) MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_soc) MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == MOI.DUAL_INFEASIBLE @@ -6583,10 +6583,10 @@ function test_conic_SecondOrderCone_nonnegative_initial_bound( MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), t) MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_soc) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 1.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 1.0, config) return end @@ -6637,10 +6637,10 @@ function test_conic_SecondOrderCone_negative_initial_bound( MOI.optimize!(model) MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), t) MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_soc) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == -1.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), -1.0, config) return end @@ -6691,10 +6691,10 @@ function test_conic_SecondOrderCone_nonnegative_post_bound( MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), t) MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 6.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 6.0, config) MOI.delete(model, c_lb) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) return end @@ -6745,10 +6745,10 @@ function test_conic_SecondOrderCone_negative_post_bound( MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), t) MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_soc) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == -6.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t) ,-6.0, config) return end @@ -6800,10 +6800,10 @@ function test_conic_SecondOrderCone_negative_post_bound_ii( MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), t) MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_lb) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_soc) MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == MOI.DUAL_INFEASIBLE @@ -6861,10 +6861,10 @@ function test_conic_SecondOrderCone_negative_post_bound_iii( MOI.set(model, MOI.ObjectiveFunction{MOI.VariableIndex}(), t) MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_lb) MOI.optimize!(model) - @test MOI.get(model, MOI.VariablePrimal(), t) == 5.0 + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_soc) MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == MOI.DUAL_INFEASIBLE From 4e5df75c466431cdec5eb927619ea3542cd4683d Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 8 Sep 2021 12:54:46 +1200 Subject: [PATCH 2/2] Update src/Test/test_conic.jl --- src/Test/test_conic.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Test/test_conic.jl b/src/Test/test_conic.jl index 1fd2418e25..1ace5f74ba 100644 --- a/src/Test/test_conic.jl +++ b/src/Test/test_conic.jl @@ -6748,7 +6748,7 @@ function test_conic_SecondOrderCone_negative_post_bound( @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), 5.0, config) MOI.delete(model, c_soc) MOI.optimize!(model) - @test isapprox(MOI.get(model, MOI.VariablePrimal(), t) ,-6.0, config) + @test isapprox(MOI.get(model, MOI.VariablePrimal(), t), -6.0, config) return end