def testNotSubsumming(self): """ Test if the subsumming test is okay. """ areSubsummed = [[(1,0), (1,0)], [(1,0), (0,0)], [(1,0), (2,0)], [(1,0), (3,0)], [(1,0), (3,1)], [(1,0), (4,0)], [(1,0), (4,1)], [(1,0), (4,2)], [(1,0), (5,0)], [(1,0), (5,1)], [(1,0), (5,2)], [(1,0), (5,3)], [(1,0), (6,0)], [(1,0), (6,1)], [(1,0), (6,2)], [(1,0), (6,3)], [(1,0), (6,4)]] n = 1 for entry in areSubsummed: errorMsg = "The entry " + str(entry[0]) + " is not supposed to subsume " +\ "the entry " + str(entry[1]) + " but it is" self.assert_(not fsc.isSubsumming(fsc.StandardPosition(entry[0][0], entry[0][1]), \ fsc.StandardPosition(entry[1][0], entry[1][1]), n), msg = errorMsg)
def testNotSubsumming(self): """ Test if the subsumming test is okay. """ areSubsummed = [[(1, 0), (1, 0)], [(1, 0), (0, 0)], [(1, 0), (2, 0)], [(1, 0), (3, 0)], [(1, 0), (3, 1)], [(1, 0), (4, 0)], [(1, 0), (4, 1)], [(1, 0), (4, 2)], [(1, 0), (5, 0)], [(1, 0), (5, 1)], [(1, 0), (5, 2)], [(1, 0), (5, 3)], [(1, 0), (6, 0)], [(1, 0), (6, 1)], [(1, 0), (6, 2)], [(1, 0), (6, 3)], [(1, 0), (6, 4)]] n = 1 for entry in areSubsummed: errorMsg = "The entry " + str(entry[0]) + " is not supposed to subsume " +\ "the entry " + str(entry[1]) + " but it is" self.assertTrue(not fsc.isSubsumming(fsc.StandardPosition(entry[0][0], entry[0][1]), \ fsc.StandardPosition(entry[1][0], entry[1][1]), n), msg = errorMsg)
def getRightNonSubsumingPositions(n, iAnde, basePos): (i, e) = iAnde positions = [] j = i + 1 maxDistance = basePos[0] + n + 1 maxHigh = 0 while j < maxDistance: f = e - maxHigh while f <= e + maxHigh: if f >= 0 and f <= n \ and fsc.isSubsumming(basePos, (j,f)) \ and j >= 0: positions.append((j, f)) f += 1 j += 1 maxHigh += 1 return positions
def testSubsumming(self): """ Test if the subsumming test is okay. """ areSubsummed = [[(1, 0), (0, 1)], [(1, 0), (1, 1)], [(1, 0), (2, 1)], [(1, 0), (0, 2)], [(1, 0), (1, 2)], [(1, 0), (2, 2)], [(1, 0), (3, 2)], [(1, 0), (0, 3)], [(1, 0), (1, 3)], [(1, 0), (2, 3)], [(1, 0), (3, 3)], [(1, 0), (4, 3)], [(2, 0), (1, 1)], [(2, 0), (2, 1)], [(2, 0), (3, 1)], [(2, 0), (0, 2)], [(2, 0), (1, 2)], [(2, 0), (2, 2)], [(2, 0), (3, 2)], [(2, 0), (4, 2)], [(2, 0), (0, 3)], [(2, 0), (1, 3)], [(2, 0), (2, 3)], [(2, 0), (3, 3)], [(2, 0), (4, 3)], [(2, 0), (5, 3)]] n = 1 for entry in areSubsummed: errorMsg = "The entry " + str(entry[0]) + " is supposed to subsume " +\ "the entry " + str(entry[1]) + " but it isn't" self.assert_(fsc.isSubsumming(fsc.StandardPosition(entry[0][0], entry[0][1]), \ fsc.StandardPosition(entry[1][0], entry[1][1]), n), msg = errorMsg)
import fsc from copy import copy from pdb import set_trace def getRightNonSubsumingPositions(n, (i, e), basePos): positions = [] j = i + 1 maxDistance = basePos[0] + n + 1 maxHigh = 0 while j < maxDistance: f = e - maxHigh while f <= e + maxHigh: if f >= 0 and f <= n \ and fsc.isSubsumming(basePos, (j,f)) \ and j >= 0: positions.append((j, f)) f += 1 j += 1 maxHigh += 1 return positions def powerSet(n, pos, basePos): positions = getRightNonSubsumingPositions(n, pos, basePos) set = [] set.append([pos]) for p in positions: s = map(lambda s: [pos] + s, powerSet(n, p, basePos)) set += s
import fsc from copy import copy from pdb import set_trace def getRightNonSubsumingPositions(n, (i, e), basePos): positions = [] j = i + 1 maxDistance = basePos[0] + n + 1 maxHigh = 0 while j < maxDistance: f = e - maxHigh while f <= e + maxHigh: if f >= 0 and f <= n \ and fsc.isSubsumming(basePos, (j,f)) \ and j >= 0: positions.append((j, f)) f += 1 j += 1 maxHigh += 1 return positions def powerSet(n, pos, basePos): positions = getRightNonSubsumingPositions(n, pos, basePos) set = [] set.append([pos]) for p in positions: s = map(lambda s: [pos] + s, powerSet(n, p, basePos)) set += s return set