From ec2b976c9f49143c881a5a7a29859e46d93ec3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Tue, 17 Dec 2024 12:40:23 +0100 Subject: [PATCH] Fix format --- src/Test/test_conic.jl | 50 ++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src/Test/test_conic.jl b/src/Test/test_conic.jl index 9e4d1684ae..11730d41e6 100644 --- a/src/Test/test_conic.jl +++ b/src/Test/test_conic.jl @@ -5777,7 +5777,10 @@ function test_conic_PositiveSemidefiniteConeTriangle_4( atol = config.atol rtol = config.rtol @requires MOI.supports_incremental_interface(model) - @requires MOI.supports(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}()) + @requires MOI.supports( + model, + MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}(), + ) @requires MOI.supports(model, MOI.ObjectiveSense()) @requires MOI.supports_constraint( model, @@ -5795,10 +5798,21 @@ function test_conic_PositiveSemidefiniteConeTriangle_4( MOI.GreaterThan{T}, ) - x, cx = MOI.add_constrained_variables(model, MOI.PositiveSemidefiniteConeTriangle(2)) - y, cy = MOI.add_constrained_variables(model, MOI.PositiveSemidefiniteConeTriangle(2)) - c1 = MOI.add_constraint(model, sum(1.0 .* x) - sum(1.0 .* y), MOI.EqualTo(0.0)) - c2 = MOI.add_constraint(model, 1.0 * y[1] + 1.0 * y[3], MOI.GreaterThan(1.0)) + x, cx = MOI.add_constrained_variables( + model, + MOI.PositiveSemidefiniteConeTriangle(2), + ) + y, cy = MOI.add_constrained_variables( + model, + MOI.PositiveSemidefiniteConeTriangle(2), + ) + c1 = MOI.add_constraint( + model, + sum(1.0 .* x) - sum(1.0 .* y), + MOI.EqualTo(0.0), + ) + c2 = + MOI.add_constraint(model, 1.0 * y[1] + 1.0 * y[3], MOI.GreaterThan(1.0)) obj = 1.0 * x[1] + 1.0 * x[3] MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) MOI.set(model, MOI.ObjectiveFunction{typeof(obj)}(), obj) @@ -5810,13 +5824,19 @@ function test_conic_PositiveSemidefiniteConeTriangle_4( if _supports(config, MOI.ConstraintDual) @test MOI.get(model, MOI.DualStatus()) == MOI.FEASIBLE_POINT end - @test MOI.get.(model, MOI.VariablePrimal(), x) ≈ ones(3) ./ T(6) atol = atol rtol = rtol - @test MOI.get.(model, MOI.VariablePrimal(), y) ≈ [1, -1, 1] ./ T(2) atol = atol rtol = rtol + @test MOI.get.(model, MOI.VariablePrimal(), x) ≈ ones(3) ./ T(6) atol = + atol rtol = rtol + @test MOI.get.(model, MOI.VariablePrimal(), y) ≈ [1, -1, 1] ./ T(2) atol = + atol rtol = rtol if _supports(config, MOI.ConstraintDual) - @test MOI.get(model, MOI.ConstraintDual(), cx) ≈ [1, -1, 1] ./ T(3) atol = atol rtol = rtol - @test MOI.get(model, MOI.ConstraintDual(), cy) ≈ ones(3) ./ T(3) atol = atol rtol = rtol - @test MOI.get(model, MOI.ConstraintDual(), c1) ≈ T(2)/T(3) atol = atol rtol = rtol - @test MOI.get(model, MOI.ConstraintDual(), c2) ≈ T(1)/T(3) atol = atol rtol = rtol + @test MOI.get(model, MOI.ConstraintDual(), cx) ≈ [1, -1, 1] ./ T(3) atol = + atol rtol = rtol + @test MOI.get(model, MOI.ConstraintDual(), cy) ≈ ones(3) ./ T(3) atol = + atol rtol = rtol + @test MOI.get(model, MOI.ConstraintDual(), c1) ≈ T(2) / T(3) atol = + atol rtol = rtol + @test MOI.get(model, MOI.ConstraintDual(), c2) ≈ T(1) / T(3) atol = + atol rtol = rtol end end return @@ -5834,9 +5854,11 @@ function setup_test( (mock::MOIU.MockOptimizer) -> MOIU.mock_optimize!( mock, [[1, 1, 1] / T(6); [1, -1, 1] / T(2)], - (MOI.VectorOfVariables, MOI.PositiveSemidefiniteConeTriangle) => [[1, -1, 1] ./ T(3), ones(3) ./ T(3)], - (MOI.ScalarAffineFunction{T}, MOI.EqualTo{T}) => [T(2)/T(3)], - (MOI.ScalarAffineFunction{T}, MOI.GreaterThan{T}) => [T(1)/T(3)], + (MOI.VectorOfVariables, MOI.PositiveSemidefiniteConeTriangle) => + [[1, -1, 1] ./ T(3), ones(3) ./ T(3)], + (MOI.ScalarAffineFunction{T}, MOI.EqualTo{T}) => [T(2) / T(3)], + (MOI.ScalarAffineFunction{T}, MOI.GreaterThan{T}) => + [T(1) / T(3)], ), ) return