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

Tidy MOI.test.runtests to get tests passing again #124

Merged
merged 1 commit into from
Nov 7, 2023
Merged
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
156 changes: 68 additions & 88 deletions test/moit_tests.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Copyright (c) 2018: Matthew Wilhelm, Robert Gottlieb, Dimitri Alston,
# Matthew Stuber, and the University of Connecticut (UConn).
# This code is licensed under the MIT license (see LICENSE.md for full details).

module TestEAGO

import EAGO
using MathOptInterface
using Test

const MOI = MathOptInterface
const OPTIMIZER = MOI.instantiate(MOI.OptimizerWithAttributes(EAGO.Optimizer, MOI.Silent() => true))
const BRIDGED = MOI.instantiate(MOI.OptimizerWithAttributes(EAGO.Optimizer, MOI.Silent() => true), with_bridge_type = Float64)
const CONFIG = MOI.Test.Config(atol = 1E-3, rtol = 1E-3, optimal_status = MOI.OPTIMAL,
exclude = Any[MOI.DualObjectiveValue, MOI.ConstraintBasisStatus, MOI.ConstraintName, MOI.delete,
MOI.ConstraintDual, MOI.ListOfModelAttributesSet, MOI.add_constrained_variables])
import EAGO
import MathOptInterface as MOI

"""
runtests()
Expand All @@ -24,6 +22,7 @@ function runtests()
end
end
end
return
end

"""
Expand All @@ -35,89 +34,70 @@ Pass arguments to `exclude` to skip tests for functionality that is not
implemented or that your solver doesn't support.
"""
function test_runtests()
MOI.Test.runtests(BRIDGED, CONFIG,
exclude = [# Ipopt inherited test exclusions
"test_model_ScalarFunctionConstantNotZero",
"test_solve_TerminationStatus_DUAL_INFEASIBLE",
"test_linear_VectorAffineFunction_empty_row",
"test_solve_DualStatus_INFEASIBILITY_CERTIFICATE_",
"test_model_LowerBoundAlreadySet",
"test_model_UpperBoundAlreadySet",
"test_model_copy_to_UnsupportedAttribute",
"test_model_copy_to_UnsupportedConstraint",
"test_objective_set_via_modify",
"test_conic_linear_VectorOfVariables_2",

# Cbc default test exclusions
"test_linear_Indicator_",
"test_linear_SOS1_integration",
"test_linear_SOS2_integration",
"test_solve_SOS2_add_and_delete",
"test_conic_NormInfinityCone_INFEASIBLE",
"test_conic_NormOneCone_INFEASIBLE",
"test_solve_TerminationStatus_DUAL_INFEASIBLE",

# EAGO test exclusions
"test_attribute_NumberOfThreads",
"test_modification_",
"test_linear_integration_delete_variables",

# EAGO exclusions to resolve (by adding conic support later and fixing twice solve issues)
"test_conic_NormOneCone_VectorAffineFunction",
"test_conic_NormOneCone_VectorOfVariables",
"test_conic_NormInfinityCone_VectorOfVariables",
"test_conic_NormInfinityCone_VectorAffineFunction",
"test_conic_NormInfinityCone_3",
r"^test_conic_NormOneCone$",
r"^test_conic_linear_VectorOfVariables$",
r"^test_conic_linear_VectorAffineFunction$",
"test_conic_linear_VectorAffineFunction_2",

"test_linear_integer_solve_twice",
r"^test_linear_integration$",

"test_quadratic_SecondOrderCone_basic",
"test_quadratic_constraint_GreaterThan",
"test_quadratic_constraint_LessThan",
"test_quadratic_constraint_minimize",
"test_quadratic_duplicate_terms",
"test_quadratic_integration",
"test_quadratic_nonconvex_constraint_integration",
"test_quadratic_homogeneous",
"test_quadratic_nonhomogeneous",
"test_quadratic_constraint_integration",
"test_quadratic_constraint_basic",
"test_quadratic_nonconvex_constraint_basic",

"test_constraint_qcp_duplicate_diagonal",
"test_constraint_qcp_duplicate_off_diagonal",
"test_objective_get_ObjectiveFunction_ScalarAffineFunction",
"test_objective_qp_ObjectiveFunction_edge_cases",
"test_objective_qp_ObjectiveFunction_zero_ofdiag",

"test_model_ModelFilter_ListOfConstraintIndices",
"test_model_ModelFilter_ListOfConstraintTypesPresent",

# MOI constraint type exclusions
"test_cpsat_Circuit",
"test_cpsat_CountAtLeast",
"test_cpsat_Table",
"test_linear_Semicontinuous_integration",
"test_linear_Semiinteger_integration",

# EAGO B&B handles interval bounds internally
"test_linear_open_intervals",
"test_linear_variable_open_intervals",

# EAGO does not have constraint names
"test_model_Name_VariableName_ConstraintName"

],
exclude_tests_after = v"1.18.0")
model = MOI.instantiate(
EAGO.Optimizer;
with_bridge_type = Float64,
with_cache_type = Float64,
)
MOI.set(model, MOI.Silent(), true)
MOI.Test.runtests(
model,
MOI.Test.Config(;
atol = 1e-3,
rtol = 1e-3,
exclude = Any[
MOI.DualObjectiveValue,
MOI.ConstraintBasisStatus,
MOI.VariableBasisStatus,
MOI.ConstraintDual,
],
);
exclude = String[
# Okay to exclude: returns INFEASIBLE_OR_UNBOUNDED instead of
# INFEASIBLE
"test_conic_NormInfinityCone_INFEASIBLE",
"test_conic_NormOneCone_INFEASIBLE",
# Okay to exclude: these tests throw the following warning and don't
# terminate quickly.
# ┌ Warning: At least one branching variable is unbounded. This will interfere with EAGO's global
# │ optimization routine and may cause unexpected results. Bounds have been automatically
# │ generated at +/- 1E10 for all unbounded variables, but tighter user-defined bounds are
# │ highly recommended. To disable this warning and the automatic generation of bounds, use
# │ the option `unbounded_check = false`.
# └ @ EAGO ~/.julia/dev/EAGO/src/eago_optimizer/optimize/nonconvex/stack_management.jl:256
"test_objective_qp_ObjectiveFunction_edge_cases",
"test_quadratic_SecondOrderCone_basic",
# TODO: wrong solutions. Likely a bug in EAGO.jl
"test_conic_NormInfinityCone_VectorAffineFunction",
"test_conic_NormInfinityCone_VectorOfVariables",
"test_conic_NormOneCone_VectorAffineFunction",
"test_conic_NormOneCone_VectorOfVariables",
"test_conic_linear_VectorAffineFunction",
"test_cpsat_Circuit",
"test_cpsat_CountAtLeast",
"test_cpsat_Table",
"test_linear_Semicontinuous_integration",
"test_linear_Semiinteger_integration",
"test_linear_integer_solve_twice",
"test_linear_integration",
"test_quadratic_duplicate_terms",
"test_quadratic_integration",
"test_quadratic_nonhomogeneous",
"test_quadratic_constraint_LessThan",
"test_quadratic_constraint_GreaterThan",
"test_modification_affine_deletion_edge_cases",
"test_solve_SOS2_add_and_delete",
# TODO: wrong error thrown. Likely (trivial) bug in MOI wrapper
"test_model_LowerBoundAlreadySet",
"test_model_UpperBoundAlreadySet",
],
exclude_tests_after = v"1.22.0",
)
return
end

end

@testset "MOI" begin
TestEAGO.runtests()
end
end
Loading