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
8 changes: 0 additions & 8 deletions src/Test/UnitTests/basic_constraint_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,11 @@ function basic_constraint_test_helper(
x = MOI.add_variables(model, N)
constraint_function = func(x)
F, S = typeof(constraint_function), typeof(set)

@test MOI.supports_constraint(model, F, S)

@testset "add_constraint" begin
@test MOI.get(model, MOI.NumberOfConstraints{F,S}()) == 0
c = MOI.add_constraint(model, constraint_function, set)
@test MOI.get(model, MOI.NumberOfConstraints{F,S}()) == 1

if name
@testset "ConstraintName" begin
if F == MOI.SingleVariable
Expand All @@ -352,7 +349,6 @@ function basic_constraint_test_helper(
end
end
end

if get_constraint_function
@testset "ConstraintFunction" begin
func = MOI.get(model, MOI.ConstraintFunction(), c)
Expand All @@ -366,14 +362,12 @@ function basic_constraint_test_helper(
end
end
end

@testset "ListOfConstraintIndices" begin
c_indices = MOI.get(model, MOI.ListOfConstraintIndices{F,S}())
@test length(c_indices) ==
MOI.get(model, MOI.NumberOfConstraints{F,S}()) ==
1
end

if F != MOI.SingleVariable && F != MOI.VectorOfVariables
# We can't add multiple variable constraints as these are
# interpreted as bounds etc.
Expand All @@ -389,12 +383,10 @@ function basic_constraint_test_helper(
3
end
end

@testset "is_valid" begin
c_indices = MOI.get(model, MOI.ListOfConstraintIndices{F,S}())
@test all(MOI.is_valid.(model, c_indices))
end

if delete
@testset "delete" begin
c_indices = MOI.get(model, MOI.ListOfConstraintIndices{F,S}())
Expand Down
6 changes: 0 additions & 6 deletions src/Test/UnitTests/constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,14 @@ function solve_duplicate_terms_scalar_affine(
x = MOI.add_variable(model)
objective_function =
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0)

MOI.set(
model,
MOI.ObjectiveFunction{typeof(objective_function)}(),
objective_function,
)
MOI.set(model, MOI.ObjectiveSense(), MOI.MAX_SENSE)

f = MOI.ScalarAffineFunction(MOI.ScalarAffineTerm.([1.0, 1.0], [x, x]), 0.0)
c = MOI.add_constraint(model, f, MOI.LessThan(1.0))

return test_model_solution(
model,
config;
Expand Down Expand Up @@ -236,20 +233,17 @@ function solve_duplicate_terms_vector_affine(
x = MOI.add_variable(model)
objective_function =
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0)

MOI.set(
model,
MOI.ObjectiveFunction{typeof(objective_function)}(),
objective_function,
)
MOI.set(model, MOI.ObjectiveSense(), MOI.MAX_SENSE)

f = MOI.VectorAffineFunction(
MOI.VectorAffineTerm.(1, MOI.ScalarAffineTerm.([1.0, 1.0], [x, x])),
[-1.0],
)
c = MOI.add_constraint(model, f, MOI.Nonpositives(1))

return test_model_solution(
model,
config;
Expand Down
1 change: 0 additions & 1 deletion src/Test/UnitTests/objectives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ function solve_qp_edge_cases(model::MOI.ModelLike, config::Config)
MOI.GreaterThan(2.0),
)
@test vc2.value == x[2].value

@testset "Basic model" begin
# min x^2 + y^2 | x>=1, y>=2
MOI.set(
Expand Down
3 changes: 0 additions & 3 deletions src/Test/UnitTests/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function solve_objbound_edge_cases(model::MOI.ModelLike, config::Config)
@test MOI.get(model, MOI.ObjectiveBound()) <= 3.0
end
end

@testset "Max IP with constant" begin
MOI.empty!(model)
@test MOI.is_empty(model)
Expand All @@ -51,7 +50,6 @@ function solve_objbound_edge_cases(model::MOI.ModelLike, config::Config)
@test MOI.get(model, MOI.ObjectiveBound()) >= 3.0
end
end

@testset "Min LP with constant" begin
MOI.empty!(model)
@test MOI.is_empty(model)
Expand All @@ -74,7 +72,6 @@ function solve_objbound_edge_cases(model::MOI.ModelLike, config::Config)
@test MOI.get(model, MOI.ObjectiveBound()) <= 2.0
end
end

@testset "Max LP with constant" begin
MOI.empty!(model)
@test MOI.is_empty(model)
Expand Down
2 changes: 0 additions & 2 deletions src/Test/UnitTests/variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ function solve_integer_edge_cases(model::MOI.ModelLike, config::Config)
variable_primal = [(x, 1.0)],
)
end

@testset "binary with upper" begin
MOI.empty!(model)
@test MOI.is_empty(model)
Expand All @@ -359,7 +358,6 @@ function solve_integer_edge_cases(model::MOI.ModelLike, config::Config)
variable_primal = [(x, 1.0)],
)
end

@testset "binary with 0 upper" begin
MOI.empty!(model)
@test MOI.is_empty(model)
Expand Down
Loading