Skip to content

Commit

Permalink
Test redundant generators.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmtroffaes committed Sep 19, 2024
1 parent 4928591 commit a1efde6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/test_redundant.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,24 @@ def test_redundant_inequalities_3() -> None:
assert_redundant_equal(mat, 1, False, [-15, 10])
# 0 <= 1 - 28 + 27, 0 <= 4 + 14 - 18, 0 <= 5 - 14 + 9
assert_redundant_equal(mat, 2, True, [-14, 9])


def test_redundant_generators_1() -> None:
mat = cdd.matrix_from_array([[1, 1]], rep_type=cdd.RepType.GENERATOR, lin_set={0})
assert cdd.redundant(mat, 0) == (False, [0, 0])


def test_redundant_generators_2() -> None:
mat = cdd.matrix_from_array([[1, 1], [1, 2], [1, 3]], rep_type=cdd.RepType.GENERATOR)
assert_redundant_equal(mat, 0, False, [-2, 1])
assert_redundant_equal(mat, 1, True, [0, 0])
assert_redundant_equal(mat, 2, False, [2, -1])


def test_redundant_generators_3() -> None:
mat = cdd.matrix_from_array(
[[1, 1, 3], [1, 5, 1], [1, 3, 2]], rep_type=cdd.RepType.GENERATOR
)
assert_redundant_equal(mat, 0, False, [-1.5, 0.5, 0])
assert_redundant_equal(mat, 1, False, [1.5, -0.5, 0])
assert_redundant_equal(mat, 2, True, [0, 0, 0])

0 comments on commit a1efde6

Please sign in to comment.