diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e34559..4e39cbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ### 0.2.1 (Upcoming Release) +- Typed Inf used instead of Inf64 in Johnson's rule. + ### 0.2.1 diff --git a/src/johnsons.jl b/src/johnsons.jl index cfa3a72..4e1f1df 100644 --- a/src/johnsons.jl +++ b/src/johnsons.jl @@ -92,6 +92,9 @@ function johnsons_2machines(timesmatrix::Matrix)::JohnsonResult times = copy(timesmatrix) n, m = size(times) @assert m == 2 + + typed_inf = typemax(eltype(times)) + permutation = [-1 for i in 1:n] for i in 1:n locrow, loccol = argmin(times).I @@ -100,7 +103,7 @@ function johnsons_2machines(timesmatrix::Matrix)::JohnsonResult else dolast!(locrow, permutation) end - times[locrow, :] .= Inf + times[locrow, :] .= typed_inf end return JohnsonResult(permutation) end diff --git a/test/testjohnsons.jl b/test/testjohnsons.jl index 9a55a07..aa40479 100644 --- a/test/testjohnsons.jl +++ b/test/testjohnsons.jl @@ -85,5 +85,24 @@ end + @testset "Other types of matrices (Int)" begin + + mat = rand(1:10, 10, 2) + + result = johnsons(mat) + + # expect no error + @test true + end + + @testset "Other types of matrices (UInt8)" begin + + mat = convert(Array{UInt8, 2}, rand(1:10, 10, 2)) + + result = johnsons(mat) + + # expect no error + @test true + end end \ No newline at end of file