def test_append_one_row(self): I = examples.scott_example() #print("Matrix vorher append one row:" ,I.representation()) I.appendRow("I", ["00", "01", "02", "03", "04"]) rep = [I.columnObjectOfName[i].representation() for i in ["I", "00", "01", "02", "03", "04"]] #print("columnObjectRepresentation" + str(rep)) self.assertEqual([[[['h(1)', 'I', 'F', 'L', 'I[0]', 'I[0]'], ['c', 'I[0]', 'I04', 'I00', 'I', 'I']]], [[['h(1)', '00', 'Z', '01', 'I00', 'I00'], ['c', 'I00', 'I[0]', 'I01', '00', '00']]], [[['h(1)', '01', '00', '02', 'I01', 'I01'], ['c', 'I01', 'I00', 'I02', '01', '01']]], [[['h(1)', '02', '01', '03', 'I02', 'I02'], ['c', 'I02', 'I01', 'I03', '02', '02']]], [[['h(1)', '03', '02', '04', 'I03', 'I03'], ['c', 'I03', 'I02', 'I04', '03', '03']]], [[['h(1)', '04', '03', '05', 'I04', 'I04'], ['c', 'I04', 'I03', 'I[0]', '04', '04']]]], rep)
def test_append_two_rows(self): I = examples.scott_example() I.appendRow("I", ["00", "01", "02", "03", "04"]) I.appendRow("I", ["01", "02", "03", "04", "05"]) rep = [ I.columnObjectOfName[i].representation() for i in ["I", "00", "01", "02", "03", "04"] ] self.assertEqual([[[['h(2)', 'I', 'F', 'L', 'I[1]', 'I[0]'], ['c', 'I[0]', 'I04', 'I00', 'I', 'I[1]'], ['c', 'I[1]', 'I05', 'I01', 'I[0]', 'I']]], [[['h(1)', '00', 'Z', '01', 'I00', 'I00'], ['c', 'I00', 'I[0]', 'I01', '00', '00']]], [[['h(2)', '01', '00', '02', 'I01', 'I01'], ['c', 'I01', 'I00', 'I02', '01', 'I01'], ['c', 'I01', 'I[1]', 'I02', 'I01', '01']]], [[['h(2)', '02', '01', '03', 'I02', 'I02'], ['c', 'I02', 'I01', 'I03', '02', 'I02'], ['c', 'I02', 'I01', 'I03', 'I02', '02']]], [[['h(2)', '03', '02', '04', 'I03', 'I03'], ['c', 'I03', 'I02', 'I04', '03', 'I03'], ['c', 'I03', 'I02', 'I04', 'I03', '03']]], [[['h(2)', '04', '03', '05', 'I04', 'I04'], ['c', 'I04', 'I03', 'I[0]', '04', 'I04'], ['c', 'I04', 'I03', 'I05', 'I04', '04']]]], rep)
def create_scott_matrix(self, legal): self.IM = examples.scott_example() for p in pentominos.all_fixed_pentominos(): # if p.name in ["I","L","U","V","Y"]:#TODO remove self.create_all_rows_for(p, legal) self.solve_scott_matrix() return self.IM
def test_appendRos(self): I = examples.scott_example() I.initializeIncidenceMatrix() total = 0 column = I.h.right while column != I.h: print(column.size) total += column.size column = column.right total = total / 6 print(total, I.rows) self.assertEqual(total, I.rows, "Sizes not equal")
def test_append_one_row(self): I = examples.scott_example() #print("Matrix vorher append one row:" ,I.representation()) I.appendRow("I", ["00", "01", "02", "03", "04"]) rep = [ I.columnObjectOfName[i].representation() for i in ["I", "00", "01", "02", "03", "04"] ] #print("columnObjectRepresentation" + str(rep)) self.assertEqual([[[['h(1)', 'I', 'F', 'L', 'I[0]', 'I[0]'], ['c', 'I[0]', 'I04', 'I00', 'I', 'I']]], [[['h(1)', '00', 'Z', '01', 'I00', 'I00'], ['c', 'I00', 'I[0]', 'I01', '00', '00']]], [[['h(1)', '01', '00', '02', 'I01', 'I01'], ['c', 'I01', 'I00', 'I02', '01', '01']]], [[['h(1)', '02', '01', '03', 'I02', 'I02'], ['c', 'I02', 'I01', 'I03', '02', '02']]], [[['h(1)', '03', '02', '04', 'I03', 'I03'], ['c', 'I03', 'I02', 'I04', '03', '03']]], [[['h(1)', '04', '03', '05', 'I04', 'I04'], ['c', 'I04', 'I03', 'I[0]', '04', '04']]]], rep)
def test_append_two_rows(self): I = examples.scott_example() I.appendRow("I", ["00", "01", "02", "03", "04"]) I.appendRow("I", ["01", "02", "03", "04", "05"]) rep = [I.columnObjectOfName[i].representation() for i in ["I", "00", "01", "02", "03", "04"]] self.assertEqual([[[['h(2)', 'I', 'F', 'L', 'I[1]', 'I[0]'], ['c', 'I[0]', 'I04', 'I00', 'I', 'I[1]'], ['c', 'I[1]', 'I05', 'I01', 'I[0]', 'I']]], [[['h(1)', '00', 'Z', '01', 'I00', 'I00'], ['c', 'I00', 'I[0]', 'I01', '00', '00']]], [[['h(2)', '01', '00', '02', 'I01', 'I01'], ['c', 'I01', 'I00', 'I02', '01', 'I01'], ['c', 'I01', 'I[1]', 'I02', 'I01', '01']]], [[['h(2)', '02', '01', '03', 'I02', 'I02'], ['c', 'I02', 'I01', 'I03', '02', 'I02'], ['c', 'I02', 'I01', 'I03', 'I02', '02']]], [[['h(2)', '03', '02', '04', 'I03', 'I03'], ['c', 'I03', 'I02', 'I04', '03', 'I03'], ['c', 'I03', 'I02', 'I04', 'I03', '03']]], [[['h(2)', '04', '03', '05', 'I04', 'I04'], ['c', 'I04', 'I03', 'I[0]', '04', 'I04'], ['c', 'I04', 'I03', 'I05', 'I04', '04']]]], rep)
def test_solve(self): I = examples.scott_example() print(I.representation()) I.initializeIncidenceMatrix() I.solve()
def run_scott_example(): matrix = examples.scott_example() #print(str(matrix.representation())) append_all_possible_placements(matrix) #print(str(matrix.representation())) Algorithm_X(matrix)