Template Class Discretization

Nested Relationships

Nested Types

Class Documentation

template<typename Motion>
class Discretization

One-level discretization used for KPIECE.

Public Types

using Grid = GridB<CellData*, OrderCellsByImportance>

The datatype for the maintained grid datastructure.

using Cell = typename Grid::Cell

The datatype for the maintained grid cells.

using Coord = typename Grid::Coord

The datatype for the maintained grid coordinates.

using FreeMotionFn = typename std::function<void(Motion*)>

The signature of a function that frees the memory for a motion.

Public Functions

inline Discretization(FreeMotionFn freeMotion)
inline ~Discretization()
inline void setBorderFraction(double bp)

Set the fraction of time for focusing on the border (between 0 and 1). This is the minimum fraction used to select cells that are exterior (minimum because if 95% of cells are on the border, they will be selected with 95% chance, even if this fraction is set to 90%)

inline double getBorderFraction() const

Set the fraction of time for focusing on the border (between 0 and 1).

inline void setDimension(unsigned int dim)

Set the dimension of the grid to be maintained.

inline void clear()

Restore the discretization to its original form.

inline void countIteration()
inline std::size_t getMotionCount() const
inline std::size_t getCellCount() const
inline void freeMemory()

Free the memory for the motions contained in a grid.

inline 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 the state of the motion being added. The function returns the number of cells created to accommodate the new motion (0 or 1). The discretization takes ownership of the motion passed as argument, and the memory for the motion is freed by calling the function passed to the constructor.

inline 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 given to cells on the boundary of the grid.

inline bool removeMotion(Motion *motion, const Coord &coord)
inline void updateCell(Cell *cell)
inline const Grid &getGrid() const
inline void getPlannerData(base::PlannerData &data, int tag, bool start, const Motion *lastGoalMotion) const
struct CellData

The data held by a cell in the grid of motions.

Public Functions

CellData() = default
~CellData() = default

Public Members

std::vector<Motion*> motions

The set of motions contained in this grid cell.

double coverage = {0.0}

A measure of coverage for this cell. For this implementation, this is the sum of motion lengths.

unsigned int selections = {1}

The number of times this cell has been selected for expansion.

double score = {1.0}

A heuristic score computed based on distance to goal (if available), successes and failures at expanding from this cell.

unsigned int iteration = {0}

The iteration at which this cell was created.

double importance = {0.0}

The computed importance (based on other class members)

struct OrderCellsByImportance

Definintion of an operator passed to the Grid structure, to order cells by importance.

Public Functions

inline bool operator()(const CellData *const a, const CellData *const b) const

Order function.