Skip to content

Commit

Permalink
Merge 11cbad0 into 39570d3
Browse files Browse the repository at this point in the history
  • Loading branch information
bjk17 committed Sep 7, 2019
2 parents 39570d3 + 11cbad0 commit a787f0e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
14 changes: 8 additions & 6 deletions demo/mesh_tiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def __init__(self, cells={}):
self.MAX_ACTIVE_CELLS = 3

# Clean empty rows and columns and save cells with shifted coordinates
Xs, Ys = set(x for (x, y) in cells), set(y for (x, y) in cells)
Xs = set(x for (x, y) in cells if not cells[(x, y)].is_empty())
Ys = set(y for (x, y) in cells if not cells[(x, y)].is_empty())
self.columns, self.rows = max(1, len(Xs)), max(1, len(Ys))

compression_dict = {
Expand All @@ -145,11 +146,12 @@ def __init__(self, cells={}):
self.cells = {}
self.tiling = [self.empty_cell] * (self.columns * self.rows)
for (old_col, old_row), cell in cells.items():
col = compression_dict['col'][old_col]
row = compression_dict['row'][old_row]
self.cells[(col, row)] = cell
self.tiling[
self.convert_coordinates_to_linear_number(col, row)] = cell
if not cell.is_empty():
col = compression_dict['col'][old_col]
row = compression_dict['row'][old_row]
self.cells[(col, row)] = cell
self.tiling[
self.convert_coordinates_to_linear_number(col, row)] = cell

# Linear number = (column, row)
# -----------------------------------
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def read(fname):

setup(
name="CombCov",
version="0.6.0",
version="0.6.1",
author="Permuta Triangle",
author_email="permutatriangle@gmail.com",
description="Searching for combinatorial covers.",
Expand All @@ -31,7 +31,7 @@ def read(fname):
],
setup_requires=["pytest-runner==5.1"],
tests_require=[
"pytest==5.1.1",
"pytest==5.1.2",
"pytest-cov==2.7.1",
"pytest-pep8==1.0.6",
"pytest-isort==0.3.1",
Expand Down
7 changes: 7 additions & 0 deletions tests/test_mesh_tiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ def test_invalid_obstruction(self):
with pytest.raises(ValueError):
list(invalid_mt.get_subrules())

def test_extra_empty_cell(self):
root_mt_with_extra_empty_cell = MeshTiling({
(0, 0): self.root_mp_cell,
(1, 1): MeshTiling.empty_cell
})
assert self.root_mt == root_mt_with_extra_empty_cell

def test_get_elmnts_of_size_Av21_cell(self):
mt = MeshTiling({
(0, 0): Cell(frozenset({Perm((1, 0))}), frozenset()),
Expand Down

0 comments on commit a787f0e

Please sign in to comment.