Пример #1
0
    def test_od_mstar_multirobot_paths(self):
        """Tests some simple multirobot cases on ODrM*"""
        from mstar_test import validate_solution, compute_cost
        path = self.find_path(
            self.world_descriptor, ((0, 0), (1, 0)), ((1, 0), (0, 0)), 1, 10)
        self.assertTrue(validate_solution(path))
        self.assertTrue(compute_cost(path) == 4)
        path = self.find_path(self.world_descriptor,
                              ((0, 0), (1, 0), (5, 5)),
                              ((1, 0), (0, 0), (6, 6)), 1, 10)
        self.assertTrue(validate_solution(path))
        self.assertTrue(compute_cost(path) == 6)
        # Test a simple three robot collision along edge
        path = self.find_path(self.world_descriptor,
                              ((3, 0), (0, 0), (2, 0)),
                              ((0, 0), (3, 0), (5, 0)), 1, 10)
        self.assertTrue(validate_solution(path))

        # Test with some obstacles
        self.world_descriptor[5][0] = 1
        path = self.find_path(
            self.world_descriptor, ((4, 0), (6, 0)), ((6, 0), (4, 0)), 1, 10)
        self.assertTrue(validate_solution(path))
        self.assertTrue(compute_cost(path) == 10)
Пример #2
0
 def test_op_decomp_single_robot(self):
     """Tests ODM* on simple single robot cases"""
     from mstar_test import validate_solution, compute_cost
     path = self.find_path(self.world_descriptor,
                           ((0, 0), ), ((1, 0), ), 1, 10)
     self.assertTrue(path == (((0, 0), ), ((1, 0), )))
     path = self.find_path(self.world_descriptor,
                           ((0, 0), ), ((1, 1), ), 1, 10)
     self.assertTrue(path == (((0, 0), ), ((1, 0), ), ((1, 1), )) or
                     path == (((0, 0), ), ((0, 1), ), ((1, 1), )))
     self.assertTrue(validate_solution(path))
     self.world_descriptor[1][0] = 1
     path = self.find_path(self.world_descriptor,
                           ((0, 0), ), ((2, 0), ), 1, 10)
     self.assertTrue(path == (((0, 0), ), ((0, 1), ),
                              ((1, 1), ), ((2, 1), ), ((2, 0), )))
Пример #3
0
 def test_inflated_map(self):
     """Tests on full maps"""
     from mstar_test import validate_solution, compute_cost
     if not FULL:
         self.skipTest('Skipped map test for brevity')
     dat = pickle.load(open('maps/5_40_bots_step_5.map'))
     # 281 runs in python, not c
     for i in [0, 30, 60, 103, 141, 151, 161, 163, 164, 209, 211, 212, 213,
               214, 215, 250, 260, 265, 280, 282, 283, 284, 285, 283, 284,
               285, 286, 287, 291, 293, 300, 350, 400, 450, 500, 550]:
         print i
         d = dat[i]
         path = self.find_path(d['obs_map'], d['init_pos'], d['goals'],
                               3, 10)
         py_path = py_find_path(d['obs_map'], d['init_pos'], d['goals'],
                                3, 10)
         self.assertTrue(validate_solution(path))