-
Notifications
You must be signed in to change notification settings - Fork 9
/
MOI_wrapper.jl
140 lines (132 loc) · 5.81 KB
/
MOI_wrapper.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
module TestCSDP
using Test
using MathOptInterface
import CSDP
const MOI = MathOptInterface
function runtests()
for name in names(@__MODULE__; all = true)
if startswith("$(name)", "test_")
@testset "$(name)" begin
getfield(@__MODULE__, name)()
end
end
end
return
end
function test_solver_name()
@test MOI.get(CSDP.Optimizer(), MOI.SolverName()) == "CSDP"
end
function test_options()
param = MOI.RawOptimizerAttribute("bad_option")
err = MOI.UnsupportedAttribute(param)
@test_throws err MOI.set(
CSDP.Optimizer(),
MOI.RawOptimizerAttribute("bad_option"),
0,
)
end
function test_runtests()
model = MOI.Utilities.CachingOptimizer(
MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()),
MOI.instantiate(CSDP.Optimizer, with_bridge_type = Float64),
)
# `Variable.ZerosBridge` makes dual needed by some tests fail.
MOI.Bridges.remove_bridge(
model.optimizer,
MathOptInterface.Bridges.Variable.ZerosBridge{Float64},
)
MOI.set(model, MOI.Silent(), true)
MOI.Test.runtests(
model,
MOI.Test.Config(
rtol = 1e-3,
atol = 1e-3,
exclude = Any[
MOI.ConstraintBasisStatus,
MOI.VariableBasisStatus,
MOI.ObjectiveBound,
MOI.SolverVersion,
],
),
exclude = String[
# Empty constraint not supported
"test_linear_VectorAffineFunction_empty_row",
"test_conic_PositiveSemidefiniteConeTriangle",
# SLOW_PROGRESS
"test_quadratic_constraint_basic",
"test_quadratic_constraint_minimize",
# FIXME need to investigate
# Expression: MOI.get(model, MOI.TerminationStatus()) == config.infeasible_status
# Evaluated: MathOptInterface.OPTIMAL == MathOptInterface.INFEASIBLE
"test_conic_SecondOrderCone_INFEASIBLE",
# FIXME need to investigate
"test_objective_qp_ObjectiveFunction_edge_cases",
# See https://github.com/jump-dev/MathOptInterface.jl/issues/1761
"test_constraint_PrimalStart_DualStart_SecondOrderCone",
# FIXME investigate
# Internal library error: status=-1
"test_model_default_DualStatus",
"test_model_default_PrimalStatus",
# FIXME investigate
# Expression: isapprox(MOI.get(model, MOI.ObjectiveValue()), T(2), config)
# Evaluated: isapprox(6.0, 2.0, ...
"test_modification_delete_variables_in_a_batch",
# FIXME investigate
# Expression: isapprox(MOI.get(model, MOI.ObjectiveValue()), objective_value, config)
# Evaluated: isapprox(4.162643563176971e-9, 5.0
"test_objective_qp_ObjectiveFunction_zero_ofdiag",
# FIXME investigate
# Expression: isapprox(MOI.get(model, MOI.ConstraintPrimal(), index), solution_value, config)
# Evaluated: isapprox(9.973062820023415e-9, 1.0, ...
"test_variable_solve_with_lowerbound",
# TODO CSDP just returns an infinite ObjectiveValue
"test_unbounded_MIN_SENSE",
"test_unbounded_MIN_SENSE_offset",
"test_unbounded_MAX_SENSE",
"test_unbounded_MAX_SENSE_offset",
# TODO SDPT3 just returns an infinite DualObjectiveValue
"test_infeasible_MAX_SENSE",
"test_infeasible_MAX_SENSE_offset",
"test_infeasible_MIN_SENSE",
"test_infeasible_MIN_SENSE_offset",
"test_infeasible_affine_MAX_SENSE",
"test_infeasible_affine_MAX_SENSE_offset",
"test_infeasible_affine_MIN_SENSE",
"test_infeasible_affine_MIN_SENSE_offset",
# See https://github.com/jump-dev/MathOptInterface.jl/issues/1758
"test_model_copy_to_UnsupportedAttribute",
# FIXME The following are weird test failures that occur only on Github Actions for Mac OS but not Linux.
# It also seems to not be consistent between runs:
# Incorrect solution
"test_objective_ObjectiveFunction_VariableIndex",
"test_conic_SecondOrderCone_negative_post_bound",
"test_solve_result_index",
"test_modification_set_singlevariable_lessthan",
"test_conic_SecondOrderCone_nonnegative_initial_bound",
"test_objective_FEASIBILITY_SENSE_clears_objective",
# ALMOST_OPTIMAL
"test_conic_RotatedSecondOrderCone_VectorOfVariables",
# NUMERICAL_ERROR
"test_objective_ObjectiveFunction_blank",
"test_objective_ObjectiveFunction_duplicate_terms",
"test_modification_transform_singlevariable_lessthan",
"test_conic_SecondOrderCone_no_initial_bound",
"test_conic_SecondOrderCone_negative_initial_bound",
"test_solve_TerminationStatus_DUAL_INFEASIBLE",
"test_modification_set_singlevariable_lessthan:",
"test_modification_delete_variable_with_single_variable_obj",
# Expression: MOI.get(model, MOI.TerminationStatus()) == MOI.DUAL_INFEASIBLE
# Evaluated: MathOptInterface.INFEASIBLE == MathOptInterface.DUAL_INFEASIBLE
"test_conic_SecondOrderCone_negative_post_bound_2",
"test_conic_SecondOrderCone_negative_post_bound_3",
# Expression: MOI.get(model, MOI.TerminationStatus()) == config.optimal_status
# Evaluated: MathOptInterface.INFEASIBLE == MathOptInterface.OPTIMAL
"test_modification_const_scalar_objective",
"test_modification_coef_scalar_objective",
"test_modification_set_singlevariable_lessthan",
],
)
return
end
end # module
TestCSDP.runtests()