From a85925086edd5608c35414607ef0582873610afe Mon Sep 17 00:00:00 2001 From: odow Date: Fri, 23 Apr 2021 14:28:21 +1200 Subject: [PATCH] [breaking] Rename SolveTime to SolveTimeSec Co-authored-by: guilhermebodin --- docs/src/manual/implementing.md | 2 +- docs/src/reference/models.md | 2 +- src/Test/UnitTests/attributes.jl | 4 ++-- src/Test/intlinear.jl | 2 +- src/attributes.jl | 8 +++++--- test/Test/unit.jl | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/src/manual/implementing.md b/docs/src/manual/implementing.md index f582d044d3..ed712882e4 100644 --- a/docs/src/manual/implementing.md +++ b/docs/src/manual/implementing.md @@ -525,7 +525,7 @@ solution information. * [`ResultCount`](@ref) * [`ObjectiveValue`](@ref) * [`VariablePrimal`](@ref) -* [`SolveTime`](@ref) +* [`SolveTimeSec`](@ref) !!! info You only need to implement [`get`](@ref) for solution attributes. Don't diff --git a/docs/src/reference/models.md b/docs/src/reference/models.md index a8009726c2..b2e961d34c 100644 --- a/docs/src/reference/models.md +++ b/docs/src/reference/models.md @@ -85,7 +85,7 @@ ObjectiveValue DualObjectiveValue ObjectiveBound RelativeGap -SolveTime +SolveTimeSec SimplexIterations BarrierIterations NodeCount diff --git a/src/Test/UnitTests/attributes.jl b/src/Test/UnitTests/attributes.jl index 85afeaab01..53e632ed86 100644 --- a/src/Test/UnitTests/attributes.jl +++ b/src/Test/UnitTests/attributes.jl @@ -103,7 +103,7 @@ unittests["raw_status_string"] = raw_status_string """ solve_time(model::MOI.ModelLike, config::TestConfig) -Test that the [`MOI.SolveTime`](@ref) attribute is implemented for `model`. +Test that the [`MOI.SolveTimeSec`](@ref) attribute is implemented for `model`. """ function solve_time(model::MOI.ModelLike, config::TestConfig) MOI.empty!(model) @@ -123,7 +123,7 @@ function solve_time(model::MOI.ModelLike, config::TestConfig) variable_primal = [(x, 0.0)], ) if config.solve - time = MOI.get(model, MOI.SolveTime()) + time = MOI.get(model, MOI.SolveTimeSec()) @test time ≥ 0.0 end end diff --git a/src/Test/intlinear.jl b/src/Test/intlinear.jl index fdad93f07d..8a245b8e3b 100644 --- a/src/Test/intlinear.jl +++ b/src/Test/intlinear.jl @@ -135,7 +135,7 @@ function int1test(model::MOI.ModelLike, config::TestConfig) @test MOI.get(model, MOI.ObjectiveBound()) >= 19.4 - atol # FIXME the following are currently not implemented in MockOptimizer # @test MOI.get(model, MOI.RelativeGap()) >= 0.0 - # @test MOI.get(model, MOI.SolveTime()) >= 0.0 + # @test MOI.get(model, MOI.SolveTimeSec()) >= 0.0 # @test MOI.get(model, MOI.SimplexIterations()) >= 0 # @test MOI.get(model, MOI.BarrierIterations()) >= 0 # @test MOI.get(model, MOI.NodeCount()) >= 0 diff --git a/src/attributes.jl b/src/attributes.jl index 8dba41a0ee..0be1fa6516 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -956,11 +956,13 @@ A model attribute for the final relative optimality gap, defined as ``\\frac{|b- struct RelativeGap <: AbstractModelAttribute end """ - SolveTime() + SolveTimeSec() A model attribute for the total elapsed solution time (in seconds) as reported by the optimizer. """ -struct SolveTime <: AbstractModelAttribute end +struct SolveTimeSec <: AbstractModelAttribute end + +@deprecate SolveTime SolveTimeSec """ SimplexIterations() @@ -1584,7 +1586,7 @@ function is_set_by_optimize( DualObjectiveValue, ObjectiveBound, RelativeGap, - SolveTime, + SolveTimeSec, SimplexIterations, BarrierIterations, NodeCount, diff --git a/test/Test/unit.jl b/test/Test/unit.jl index 6b62fee2c9..281d958041 100644 --- a/test/Test/unit.jl +++ b/test/Test/unit.jl @@ -418,7 +418,7 @@ end MOIU.set_mock_optimize!( mock, (mock::MOIU.MockOptimizer) -> begin - MOI.set(mock, MOI.SolveTime(), 0.0) + MOI.set(mock, MOI.SolveTimeSec(), 0.0) MOIU.mock_optimize!( mock, MOI.OPTIMAL,