def get_next_optimal_state(self):
     from MAPFSolver.Utilities.AStar import AStar
     from MAPFSolver.Utilities.SolverSettings import SolverSettings
     solver = AStar(SolverSettings())
     path = solver.find_path(self._map, self._position, self._goal)
     next_pos = path[1]
     return SingleAgentState(self._map,
                             self._goal,
                             next_pos,
                             self._solver_settings,
                             parent=self)
 def get_next_optimal_state(self):
     """
     Compute the next optimal state following the optimal policy.
     :return: the next state following the optimal policy
     """
     from MAPFSolver.Utilities.AStar import AStar
     from MAPFSolver.Utilities.SolverSettings import SolverSettings
     solver = AStar(SolverSettings())
     path = solver.find_path(self._map, self._position, self._goal)
     next_pos = path[1]
     return SingleAgentState(self._map,
                             self._goal,
                             next_pos,
                             self._solver_settings,
                             parent=self)
示例#3
0
 def compute_optimal_costs_vector(self):
     """
     Returns the the optimal costs vector. It will have all the optimal costs for each agent.
     """
     path_costs_vector = []
     solver = AStar(self._solver_settings)
     for agent in self._problem_instance.get_agents():
         path = solver.find_path(self._problem_instance.get_map(),
                                 agent.get_start(), agent.get_goal())
         if self._solver_settings.stay_at_goal():
             cost = len(path) - 1
         else:
             cost = len(
                 path) - self._solver_settings.get_goal_occupation_time()
         path_costs_vector.append(cost)
     return path_costs_vector