Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dependence on the order of constraints: Redundant rays #51

Open
oyamad opened this issue Jan 16, 2025 · 1 comment
Open

Dependence on the order of constraints: Redundant rays #51

oyamad opened this issue Jan 16, 2025 · 1 comment

Comments

@oyamad
Copy link
Member

oyamad commented Jan 16, 2025

Bug?/feature? detected when looking into the error in #50

Consider the polyhedron defined by

    @variable(m, x[1:3]  1)
    @constraints(m, begin
        x[1] == 2
        x[2]  2
    end)

(https://github.com/JuliaPolyhedra/Polyhedra.jl/blob/3f8c92022f89bea68d71f7b18e45627d31ea587a/test/nonfulldimensional.jl#L7-L11)

Obtain a V-representation by LRSLib.jl:

using LRSLib

M = Rational{BigInt}[
    -1 1 0 0
    -1 0 1 0
    -1 0 0 1
    2 -1 0 0
    2 0 -1 0
]
d = 3
m = 4
linearity = BitSet(m)
P, Q = LRSLib.initmatrix(M, linearity, true)
hr1 = LRSLib.HMatrix(d, P, Q)
convert(LRSLib.VMatrix, hr1)

Output:

V-representation LRSLib.VMatrix:
2-element iterator of Vector{Rational{BigInt}}:
 Rational{BigInt}[2, 2, 1]
 Rational{BigInt}[2, 1, 1],
1-element iterator of Polyhedra.Ray{Rational{BigInt}, Vector{Rational{BigInt}}}:
 Ray(Rational{BigInt}[0, 0, 1])

Then change the order in which the constraints are lined up, by letting the last one (x[2] ≤ 2) show up in the first row:

M = Rational{BigInt}[
    2 0 -1 0
    -1 1 0 0
    -1 0 1 0
    -1 0 0 1
    2 -1 0 0
]
d = 3
m = 5
linearity = BitSet(m)
P, Q = LRSLib.initmatrix(M, linearity, true)
hr2 = LRSLib.HMatrix(d, P, Q)
convert(LRSLib.VMatrix, hr2)

Output:

V-representation LRSLib.VMatrix:
2-element iterator of Vector{Rational{BigInt}}:
 Rational{BigInt}[2, 1, 1]
 Rational{BigInt}[2, 2, 1],
2-element iterator of Polyhedra.Ray{Rational{BigInt}, Vector{Rational{BigInt}}}:
 Ray(Rational{BigInt}[0, 0, 1])
 Ray(Rational{BigInt}[0, 0, 1])

The same ray is repeated twice...

@blegat
Copy link
Member

blegat commented Jan 16, 2025

Weird, that seems like a bug

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants