Class FailPolicy#

Inheritance Relationships#

Derived Types#

Class Documentation#

class FailPolicy#

The base class for all fail policies in LSMART.

This class defines the interface and common functionality for fail policies used in the LSMART framework. Fail policies are responsible for handling situations where the main MAPF solver fails to find a solution within the given constraints. To implement a new fail policy, inherit from this class and implement the pure virtual methods.

Subclassed by GuidedPIBT, LRAStar, PIBT

Public Functions

FailPolicy(const BasicGraph &G, SingleAgentSolver &path_planner, shared_ptr<HeuristicTableBase> heuristic_table, const boost::program_options::variables_map vm)#

Constructor for the FailPolicy class.

Parameters:
  • G – Reference to the BasicGraph representing the map

  • path_planner – Reference to the SingleAgentSolver used for single agent path planning

  • heuristic_table – Shared pointer to the HeuristicTableBase for heuristic calculations

  • vm – Boost program options variable map for configuration

virtual bool run(const vector<State> &starts, const vector<vector<Task>> &goal_locations, const vector<Path> &guide_paths = vector<Path>(), int time_limit = 60, const vector<int> &waited_time = vector<int>()) = 0#

Given a MAPF instance, solve it using the fail policy.

Parameters:
  • starts – Vector of start states for each agent

  • goal_locations – Vector of goal locations for each agent

  • guide_paths – Optional vector of guide paths for each agent. If the MAPF solver fails, the guide paths are usually the partial solution returned by the MAPF solver.

  • time_limit – Time limit (in seconds) for the fail policy to find a solution

  • waited_time – Vector of timesteps each agent has already waited. Used if considering tasking wait time.

Returns:

True if a solution is found, false otherwise

virtual void save_results(const std::string &fileName, const std::string &instanceName) const = 0#

Save the results of the fail policy to a file.

This function can be left unimplemented if not needed.

Parameters:
  • fileName – Name of the file to save the results to

  • instanceName – Name of the MAPF instance

virtual void clear() = 0#

Clear any internal data structures used by the fail policy.

virtual string get_name() const = 0#

Get the name of the fail policy.

Returns:

Name of the fail policy as a string.

vector<vector<tuple<int, int, double, int>>> convert_path_to_smart(const vector<vector<Task>> &goal_locations)#

Convert the solution of the fail policy from the internal representation (vector<Path>) to SMART path format (vector<vector<tuple<int, int, double, int>>>).

Parameters:

goal_locations – The goal locations for each agent

Returns:

The converted SMART path format