Esempio n. 1
0
def get_all_allocation_combination(robot_pos_list, target_pos_list):
    # i'th target is allocated to which value robot
    base = [0 for i in range(len(target_pos_list))]
    limit = [len(robot_pos_list) for i in range(len(target_pos_list))]
    allocations = []
    while(True):
        allocations.append([[] for i in range(len(robot_pos_list))])
        for target, robot in enumerate(base):
            allocations[-1][robot].append(target_pos_list[target])
        if reached_limit(base, limit):
            break
        increment(base, limit)
    return allocations
Esempio n. 2
0
 def getNeighbourStates(self):
     global connectedness
     
     neighbours = []
     
     moveCombinations = []
     
     base = [0 for i in range(len(self.robots))]
     limit = [connectedness for i in range(len(self.robots))]
     while(True):
         moveCombinations.append(base[:])
         if reached_limit(base, limit):
             break
         increment(base, limit)
         
     for move in moveCombinations:
         state = self.transition(move)
         if state.isValidState():
             neighbours.append(state)
     
     return neighbours