Parasol Planning Library (PPL)
CBSQuery.h
Go to the documentation of this file.
1 #ifndef PPL_CBS_QUERY_H_
2 #define PPL_CBS_QUERY_H_
3 
4 #include "MapEvaluatorMethod.h"
5 #include "SIPPMethod.h"
6 #include "Utilities/CBS.h"
7 
18 class CBSQuery : public MapEvaluatorMethod {
19 
20  public:
21 
24 
26  typedef typename RoadmapType::VID VID;
27  typedef typename RoadmapType::EdgeID EdgeID;
28 
30 
31  private:
32 
35 
36  // Edge <Source, Target>, Time Interval <Start, End>
37  typedef std::pair<std::pair<size_t,size_t>,Range<size_t>> Constraint;
39 
40  typedef std::map<size_t,std::vector<Range<size_t>>> VertexIntervals;
41  typedef std::map<std::pair<size_t,size_t>,std::vector<Range<size_t>>> EdgeIntervals;
42 
44 
45  public:
46 
49 
50  CBSQuery();
51 
52  CBSQuery(XMLNode& _node);
53 
54  virtual ~CBSQuery() = default;
55 
59 
60  virtual void Initialize() override;
61 
65 
66  virtual bool operator()() override;
67 
69 
70  protected:
71 
74 
79  Path* SolveIndividualTask(Robot* const _robot, Node& _node);
80 
85  std::vector<std::pair<Robot*,Constraint>> ValidationFunction(Node& _node);
86 
93  std::vector<Node> SplitNodeFunction(Node& _node,
94  std::vector<std::pair<Robot*, Constraint>> _constraints,
97 
101  double CostFunction(Node& _node);
102 
106 
110  void ComputeIntervals(Robot* _robot, const Node& _node);
111 
115  std::vector<Range<size_t>> ConstructSafeIntervals(std::vector<Range<size_t>>& _unsafeIntervals);
116 
121  bool OverlappingIntervals(Range<size_t> _interval1, Range<size_t> _interval2);
122 
128 
132 
133  std::vector<Robot*> m_robots;
134 
135  std::string m_queryLabel;
136  std::string m_vcLabel;
137  std::string m_costLabel = "SOC";
138 
139  size_t m_nodeLimit{std::numeric_limits<size_t>::max()};
140 
141  std::unordered_map<Robot*, MPTask*> m_taskMap;
142 
143  VertexIntervals m_vertexIntervals;
144  EdgeIntervals m_edgeIntervals;
145 
147 
148 };
149 
150 #endif
std::function< bool(CBSNode< IndividualTask, ConstraintType, IndividualSolution > &_node, IndividualTask *_task)> CBSLowLevelPlanner
Definition: CBS.h:108
std::function< double(CBSNode< IndividualTask, ConstraintType, IndividualSolution > &_node)> CBSCostFunction
Definition: CBS.h:117
Definition: CBSQuery.h:18
MPBaseObject::RoadmapType RoadmapType
Definition: CBSQuery.h:25
Path * SolveIndividualTask(Robot *const _robot, Node &_node)
Definition: CBSQuery.cpp:125
std::string m_vcLabel
Validity checker for conflict detection.
Definition: CBSQuery.h:136
CBSQuery()
Definition: CBSQuery.cpp:14
std::unordered_map< Robot *, MPTask * > m_taskMap
The task for each robot.
Definition: CBSQuery.h:141
std::string m_costLabel
The label of the cost function.
Definition: CBSQuery.h:137
Range< double > MergeIntervals(Range< double > _interval1, Range< double > _interval2)
Definition: CBSQuery.cpp:516
std::vector< Node > SplitNodeFunction(Node &_node, std::vector< std::pair< Robot *, Constraint >> _constraints, CBSLowLevelPlanner< Robot, Constraint, Path > &_lowlevel, CBSCostFunction< Robot, Constraint, Path > &_cost)
Definition: CBSQuery.cpp:449
std::vector< std::pair< Robot *, Constraint > > ValidationFunction(Node &_node)
Definition: CBSQuery.cpp:314
bool OverlappingIntervals(Range< size_t > _interval1, Range< size_t > _interval2)
Definition: CBSQuery.cpp:503
VertexIntervals m_vertexIntervals
The current set of safe vertex intervals.
Definition: CBSQuery.h:143
RoadmapType::VID VID
Definition: CBSQuery.h:26
EdgeIntervals m_edgeIntervals
The current set of safe edge intervals.
Definition: CBSQuery.h:144
virtual ~CBSQuery()=default
size_t m_nodeLimit
The maximum number of nodes.
Definition: CBSQuery.h:139
double CostFunction(Node &_node)
Definition: CBSQuery.cpp:481
virtual void Initialize() override
Definition: CBSQuery.cpp:39
std::string m_queryLabel
Query method for making individual plans.
Definition: CBSQuery.h:135
std::vector< Range< size_t > > ConstructSafeIntervals(std::vector< Range< size_t >> &_unsafeIntervals)
Definition: CBSQuery.cpp:218
std::vector< Robot * > m_robots
The robots in the group.
Definition: CBSQuery.h:133
virtual bool operator()() override
Definition: CBSQuery.cpp:63
void ComputeIntervals(Robot *_robot, const Node &_node)
Definition: CBSQuery.cpp:180
RoadmapType::EdgeID EdgeID
Definition: CBSQuery.h:27
Definition: Constraint.h:23
Definition: GenericStateGraph.h:67
STAPLGraph::vertex_descriptor VID
Definition: GenericStateGraph.h:83
EID::edge_id_type EdgeID
Definition: GenericStateGraph.h:85
Definition: MapEvaluatorMethod.h:16
Definition: Path.h:23
Definition: Robot.h:31
Definition: XMLNode.h:27
Definition: CBS.h:11