diff --git a/src/interface/quadratization.jl b/src/interface/quadratization.jl index 5bc486b..6757472 100644 --- a/src/interface/quadratization.jl +++ b/src/interface/quadratization.jl @@ -17,7 +17,7 @@ end @doc raw""" infer_quadratization(f::AbstractPBF) -For a given PBF, returns whether it should be quadratized or not, based on its degree. +For a given PBF, returns whether it should be quadratized or not, based on its characteristics. """ function infer_quadratization end diff --git a/src/library/variables/varlt.jl b/src/library/variables/varlt.jl index 6ddd5f3..84c5fbb 100644 --- a/src/library/variables/varlt.jl +++ b/src/library/variables/varlt.jl @@ -6,6 +6,8 @@ function varlt(u::V, v::V) where {V<:Signed} # 0, 1, 2, 3, ..., -1, -2, -3, ... if sign(u) == sign(v) return isless(abs(u), abs(v)) + elseif sign(u) >= 0 && sign(v) >= 0 + return isless(sign(u), sign(v)) else return isless(sign(v), sign(u)) end diff --git a/test/unit/variables.jl b/test/unit/variables.jl index 6aa0d59..56ef695 100644 --- a/test/unit/variables.jl +++ b/test/unit/variables.jl @@ -11,10 +11,18 @@ function test_variable_system() end @testset "∴ Integer" begin - @test PBO.varlt(1, 1) === false + @test PBO.varlt(0, 1) === true + @test PBO.varlt(1, 0) === false + + @test PBO.varlt(0, -1) === true + @test PBO.varlt(-1, 0) === false + @test PBO.varlt(1, 2) === true @test PBO.varlt(2, 1) === false + @test PBO.varlt(0, 0) === false + @test PBO.varlt(1, 1) === false + @test PBO.varlt(1, -1) === true @test PBO.varlt(-1, 1) === false