From 309d35de9c2ddd7d0fc22972538f102e6bd46618 Mon Sep 17 00:00:00 2001 From: mtanneau <9593025+mtanneau@users.noreply.github.com> Date: Wed, 15 Dec 2021 03:49:42 -0500 Subject: [PATCH] Fix MOI tests and tag new version (#109) * Support MOI.SolverVersion attribute * Fix MOI tests * Bump version * Bump Julia compat requirement * Build on julia 1.6 (LTS) * Fix version number --- .github/workflows/ci.yml | 1 + Project.toml | 4 ++-- src/Interfaces/MOI/attributes.jl | 12 +++++++++--- src/Tulip.jl | 2 +- test/Interfaces/MOI_wrapper.jl | 16 +++++++++++++++- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c900ab0..11ff2627 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: fail-fast: false matrix: version: + - '1.6' - '1' - 'nightly' os: diff --git a/Project.toml b/Project.toml index 95e9a150..4eaaa24e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Tulip" uuid = "6dd1b50a-3aae-11e9-10b5-ef983d2400fa" authors = ["Mathieu Tanneau "] -version = "0.8.0" +version = "0.9.0" [deps] CodecBzip2 = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd" @@ -28,4 +28,4 @@ LinearOperators = "2.0" MathOptInterface = "0.10" QPSReader = "0.2" TimerOutputs = "0.5.6" -julia = "1.3" +julia = "1.6" diff --git a/src/Interfaces/MOI/attributes.jl b/src/Interfaces/MOI/attributes.jl index 5fda811b..510e776b 100644 --- a/src/Interfaces/MOI/attributes.jl +++ b/src/Interfaces/MOI/attributes.jl @@ -5,6 +5,7 @@ const SUPPORTED_OPTIMIZER_ATTR = Union{ MOI.NumberOfThreads, MOI.RawOptimizerAttribute, MOI.SolverName, + MOI.SolverVersion, MOI.Silent, MOI.TimeLimitSec, } @@ -32,6 +33,11 @@ end # MOI.get(::Optimizer, ::MOI.SolverName) = "Tulip" +# +# SolverVersion +# +MOI.get(::Optimizer, ::MOI.SolverVersion) = string(Tulip.version()) + # # Silent # @@ -139,7 +145,7 @@ function MOI.set(m::Optimizer, ::MOI.ObjectiveSense, s::MOI.OptimizationSense) else error("Objetive sense not supported: $s") end - + return nothing end @@ -231,10 +237,10 @@ end # TODO: use inner query function MOI.get(m::Optimizer, attr::MOI.DualStatus) attr.result_index == 1 || return MOI.NO_SOLUTION - + if isnothing(m.inner.solution) return MOI.NO_SOLUTION else MOISolutionStatus(m.inner.solution.dual_status) end -end \ No newline at end of file +end diff --git a/src/Tulip.jl b/src/Tulip.jl index bcfe2f60..089c3044 100644 --- a/src/Tulip.jl +++ b/src/Tulip.jl @@ -7,7 +7,7 @@ using SparseArrays using TimerOutputs -version() = v"0.8.0" +version() = v"0.9.0" include("utils.jl") diff --git a/test/Interfaces/MOI_wrapper.jl b/test/Interfaces/MOI_wrapper.jl index 64d16ed0..cdccfafe 100644 --- a/test/Interfaces/MOI_wrapper.jl +++ b/test/Interfaces/MOI_wrapper.jl @@ -8,7 +8,12 @@ const OPTIMIZER = TLP.Optimizer() MOI.set(OPTIMIZER, MOI.Silent(), true) -const CONFIG = MOIT.Config(Float64, atol=1e-6, rtol=1e-6, exclude=Any[MOI.ConstraintBasisStatus, MOI.VariableBasisStatus]) +const CONFIG = MOIT.Config(Float64, atol=1e-6, rtol=1e-6, + exclude=Any[ + MOI.ConstraintBasisStatus, + MOI.VariableBasisStatus, + ] +) @testset "Direct optimizer" begin @@ -33,6 +38,9 @@ const CONFIG = MOIT.Config(Float64, atol=1e-6, rtol=1e-6, exclude=Any[MOI.Constr "test_variable_VariableName", # requires get quadratic objective "test_objective_get_ObjectiveFunction_ScalarAffineFunction", + # Tulip not compliant with MOI convention for primal/dual infeasible models + # See expected behavior at https://jump.dev/MathOptInterface.jl/dev/background/infeasibility_certificates/ + "test_unbounded", ] ) @@ -73,6 +81,9 @@ end "test_variable_VariableName", # requires get quadratic objective "test_objective_get_ObjectiveFunction_ScalarAffineFunction", + # Tulip not compliant with MOI convention for primal/dual infeasible models + # See expected behavior at https://jump.dev/MathOptInterface.jl/dev/background/infeasibility_certificates/ + "test_unbounded", ], ) end @@ -111,5 +122,8 @@ MOIU.@model(ModelData, # should be NO_SOLUTION or INFEASIBLE_POINT "test_conic_NormInfinityCone_INFEASIBLE", "test_conic_NormOneCone_INFEASIBLE", + # Tulip not compliant with MOI convention for primal/dual infeasible models + # See expected behavior at https://jump.dev/MathOptInterface.jl/dev/background/infeasibility_certificates/ + "test_unbounded", ]) end