Skip to content

Commit

Permalink
version from Project (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
guimarqu authored Mar 31, 2022
1 parent b3f413e commit 8609ff0
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"

[compat]
BlockDecomposition = "1.7"
DataStructures = "0.17, 0.18"
DynamicSparseArrays = "0.5.3"
MathOptInterface = "~0.10, 1.0"
Parameters = "0.12"
TimerOutputs = "0.5"
Expand All @@ -34,4 +34,4 @@ KnapsackLib = "86859df6-51c5-4863-9ac2-2c1ab8e53eb2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["ColunaDemos", "GLPK", "HiGHS", "JuMP", "KnapsackLib", "Test"]
test = ["ColunaDemos", "GLPK", "HiGHS", "JuMP", "KnapsackLib", "Test", "TOML"]
12 changes: 11 additions & 1 deletion src/Coluna.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Base: isempty, hash, isequal, length, iterate, getindex, lastindex,

import BlockDecomposition, MathOptInterface, TimerOutputs

using Base.Threads, Dates, Distributed, DynamicSparseArrays, Logging, Parameters, Printf
using Base.Threads, Dates, Distributed, DynamicSparseArrays, Logging, Parameters, Printf, TOML

const BD = BlockDecomposition
const MOI = MathOptInterface
Expand All @@ -27,6 +27,16 @@ export Algorithm, ColunaBase, MathProg, Env, DefaultOptimizer, Parameters,

const _to = TO.TimerOutput()

const _COLUNA_VERSION = Ref{VersionNumber}()

function __init__()
# Read Coluna version from Project.toml file
coluna_ver = VersionNumber(TOML.parsefile(joinpath(@__DIR__, "..", "Project.toml"))["version"])
_COLUNA_VERSION[] = coluna_ver
end

version() = _COLUNA_VERSION[]

include("kpis.jl")

include("parameters.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/MOIwrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mutable struct Optimizer <: MOI.AbstractOptimizer
end

MOI.get(::Optimizer, ::MOI.SolverName) = "Coluna"
MOI.get(::Optimizer, ::MOI.SolverVersion) = "0.3.12"
MOI.get(::Optimizer, ::MOI.SolverVersion) = string(Coluna.version())

############################################################################################
# Empty.
Expand Down
2 changes: 1 addition & 1 deletion src/optimize.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function _welcome_message()
welcome = """
Coluna
Version 0.3.12 | 2022-02-17 | https://github.com/atoptima/Coluna.jl
Version $(version()) | https://github.com/atoptima/Coluna.jl
"""
print(welcome)
end
Expand Down
10 changes: 9 additions & 1 deletion test/ColunaTests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ColunaTests
using Base.CoreLogging: error
using DynamicSparseArrays, Coluna
using DynamicSparseArrays, Coluna, TOML

using ReTest, GLPK, ColunaDemos, JuMP, BlockDecomposition, Random, MathOptInterface, MathOptInterface.Utilities, Base.CoreLogging, Logging
global_logger(ConsoleLogger(stderr, LogLevel(0)))
Expand All @@ -21,6 +21,14 @@ module ColunaTests

rng = MersenneTwister(1234123)

@testset "Version" begin
coluna_ver = Coluna.version()
toml_ver = VersionNumber(
TOML.parsefile(joinpath(@__DIR__, "..", "Project.toml"))["version"]
)
@test coluna_ver == toml_ver
end

########################################################################################
# Unit tests
########################################################################################
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
KnapsackLib = "86859df6-51c5-4863-9ac2-2c1ab8e53eb2"
Expand Down

0 comments on commit 8609ff0

Please sign in to comment.