File FailPolicy.h#

Definition (server/inc/backup_planners/FailPolicy.h)#

Includes#

  • backup_planners/SIPP.h (File SIPP.h)

  • ctime

  • heuristics/BasicHeuristicTable.h

  • utils/States.h

  • utils/Task.h

Included By#

Classes#

Full File Listing#

class FailPolicy#
#include <FailPolicy.h>

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

~FailPolicy()#
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.

bool validate_solution()#
void print_solution() const#
inline bool is_initialized() const#
inline void set_initialized(bool initialized)#
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

bool congested() const#

Public Members

int k_robust#
int window#
int simulation_window#
bool hold_endpoints#
bool consider_task_wait = false#
double runtime#
int screen#
int seed#
mt19937 gen#
bool solution_found#
double solution_cost#
double avg_path_length#
double min_sum_of_costs#
vector<Path> solution#
ReservationTable initial_rt#
vector<Path> initial_paths#
list<tuple<int, int, int>> initial_constraints#
list<const Path*> initial_soft_path_constraints#
SingleAgentSolver &path_planner#
shared_ptr<HeuristicTableBase> heuristic_table#
const BasicGraph &G#
int num_of_agents#
int time_limit#
int n_iter_limit#

Protected Attributes

vector<vector<bool>> cat#
vector<unordered_set<pair<int, int>>> constraint_table#
ReservationTable rt#
bool _is_initialized = false#