Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests from Gurobi #216 #763

Merged
merged 6 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 2 additions & 2 deletions src/Test/UnitTests/basic_constraint_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const BasicConstraintTests = Dict(
(MOI.VectorOfVariables, MOI.GeometricMeanCone) => ( dummy_vectorofvariables, 3, MOI.GeometricMeanCone(3) ),
(MOI.VectorOfVariables, MOI.ExponentialCone) => ( dummy_vectorofvariables, 3, MOI.ExponentialCone() ),
(MOI.VectorOfVariables, MOI.DualExponentialCone) => ( dummy_vectorofvariables, 3, MOI.DualExponentialCone() ),
(MOI.VectorOfVariables, MOI.PowerCone) => ( dummy_vectorofvariables, 3, MOI.PowerCone(2.0) ),
(MOI.VectorOfVariables, MOI.DualPowerCone) => ( dummy_vectorofvariables, 3, MOI.DualPowerCone(2.0) ),
(MOI.VectorOfVariables, MOI.PowerCone{Float64}) => ( dummy_vectorofvariables, 3, MOI.PowerCone(2.0) ),
(MOI.VectorOfVariables, MOI.DualPowerCone{Float64}) => ( dummy_vectorofvariables, 3, MOI.DualPowerCone(2.0) ),

(MOI.VectorOfVariables, MOI.PositiveSemidefiniteConeTriangle) => ( dummy_vectorofvariables, 7, MOI.PositiveSemidefiniteConeTriangle(3) ),
(MOI.VectorOfVariables, MOI.PositiveSemidefiniteConeSquare) => ( dummy_vectorofvariables, 10, MOI.PositiveSemidefiniteConeSquare(3) ),
Expand Down
3 changes: 0 additions & 3 deletions src/Test/contlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1499,9 +1499,6 @@ function linear12test(model::MOI.ModelLike, config::TestConfig)
@test - 3 * cd1 + cd2 ≈ -bndyd atol=atol rtol=rtol
@test 2 * cd1 ≈ -bndxd atol=atol rtol=rtol
@test -7 * cd1 + 2 * cd2 > atol
else
# solver returned nothing
@test MOI.get(model, MOI.ResultCount()) == 0
end
end
end
Expand Down
10 changes: 9 additions & 1 deletion src/Test/modellike.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function default_objective_test(model::MOI.ModelLike)
end

function default_status_test(model::MOI.ModelLike)
MOI.empty!(model)
@test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMIZE_NOT_CALLED
@test MOI.get(model, MOI.PrimalStatus()) == MOI.NO_SOLUTION
@test MOI.get(model, MOI.DualStatus()) == MOI.NO_SOLUTION
Expand Down Expand Up @@ -106,6 +107,7 @@ end

# Taken from https://github.com/JuliaOpt/MathOptInterfaceUtilities.jl/issues/41
function validtest(model::MOI.ModelLike)
MOI.empty!(model)
@test MOIU.supports_default_copy_to(model, #=copy_names=# false)
v = MOI.add_variables(model, 2)
@test MOI.is_valid(model, v[1])
Expand All @@ -125,6 +127,7 @@ function validtest(model::MOI.ModelLike)
end

function emptytest(model::MOI.ModelLike)
MOI.empty!(model)
@test MOIU.supports_default_copy_to(model, #=copy_names=# false)
# Taken from LIN1
v = MOI.add_variables(model, 3)
Expand Down Expand Up @@ -200,6 +203,7 @@ function failcopytestca(dest::MOI.ModelLike)
end

function start_values_test(dest::MOI.ModelLike, src::MOI.ModelLike)
MOI.empty!(dest)
@test MOIU.supports_default_copy_to(src, #=copy_names=# false)
x, y, z = MOI.add_variables(src, 3)
a = MOI.add_constraint(src, x, MOI.EqualTo(1.0))
Expand Down Expand Up @@ -303,7 +307,11 @@ function copytest(dest::MOI.ModelLike, src::MOI.ModelLike)

@test !MOI.supports(dest, MOI.Name()) || MOI.get(dest, MOI.Name()) == ""
@test MOI.get(dest, MOI.NumberOfVariables()) == 4
@test !MOI.supports(dest, MOI.VariableName(), MOI.VariableIndex) || MOI.get(dest, MOI.VariableName(), v) == ["", "", ""]
if MOI.supports(dest, MOI.VariableName(), MOI.VariableIndex)
for vi in v
MOI.get(dest, MOI.VariableName(), dict[vi]) == ""
end
end
@test MOI.get(dest, MOI.NumberOfConstraints{MOI.SingleVariable,MOI.EqualTo{Float64}}()) == 1
@test MOI.get(dest, MOI.ListOfConstraintIndices{MOI.SingleVariable,MOI.EqualTo{Float64}}()) == [dict[csv]]
@test MOI.get(dest, MOI.NumberOfConstraints{MOI.VectorOfVariables,MOI.Nonnegatives}()) == 1
Expand Down