diff --git a/test/jump_tests.jl b/test/jump_tests.jl index d36e3ed6..da64ae35 100644 --- a/test/jump_tests.jl +++ b/test/jump_tests.jl @@ -1500,6 +1500,11 @@ function test_jump_psd_cone_without_parameter_v_and_vv() @test is_valid(model, con) optimize!(model) @test value(x) ≈ 0.50000 atol = 1e-5 + @test MOI.get( + backend(model), + MOI.ConstraintPrimalStart(), + index(ParameterRef(p)), + ) == 1.0 delete(model, con) unregister(model, :con) @test_throws MOI.UnsupportedConstraint @constraint( @@ -1510,7 +1515,7 @@ function test_jump_psd_cone_without_parameter_v_and_vv() @test_throws MOI.UnsupportedConstraint @constraint( model, con, - [x * x, (x - 1), p] in MOI.PositiveSemidefiniteConeTriangle(2) + [x * x, (x - 1), 0.0] in MOI.PositiveSemidefiniteConeTriangle(2) ) @test_throws MOI.UnsupportedConstraint @constraint( model, @@ -1522,6 +1527,19 @@ function test_jump_psd_cone_without_parameter_v_and_vv() con, [x, p * (x - 1), x * x] in MOI.PositiveSemidefiniteConeTriangle(2) ) + @test_throws ErrorException( + "Constraint attribute MathOptInterface.ConstraintName() cannot be set for $(index(ParameterRef(p)))", + ) MOI.set( + backend(model), + MOI.ConstraintName(), + index(ParameterRef(p)), + "name", + ) + @test_throws MOI.UnsupportedAttribute MOI.supports( + backend(model), + MOI.ConstraintName(), + MOI.ConstraintIndex{MOI.VariableIndex,MOI.Parameter}, + ) end function test_variable_and_constraint_not_registered() diff --git a/test/moi_tests.jl b/test/moi_tests.jl index 9d81adfd..ab94eb17 100644 --- a/test/moi_tests.jl +++ b/test/moi_tests.jl @@ -1821,6 +1821,11 @@ function test_getters() MOI.Zeros, POI.ParametricVectorAffineFunction{Float64}, ) + T4 = ( + MOI.VectorAffineFunction{Float64}, + MOI.Zeros, + POI.ParametricVectorQuadraticFunction{Float64}, + ) @test MOI.get(optimizer, POI.ListOfParametricConstraintTypesPresent()) == [T1] @test length( @@ -1853,6 +1858,16 @@ function test_getters() }(), ), ) + @test isempty( + MOI.get( + optimizer, + POI.DictOfParametricConstraintIndicesAndFunctions{ + T4[1], + T4[2], + T4[3], + }(), + ), + ) MOI.add_constraint(optimizer, 2.0x * p + 2.0p, MOI.LessThan(0.0)) @test MOI.get(optimizer, POI.ListOfParametricConstraintTypesPresent()) == [T1, T2] || @@ -1888,6 +1903,16 @@ function test_getters() }(), ), ) + @test isempty( + MOI.get( + optimizer, + POI.DictOfParametricConstraintIndicesAndFunctions{ + T4[1], + T4[2], + T4[3], + }(), + ), + ) terms = [ MOI.VectorAffineTerm(Int64(1), MOI.ScalarAffineTerm(2.0, x)), MOI.VectorAffineTerm(Int64(2), MOI.ScalarAffineTerm(3.0, p)), @@ -1924,6 +1949,16 @@ function test_getters() }(), ), ) == 1 + @test isempty( + MOI.get( + optimizer, + POI.DictOfParametricConstraintIndicesAndFunctions{ + T4[1], + T4[2], + T4[3], + }(), + ), + ) @test MOI.get(optimizer, POI.ParametricObjectiveType()) == Nothing MOI.set( optimizer,