Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion test/jump_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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()
Expand Down
35 changes: 35 additions & 0 deletions test/moi_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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] ||
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -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,
Expand Down
Loading