27 #ifndef BATCHING_POMP_BATCHING_MANAGER_HPP_ 28 #define BATCHING_POMP_BATCHING_MANAGER_HPP_ 31 #include <ompl/base/StateSpace.h> 32 #include <ompl/datastructures/NearestNeighbors.h> 33 #include <boost/graph/adjacency_list.hpp> 34 #include "batching_pomp/util/RoadmapFromFile.hpp" 50 template<
class Graph,
class VStateMap,
class StateCon,
class EDistance>
54 typedef boost::graph_traits<Graph> GraphTypes;
55 typedef typename GraphTypes::vertex_iterator VertexIter;
56 typedef typename GraphTypes::vertex_descriptor Vertex;
67 std::string _roadmapFileName,
69 Graph& _currentRoadmap)
76 auto file_roadmap_ptr = std::make_shared<
78 (_space,_roadmapFileName);
79 file_roadmap_ptr->generateVertices(
mFullRoadmap,_stateMap);
92 EDistance _distanceMap,
93 std::string _roadmapFileName,
95 Graph& _currentRoadmap)
102 auto file_roadmap_ptr = std::make_shared<
104 (_space,_roadmapFileName);
105 file_roadmap_ptr->generateVertices(
mFullRoadmap,_stateMap);
106 file_roadmap_ptr->generateEdges(
mFullRoadmap,_stateMap,_distanceMap);
114 unsigned int getNumBatches()
const 119 unsigned int getNumVertices()
const 124 bool isExhausted()
const 129 double getCurrentRadius()
const 134 const ompl::base::State* getVertexState(
const Vertex& v)
const 144 void pruneVertices(
const std::function<
bool(
const ompl::base::State*)>& _pruneFunction,
145 ompl::NearestNeighbors<Vertex>& _vertexNN)
147 VertexIter vi,vi_end;
148 std::vector<Vertex> verticesToRemove;
152 for(boost::tie(vi,vi_end) = vertices(
mCurrentRoadmap); vi!=vi_end; ++vi)
155 verticesToRemove[vRemoved++] = *vi;
160 for(
size_t i=0; i<vRemoved; i++)
162 _vertexNN.remove(verticesToRemove[i]);
176 virtual void nextBatch(
const std::function<
bool(
const ompl::base::State*)>& _pruneFunction,
177 ompl::NearestNeighbors<Vertex>& _vertexNN) = 0;
205 # endif //BATCHING_POMP_BATCHING_MANAGER_HPP_ Abstract class that represents the batching strategy used for the planning algorithm.
Definition: BatchingManager.hpp:51
virtual void updateWithNewSolutionCost(double _newSolnCost)=0
bool mExhausted
The flag that maintains whether the complete roadmap has been fully searched or not.
Definition: BatchingManager.hpp:195
Reads a roadmap encoded as a .graphml file and creates the corresponding Boost Graph.
Definition: RoadmapFromFile.hpp:107
Graph & mCurrentRoadmap
The roadmap currently being searched by the planner.
Definition: BatchingManager.hpp:186
Definition: BatchingManager.hpp:36
void pruneVertices(const std::function< bool(const ompl::base::State *)> &_pruneFunction, ompl::NearestNeighbors< Vertex > &_vertexNN)
Definition: BatchingManager.hpp:144
unsigned int mNumVertices
The number of vertices in the entire roadmap.
Definition: BatchingManager.hpp:192
BatchingManager(const ompl::base::StateSpacePtr _space, VStateMap _stateMap, EDistance _distanceMap, std::string _roadmapFileName, Graph &_fullRoadmap, Graph &_currentRoadmap)
Definition: BatchingManager.hpp:90
unsigned int mNumBatches
The number of batches added till now.
Definition: BatchingManager.hpp:189
virtual void nextBatch(const std::function< bool(const ompl::base::State *)> &_pruneFunction, ompl::NearestNeighbors< Vertex > &_vertexNN)=0
Graph & mFullRoadmap
The entire roadmap that will be used for planning.
Definition: BatchingManager.hpp:183
BatchingManager(const ompl::base::StateSpacePtr _space, VStateMap _stateMap, std::string _roadmapFileName, Graph &_fullRoadmap, Graph &_currentRoadmap)
Definition: BatchingManager.hpp:65
double mCurrRadius
The radius of connectivity for the current batch.
Definition: BatchingManager.hpp:198