1 #ifndef PMPL_GROUP_PATH_H_
2 #define PMPL_GROUP_PATH_H_
51 size_t Size() const noexcept;
54 bool Empty() const noexcept;
62 const std::vector<
VID>&
VIDs() const noexcept;
65 const std::pair<std::vector<
VID>,std::vector<
size_t>>
VIDsWaiting() const noexcept;
104 GroupPath operator+(const std::vector<
VID>& _vids) const;
136 void AssertSameMap(const
GroupPath& _p) const;
143 std::vector<
VID> m_vids;
144 std::vector<
size_t> m_waitingTimesteps;
145 size_t m_finalWaitTimeSteps{0};
147 mutable std::vector<GroupCfgType> m_cfgs;
148 mutable bool m_cfgsCached{
false};
150 mutable double m_length{0};
151 mutable bool m_lengthCached{
false};
153 mutable double m_timesteps{0};
154 mutable bool m_timestepsCached{
false};
159 template <
typename MPLibrary>
160 const std::vector<typename GroupPath::GroupCfgType>
164 return std::vector<GroupCfgType>();
167 std::vector<GroupCfgType> out = {m_roadmap->
GetVertex(m_vids.front())};
169 for(
auto it = m_vids.begin(); it + 1 < m_vids.end(); ++it) {
170 const VID source = *it,
178 auto e = m_roadmap->
GetEdge(source,target);
179 auto edge = !e.GetIntermediates().empty() ? e.GetIntermediates()
184 auto startIter = edge.begin();
186 auto endIter = edge.end();
188 out.insert(out.end(), startIter, endIter);
193 out.push_back(m_roadmap->
GetVertex(target));
199 template <
typename MPLibrary>
200 const std::vector<typename GroupPath::GroupCfgType>
204 return std::vector<GroupCfgType>();
206 if(m_waitingTimesteps.empty())
210 size_t vid = m_vids.front();
212 std::vector<GroupCfgType> out = {vertex};
216 for(
size_t i = 0; i < m_waitingTimesteps[0]; ++i) {
217 out.push_back(vertex);
221 for(
auto it = m_vids.begin(); it + 1 < m_vids.end(); ++it) {
225 auto e = m_roadmap->
GetEdge(*it,*(it+1));
226 auto edge = !e.GetIntermediates().empty() ? e.GetIntermediates()
228 out.insert(out.end(), edge.begin(), edge.end());
233 out.push_back(vertex);
234 for(
size_t i = 0; i < m_waitingTimesteps[cnt]; ++i) {
235 out.push_back(vertex);
241 auto last = out.back();
242 for(
size_t i = 0; i < m_finalWaitTimeSteps; i++) {
Definition: GenericStateGraph.h:67
STAPLGraph::vertex_descriptor VID
Definition: GenericStateGraph.h:83
bool GetEdge(const VID _source, const VID _target, EI &_ei) noexcept
Definition: GenericStateGraph.h:1145
VP & GetVertex(T &_t) noexcept
Retrieve a reference to a vertex property by descriptor or iterator.
Definition: GenericStateGraph.h:1034
Definition: GroupCfg.h:39
Definition: GroupPath.h:23
size_t TimeSteps() const
Definition: GroupPath.cpp:61
const std::vector< GroupCfgType > FullCfgsWithWait(MPLibrary *const _lib) const
GenericStateGraph< Cfg, DefaultWeight< Cfg > > RoadmapType
Definition: GroupPath.h:30
GroupRoadmap< GroupCfgType, GroupLocalPlan< RoadmapType > > GroupRoadmapType
Definition: GroupPath.h:32
GroupPath(GroupRoadmapType *const _r=nullptr)
Definition: GroupPath.cpp:9
void SetWaitTimes(std::vector< size_t > _waitTimes)
Definition: GroupPath.cpp:187
std::pair< size_t, size_t > GetEdgeAtTimestep(size_t _timestep)
Definition: GroupPath.cpp:207
const std::pair< std::vector< VID >, std::vector< size_t > > VIDsWaiting() const noexcept
Get the VIDs and timesteps waiting in the path.
std::vector< size_t > GetWaitTimes()
Get the wait times at each vertex in the path.
Definition: GroupPath.cpp:200
const std::vector< GroupCfgType > FullCfgs(MPLibrary *const _lib) const
void Clear()
Clear all data in the path.
Definition: GroupPath.cpp:168
const std::vector< GroupCfgType > & Cfgs() const
Definition: GroupPath.cpp:97
void FlushCache()
Clear cached data, but leave the VIDs.
Definition: GroupPath.cpp:177
const std::vector< VID > & VIDs() const noexcept
Get the VIDs in the path.
Definition: GroupPath.cpp:90
GroupCfg< RoadmapType > GroupCfgType
Definition: GroupPath.h:31
GroupRoadmapType * GetRoadmap() const noexcept
Get the roadmap used by this path.
Definition: GroupPath.cpp:15
size_t Size() const noexcept
Get the number of cfgs in the path.
Definition: GroupPath.cpp:22
GroupRoadmapType::VID VID
Definition: GroupPath.h:33
bool Empty() const noexcept
Check if the path is empty.
Definition: GroupPath.cpp:29
double Length() const
Get the total edge weight.
Definition: GroupPath.cpp:36
Definition: GroupRoadmap.h:25
Definition: MPLibrary.h:47
std::vector< typename RoadmapType::VP > ReconstructEdge(RoadmapType *const _roadmap, const VID _source, const VID _target, const double _posRes, const double _oriRes)
Definition: MPLibrary.cpp:410