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

test BigFloat thru MOI.Test #788

Merged
merged 2 commits into from
Dec 3, 2021
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
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ DocStringExtensions = "0.8"
GenericLinearAlgebra = "0.2"
IterativeSolvers = "0.8, 0.9"
LinearMaps = "2.7, 3"
MathOptInterface = "0.10"
MathOptInterface = "0.10.6"
PolynomialRoots = "1"
Requires = "1"
SpecialFunctions = "1.4, 2"
julia = "1.5"
julia = "1.6"

[extras]
DynamicPolynomials = "7c1d4256-1411-5781-91ec-d7bc3513ac07"
Expand Down
2 changes: 1 addition & 1 deletion src/MathOptInterface/wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function MOI.copy_to(
# objective
opt.obj_sense = MOI.MIN_SENSE
model_c = zeros(T, n)
obj_offset = 0.0
obj_offset = zero(T)
for attr in MOI.get(src, MOI.ListOfModelAttributesSet())
if attr == MOI.Name()
continue
Expand Down
24 changes: 14 additions & 10 deletions test/runmoitests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ include(joinpath(@__DIR__, "moicones.jl"))
end
end

@testset "MOI.Test tests" begin
println("\nstarting MOI.Test tests")
# TODO test other real types
T = Float64
# real types, tolerances, and tests to include for MOI.Test tests
test_T = [
(Float64, 2 * sqrt(sqrt(eps())), 4, String[]),
# TODO add test_linear after MOI 0.10.7 is tagged:
(BigFloat, 2 * eps(BigFloat)^0.2, 1, String["test_conic"]),
]

@testset "MOI.Test tests: $T" for (T, tol_test, tol_relax, includes) in test_T
println("\nstarting MOI.Test tests: $T")
model = MOI.Bridges.full_bridge_optimizer(
MOI.Utilities.CachingOptimizer(
MOI.Utilities.UniversalFallback(MOI.Utilities.Model{T}()),
Hypatia.Optimizer{T}(; default_tol_relax = 4),
Hypatia.Optimizer{T}(; default_tol_relax = tol_relax),
),
T,
)
Expand All @@ -41,19 +46,18 @@ end
model,
MOI.Test.Config(
T,
atol = 2 * sqrt(sqrt(eps(T))),
rtol = 2 * sqrt(sqrt(eps(T))),
atol = tol_test,
rtol = tol_test,
exclude = Any[
MOI.ConstraintBasisStatus,
MOI.VariableBasisStatus,
MOI.ObjectiveBound,
MOI.SolverVersion,
],
),
# include = String["test_conic"],
include = includes,
exclude = String[
# TODO(odow): unexpected failure. But this is probably in the bridge
# layer, not Hypatia.
# TODO(odow): unexpected failure, probably in the bridge layer
"test_model_UpperBoundAlreadySet",
"test_model_LowerBoundAlreadySet",
],
Expand Down