예제 #1
0
 def test_map_non_recursive_solutions(self):
     """Tests odrmstar on a couple of test maps, no constraints"""
     if not (FULL_TEST or EPEMSTAR_FULL):
         self.skipTest('Skipped map test for brevity')
     print '\nEPEM* long tests'
     dat = pickle.load(open('../maps/5_40_bots_step_5.map'))
     start_time = time.time()
     # Test inlfated
     for i in [0, 30, 60, 101, 131, 141, 151, 161, 200, 250, 300, 350, 400]:
         print i
         d = dat[i]
         path = od_mstar.find_path(d['obs_map'], d['init_pos'], d['goals'],
                                   inflation=10, time_limit=60,
                                   recursive=False, connect_8=True,
                                   epemstar=True)
         self.assertTrue(validate_solution(path))
         self.assertTrue(path[-1] == d['goals'])
     # Test uniflated
     print 'uninflated'
     # for i in [0, 30, 60, 101, 131, 141, 151, 161, 200, 227, 250,
     #           275, 280]
     # , 301, 350]:
     for i in [0, 30, 60, 101, 131, 141, 151, 161]:
         print i
         d = dat[i]
         path = od_mstar.find_path(d['obs_map'], d['init_pos'], d['goals'],
                                   inflation=1, time_limit=60,
                                   recursive=False, connect_8=True,
                                   epemstar=True)
         self.assertTrue(validate_solution(path))
         self.assertTrue(path[-1] == d['goals'])
     print 'time elapsed: %g' % (time.time() - start_time)
예제 #2
0
 def test_op_decomp_single_robot(self):
     """Tests ODM* on simple single robot cases"""
     path = od_mstar.find_path(self.world_descriptor, [[0, 0]], [[1, 0]])
     self.assertTrue(path == (((0, 0), ), ((1, 0), )))
     path = od_mstar.find_path(self.world_descriptor, [[0, 0]], [[1, 1]])
     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 = od_mstar.find_path(self.world_descriptor, [[0, 0]], [[2, 0]])
     self.assertTrue(path == (((0, 0), ), ((0, 1), ),
                              ((1, 1), ), ((2, 1), ), ((2, 0), )))
     # TEST 8-connected paths
     path = od_mstar.find_path(self.world_descriptor, [[0, 0]], [[1, 1]],
                               connect_8=True)
     self.assertTrue(path == (((0, 0), ), ((1, 1), )))
     path = od_mstar.find_path(self.world_descriptor, [[0, 0]], [[2, 0]],
                               connect_8=True)
     self.assertTrue(path == (((0, 0), ), ((1, 1), ), ((2, 0), )))
예제 #3
0
 def test_od_mstar_multirobot_paths(self):
     """Tests some simple multirobot cases on ODrM*"""
     path = od_mstar.find_path(self.world_descriptor,
                               [[0, 0], [1, 0]], [[1, 0], [0, 0]])
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 4)
     path = od_mstar.find_path(self.world_descriptor,
                               [[0, 0], [1, 0], [5, 5]],
                               [[1, 0], [0, 0], [6, 6]])
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 6)
     # Test a simple three robot collision along edge
     path = od_mstar.find_path(self.world_descriptor,
                               [[3, 0], [0, 0], [2, 0]],
                               [[0, 0], [3, 0], [5, 0]])
     self.assertTrue(validate_solution(path))
     # TEST 8-connected paths
     path = od_mstar.find_path(self.world_descriptor,
                               [[0, 0], [1, 0]], [[1, 0], [0, 0]],
                               connect_8=True)
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 3)
     path = od_mstar.find_path(self.world_descriptor,
                               [[0, 0], [1, 0], [5, 5]],
                               [[1, 0], [0, 0], [6, 6]], connect_8=True)
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 4)
     # Test with some obstacles
     self.world_descriptor[5][0] = 1
     path = od_mstar.find_path(self.world_descriptor,
                               [[4, 0], [6, 0]], [[6, 0], [4, 0]])
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 10)
예제 #4
0
 def test_epemstar_multirobot_paths(self):
     """Tests some simple multirobot cases on EPEM*"""
     # pdb.set_trace()
     recursive = False
     path = od_mstar.find_path(self.world_descriptor,
                               [[0, 0], [1, 0]],
                               [[1, 0], [0, 0]], recursive=recursive,
                               epemstar=True, time_limit=10)
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 4)
     path = od_mstar.find_path(self.world_descriptor,
                               [[0, 0], [1, 0], [5, 5]],
                               [[1, 0], [0, 0], [6, 6]],
                               recursive=recursive, epemstar=True,
                               time_limit=10)
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 6)
     # Test a simple three robot collision along edge
     path = od_mstar.find_path(self.world_descriptor,
                               [[3, 0], [0, 0], [2, 0]],
                               [[0, 0], [3, 0], [5, 0]],
                               recursive=recursive,
                               epemstar=True, time_limit=10)
     self.assertTrue(validate_solution(path))
     # TEST 8-connected paths
     path = od_mstar.find_path(self.world_descriptor,
                               [[0, 0], [1, 0]],
                               [[1, 0], [0, 0]], recursive=recursive,
                               connect_8=True, epemstar=True,
                               time_limit=10)
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 3)
     path = od_mstar.find_path(self.world_descriptor,
                               [[0, 0], [1, 0], [5, 5]],
                               [[1, 0], [0, 0], [6, 6]], connect_8=True,
                               recursive=recursive, epemstar=True,
                               time_limit=10)
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 4)
     # Test with some obstacles
     self.world_descriptor[5][0] = 1
     path = od_mstar.find_path(self.world_descriptor, [[4, 0], [6, 0]],
                               [[6, 0], [4, 0]], recursive=recursive,
                               epemstar=True, time_limit=10)
     self.assertTrue(validate_solution(path))
     self.assertTrue(compute_cost(path) == 10)