Skip to content

Dependence on the order of constraints: Redundant rays #51

Closed
@oyamad

Description

@oyamad

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions