45 #ifndef __MIN_HEAP_H__
46 #define __MIN_HEAP_H__
49 #include "sys/types.h"
77 AStarMinHeap(
unsigned int * heap,
float * data,
bool * state,
unsigned int * path,
size_t N );
98 void push(
unsigned int x );
106 inline void g(
unsigned int node,
float value ) {
_g[ node ] = value; }
114 inline float g(
unsigned int node )
const {
return _g[ node ]; }
122 inline void h(
unsigned int node,
float value ) {
_h[ node ] = value; }
130 inline float h(
unsigned int node )
const {
return _h[ node ]; }
138 inline void f(
unsigned int node,
float value ) {
if (
_inHeap[ node ] )
changeF( node, value );
else _f[ node ] = value; }
146 inline float f(
unsigned int node )
const {
return _f[ node ]; }
154 void changeF(
unsigned int node,
float value);
258 #endif // __MIN_HEAP_H__
bool * _inHeap
An array of booleans reporting if the given node is in the heap. The memory is supplied upon construc...
Definition: MinHeap.h:236
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
void f(unsigned int node, float value)
Set the f-value for the given node.
Definition: MinHeap.h:138
bool * _visited
An array of booleans reporting if the given node has been visited. The memory is supplied upon constr...
Definition: MinHeap.h:242
float _minKey
The VALUE of the minimum keyed heap member.
Definition: MinHeap.h:199
float g(unsigned int node) const
Retrieve the g-value for the given node.
Definition: MinHeap.h:114
unsigned int getReachedFrom(unsigned int dst) const
Report the node from which this node was reached.
Definition: MinHeap.h:186
unsigned int * _cameFrom
An array of node indices which indicate how a node was reached. The memory is supplied upon construct...
Definition: MinHeap.h:254
An implementation of a min heap for A* algorithm. The heap needs to be able to restructure itself bec...
Definition: MinHeap.h:62
float f(unsigned int node) const
Retrieve the f-value for the given node.
Definition: MinHeap.h:146
void h(unsigned int node, float value)
Set the h-value for the given node.
Definition: MinHeap.h:122
AStarMinHeap(unsigned int *heap, float *data, bool *state, unsigned int *path, size_t N)
Constructor.
Definition: MinHeap.cpp:51
float * _h
An array of h-values for each node in the navigation mesh. This is a value used in the A* algorithm...
Definition: MinHeap.h:230
bool isInHeap(unsigned int node) const
Reports if the node is currently in the heap.
Definition: MinHeap.h:170
bool isVisited(unsigned int node) const
Reports if the node has been visited.
Definition: MinHeap.h:162
void initialize(size_t N)
Resets the heap and all data.
Definition: MinHeap.cpp:64
void g(unsigned int node, float value)
Set the g-value for the given node.
Definition: MinHeap.h:106
float h(unsigned int node) const
Retrieve the h-value for the given node.
Definition: MinHeap.h:130
float * _g
An array of g-values for each node in the navigation mesh. This is a value used in the A* algorithm...
Definition: MinHeap.h:223
unsigned int _minIdx
The location of the minimum keyed heap member.
Definition: MinHeap.h:204
float * _f
An array of f-values for each node in the navigation mesh. This is a value used in the A* algorithm...
Definition: MinHeap.h:216
unsigned int _nextFree
The location of the next free slot on the heap.
Definition: MinHeap.h:209
unsigned int pop()
Extract the minimum keyed value.
Definition: MinHeap.cpp:78
bool empty() const
Reports if the heap is empty.
Definition: MinHeap.h:84
void setReachedFrom(unsigned int dst, unsigned int src)
Sets the node from which this node was reached.
Definition: MinHeap.h:178
void changeF(unsigned int node, float value)
Change the f-value for the given node in the heap.
Definition: MinHeap.cpp:114
unsigned int * _heap
An array of node indices of the nodes in the heap. The memory is supplied upon construction.
Definition: MinHeap.h:248
void push(unsigned int x)
Insert a new value into the heap.
Definition: MinHeap.cpp:102