Hi there,
I've observed some behavior with cdd.block_elimination that potentially points to it being broken.
I have a polytope (with H-rep in hand) where I want to remove some variables.
To do this, I've tried a variety of different methods that should all provide equivalent outputs:
- Use
pycddlib's block_elimination to remove the variables
- Use
pycddlib to convert to V-rep, remove the variables I don't want by removing the associated columns, then recover H-rep
- Directly use
cdd's dd_blockElimination method via projection.c. click me.
- Directly use
cdd's dd_FourierElimination method via fourier.c. click me. This was repeated until all desired variables were removed.
- Use the
lrs library's own fourier elimination method. click me. Here, the library repeats fourier elimination until the desired variables are removed.
The above was done with the following variations:
- Columns of my H-rep were permuted. I.e. the position of the variables in the input files were permuted.
- For (1,2), the
pycddlib experiments, use import cdd and import cdd.gmp.
I observed that methods (2-5) all gave equivalent answers regardless of the permutation of the columns, while the result from (1) differed from the results of (2-5). Moreover, (1)'s output differed depending on the permutation of the columns. This leads me to believe that the problem lies with pycddlib's block_elimination.
Below is the information that one can hopefully reproduce the issue with. Please see pycddlib_testing.zip for the complete inputs/outputs & code that does (1,2) from above.
Setup and version info
Here is my environment.yml file. pip was used to install pycddlib.
name: test_pycddlib_block
channels:
- defaults
dependencies:
- numpy=2.4.1
- gmpy2=2.2.2
- pip=26.0.1
- python=3.14.2
- pip:
- pycddlib==3.0.2
- cdd version: 0.94n
- (I know pycddlib uses 0.94m still, but when looking in cddlib's commits, I don't see any changes between 0.94m/0.94n that would explain my observed behavior)
- lrslib version: 7.3
- gmp version: 6.3.0
Polytope in question
The last line is for lrs. This is inputs/polytope_with_linearity.ine in the attached file. There are no redundancies in this representation.
H-representation
linearity 8 1 2 3 4 5 6 7 8
begin
16 13 rational
600 -1 -1 -1 -1 0 1 0 1 1 0 1 0
600 -1 -1 -1 -1 0 1 1 0 0 1 1 0
500 -1 -1 -1 -1 0 1 0 1 0 1 0 1
500 -1 -1 -1 -1 1 0 1 0 1 0 1 0
1000 -1 -1 -1 -1 0 0 0 0 0 0 0 0
0 -1 0 0 0 1 1 0 0 0 0 0 0
0 0 -1 0 0 0 0 1 1 0 0 0 0
0 0 0 -1 0 0 0 0 0 1 1 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1
end
eliminate 8 5 6 7 8 9 10 11 12
Polytope with permuted indices
This is inputs/polytope_with_linearity_permuted_cols.ine in the attached file. There are no redundancies in this representation.
H-representation
linearity 8 1 2 3 4 5 6 7 8
begin
16 13 rational
600 -1 0 1 -1 0 1 -1 1 0 -1 1 0
600 -1 0 1 -1 1 0 -1 0 1 -1 1 0
500 -1 0 1 -1 0 1 -1 0 1 -1 0 1
500 -1 1 0 -1 1 0 -1 1 0 -1 1 0
1000 -1 0 0 -1 0 0 -1 0 0 -1 0 0
0 -1 1 1 0 0 0 0 0 0 0 0 0
0 0 0 0 -1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 -1 1 1 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1
end
eliminate 8 2 3 5 6 8 9 11 12
Expected output from eliminating last 8 variables
Below is an example of the expected output. Outputs from methods (2-5) from above give equivalent H-reps. There are no redundancies in this representation.
H-representation
linearity 1 1
begin
10 5 real
1000 -1 -1 -1 -1
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
-100 1 1 0 0
-100 1 0 1 0
-1000 1 1 1 2
-1100 1 1 2 2
-1100 1 2 1 2
-1200 2 1 1 2
end
pycddlib output for above polytope using block_elimination
The following representation has no redundancies.
H-representation
begin
8 5 rational
1200 0 -1 -1 -2
-1200 2 1 1 2
-1100 1 2 1 2
1100 -1 0 -1 -2
-1100 1 1 2 2
1100 -1 -1 0 -2
1000 -1 -1 -1 -1
0 0 0 0 1
end
The number of inequalities is wrong, 8 here instead of the expected 10 and there is no linearity constraint on the second to last constraint.
pycddlib output for polytope with permuted indices using block_elimination
Similar story here. There are no redundancies and there different number of constraints.
H-representation
linearity 1 1
begin
7 5 rational
500 -1 -1 -1 -1
-100 0 1 0 1
-100 0 0 1 1
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
end
Hi there,
I've observed some behavior with
cdd.block_eliminationthat potentially points to it being broken.I have a polytope (with H-rep in hand) where I want to remove some variables.
To do this, I've tried a variety of different methods that should all provide equivalent outputs:
pycddlib'sblock_eliminationto remove the variablespycddlibto convert to V-rep, remove the variables I don't want by removing the associated columns, then recover H-repcdd'sdd_blockEliminationmethod viaprojection.c. click me.cdd'sdd_FourierEliminationmethod viafourier.c. click me. This was repeated until all desired variables were removed.lrslibrary's own fourier elimination method. click me. Here, the library repeats fourier elimination until the desired variables are removed.The above was done with the following variations:
pycddlibexperiments, useimport cddandimport cdd.gmp.I observed that methods (2-5) all gave equivalent answers regardless of the permutation of the columns, while the result from (1) differed from the results of (2-5). Moreover, (1)'s output differed depending on the permutation of the columns. This leads me to believe that the problem lies with
pycddlib'sblock_elimination.Below is the information that one can hopefully reproduce the issue with. Please see pycddlib_testing.zip for the complete inputs/outputs & code that does (1,2) from above.
Setup and version info
Here is my
environment.ymlfile.pipwas used to installpycddlib.Polytope in question
The last line is for
lrs. This isinputs/polytope_with_linearity.inein the attached file. There are no redundancies in this representation.Polytope with permuted indices
This is
inputs/polytope_with_linearity_permuted_cols.inein the attached file. There are no redundancies in this representation.Expected output from eliminating last 8 variables
Below is an example of the expected output. Outputs from methods (2-5) from above give equivalent H-reps. There are no redundancies in this representation.
pycddliboutput for above polytope usingblock_eliminationThe following representation has no redundancies.
The number of inequalities is wrong, 8 here instead of the expected 10 and there is no linearity constraint on the second to last constraint.
pycddliboutput for polytope with permuted indices usingblock_eliminationSimilar story here. There are no redundancies and there different number of constraints.