def testfoundBreakThroughTwo (self): ''' This should fail because there NO labelled demand vertices to consider. ''' demandLabelsList = [-1] * 4 MATCHEDGraphBoolMatrix = numpy.array ( [False]*16).reshape(4,4) res = HungarianAssignment.findFirstBreakThroughIndex ( demandLabelsList, MATCHEDGraphBoolMatrix ) self.failUnless ( res==None )
def testfoundBreakThroughOne (self): ''' This will pass because the last demand node is not attached to any edges in the MATCHED graph : it's a breakthrough... ''' demandLabelsList = [-1] * 4 demandLabelsList [3] = 0 MATCHEDGraphBoolMatrix = numpy.array ( [False]*16).reshape(4,4) res = HungarianAssignment.findFirstBreakThroughIndex ( demandLabelsList, MATCHEDGraphBoolMatrix ) self.failUnless ( res == 3 )
def testfoundBreakThroughThree (self): ''' This will fail because although there are labelled demand vertices, edges in graph MATCHED do in fact connect to both of them. ''' demandLabelsList = [-1] * 4 demandLabelsList [0] = 0 demandLabelsList [3] = 1 MATCHEDGraphBoolMatrix = numpy.array ( [False]*16).reshape(4,4) MATCHEDGraphBoolMatrix [ 0:1 , 0:1 ] = True MATCHEDGraphBoolMatrix [ 0:1 , 3:4 ] = True res = HungarianAssignment.findFirstBreakThroughIndex ( demandLabelsList, MATCHEDGraphBoolMatrix ) self.failUnless ( res==None )