Discretization.h
136 throw Exception("The fraction of time spent selecting border cells must be in the range (0,1]");
158 iteration_ = 1;
200 cell->data->motions.push_back(motion);
203 }
209 cell->data->coverage = 1.0;
211 cell->data->selections = 1;
214 recentCell_ = cell;
217 ++size_;
226 scell = rng_.uniform01() < std::max(selectBorderFraction_, grid_.fracExternal()) ? grid_.topExternal() :
282 void getPlannerData(base::PlannerData &data, int tag, bool start, const Motion *lastGoalMotion) const
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
Definition: RandomNumbers.h:89
GridB< CellData *, OrderCellsByImportance > Grid
The datatype for the maintained grid datastructure.
Definition: Discretization.h:200
typename std::function< void(Motion *)> FreeMotionFn
The signature of a function that frees the memory for a motion.
Definition: Discretization.h:209
double coverage
A measure of coverage for this cell. For this implementation, this is the sum of motion lengths.
Definition: Discretization.h:202
The data held by a cell in the grid of motions.
Definition: Discretization.h:158
unsigned int selections
The number of times this cell has been selected for expansion.
Definition: Discretization.h:206
double score
A heuristic score computed based on distance to goal (if available), successes and failures at expand...
Definition: Discretization.h:211
void setBorderFraction(double bp)
Set the fraction of time for focusing on the border (between 0 and 1). This is the minimum fraction u...
Definition: Discretization.h:229
void log(const char *file, int line, LogLevel level, const char *m,...)
Root level logging function. This should not be invoked directly, but rather used via a logging macro...
Definition: Console.cpp:120
void getContent(std::vector< _T > &content) const
Get the data stored in the cells we are aware of.
Definition: Grid.h:322
int halfNormalInt(int r_min, int r_max, double focus=3.0)
Generate a random integer using a half-normal distribution. The value is within specified bounds ([r_...
Definition: RandomNumbers.cpp:257
virtual Cell * createCell(const Coord &coord, CellArray *nbh=nullptr)
Create a cell but do not add it to the grid; update neighboring cells however.
Definition: GridB.h:231
unsigned int addMotion(Motion *motion, const Coord &coord, double dist=0.0)
Add a motion to the grid containing motions. As a hint, dist specifies the distance to the goal from ...
Definition: Discretization.h:289
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique,...
Definition: PlannerData.h:238
Cell * topInternal() const
Return the cell that is at the top of the heap maintaining internal cells.
Definition: GridB.h:170
virtual void destroyCell(Cell *cell) const
Clear the memory occupied by a cell; do not call this function unless remove() was called first.
Definition: Grid.h:316
double getBorderFraction() const
Set the fraction of time for focusing on the border (between 0 and 1).
Definition: Discretization.h:238
double importance
The computed importance (based on other class members)
Definition: Discretization.h:217
void selectMotion(Motion *&smotion, Cell *&scell)
Select a motion and the cell it is part of from the grid of motions. This is where preference is give...
Definition: Discretization.h:320
typename Grid::Coord Coord
The datatype for the maintained grid coordinates.
Definition: Discretization.h:206
void update(Cell *cell)
Update the position in the heaps for a particular cell.
Definition: GridB.h:208
Cell * topExternal() const
Return the cell that is at the top of the heap maintaining external cells.
Definition: GridB.h:177
Cell * getCell(const Coord &coord) const
Get the cell at a specified coordinate.
Definition: GridN.h:187
std::vector< Motion * > motions
The set of motions contained in this grid cell.
Definition: Discretization.h:197
void setDimension(unsigned int dim)
Set the dimension of the grid to be maintained.
Definition: Discretization.h:244
unsigned int addStartVertex(const PlannerDataVertex &v)
Adds the given vertex to the graph data, and marks it as a start vertex. The vertex index is returned...
Definition: PlannerData.cpp:413
void freeMemory()
Free the memory for the motions contained in a grid.
Definition: Discretization.h:274
One-level discretization used for KPIECE.
Definition: Discretization.h:122
virtual bool addEdge(unsigned int v1, unsigned int v2, const PlannerDataEdge &edge=PlannerDataEdge(), Cost weight=Cost(1.0))
Adds a directed edge between the given vertex indexes. An optional edge structure and weight can be s...
Definition: PlannerData.cpp:432
unsigned int addGoalVertex(const PlannerDataVertex &v)
Adds the given vertex to the graph data, and marks it as a start vertex. The vertex index is returned...
Definition: PlannerData.cpp:422
Base class for a vertex in the PlannerData structure. All derived classes must implement the clone an...
Definition: PlannerData.h:122
bool operator()(const CellData *const a, const CellData *const b) const
Order function.
Definition: Discretization.h:193