HOG2
FocalOpenClosed.h
Go to the documentation of this file.
1 //
2 // FocalOpenClosed.h
3 // hog2 mac native demos
4 //
5 // Created by Nathan Sturtevant on 12/27/19.
6 //
7 // A focal list + open + closed list where open is a treap and focal is a heap[?]
8 // Code is work in progress
9 
10 #ifndef FocalOpenClosed_h
11 #define FocalOpenClosed_h
12 
13 namespace focalOpenClosed {
14 
20 };
21 
22 template<typename state>
24 public:
26  FocalOpenClosedData(const state &theData, double fCost, double gCost, double hCost, uint64_t parent, uint64_t openLoc, dataLocation location)
27  :data(theData), f(fCost), g(gCost), h(hCost), parentID(parent), openLocation(openLoc), where(location) { reopened = false; }
28  state data;
29  double f;
30  double g;
31  double h;
32  uint64_t parentID;
33  bool reopened;
35 };
36 
37 template<typename state, typename CmpKey, class dataStructure = FocalOpenClosedData<state> >
39 public:
42  void Reset(uint64_t maxKey=0);
43  uint64_t AddOpenNode(const state &val, uint64_t hash, double f, double g, double h, uint64_t parent=kTAStarNoNode);
44  uint64_t AddClosedNode(state &val, uint64_t hash, double f, double g, double h, uint64_t parent=kTAStarNoNode);
45  void KeyChanged(uint64_t objKey);
46  dataLocation Lookup(uint64_t hashKey, uint64_t &objKey) const;
47  inline dataStructure &Lookup(uint64_t objKey) { return elements[objKey]; }
48  inline const dataStructure &Lookat(uint64_t objKey) const { return elements[objKey]; }
49  void Remove(uint64_t hash);
50  uint64_t PeekOpen() const;
51  uint64_t PeekFocal() const;
52  uint64_t Close(uint64_t objKey);
53  void Reopen(uint64_t objKey);
54 
55  uint64_t GetOpenItem(unsigned int which);
56  size_t OpenSize() const;
57  uint64_t GetOpenItem(unsigned int which);
58  size_t FocalSize() const;
59  size_t ClosedSize() const;
60  size_t size() const;
61 private:
64 };
65 
66 }
67 
68 #endif /* FocalOpenClosed_h */
focalOpenClosed::FocalOpenClosed::Lookup
dataLocation Lookup(uint64_t hashKey, uint64_t &objKey) const
focalOpenClosed::FocalOpenClosed::FocalSize
size_t FocalSize() const
focalOpenClosed::kClosedList
@ kClosedList
Definition: FocalOpenClosed.h:17
focalOpenClosed::FocalOpenClosedData::h
double h
Definition: FocalOpenClosed.h:31
focalOpenClosed::FocalOpenClosed::PeekFocal
uint64_t PeekFocal() const
focalOpenClosed::FocalOpenClosed::open
Treap open
Definition: FocalOpenClosed.h:62
focalOpenClosed::FocalOpenClosed::GetOpenItem
uint64_t GetOpenItem(unsigned int which)
focalOpenClosed::FocalOpenClosedData::reopened
bool reopened
Definition: FocalOpenClosed.h:33
focalOpenClosed::FocalOpenClosed::Lookat
const dataStructure & Lookat(uint64_t objKey) const
Definition: FocalOpenClosed.h:48
focalOpenClosed::FocalOpenClosedData::where
dataLocation where
Definition: FocalOpenClosed.h:34
focalOpenClosed::kOpenList
@ kOpenList
Definition: FocalOpenClosed.h:16
focalOpenClosed::FocalOpenClosed::AddOpenNode
uint64_t AddOpenNode(const state &val, uint64_t hash, double f, double g, double h, uint64_t parent=kTAStarNoNode)
focalOpenClosed::kNotFound
@ kNotFound
Definition: FocalOpenClosed.h:19
focalOpenClosed::FocalOpenClosed::Reopen
void Reopen(uint64_t objKey)
focalOpenClosed::FocalOpenClosed::PeekOpen
uint64_t PeekOpen() const
focalOpenClosed::FocalOpenClosed::KeyChanged
void KeyChanged(uint64_t objKey)
focalOpenClosed::FocalOpenClosedData::parentID
uint64_t parentID
Definition: FocalOpenClosed.h:32
focalOpenClosed::FocalOpenClosed::Remove
void Remove(uint64_t hash)
focalOpenClosed::dataLocation
dataLocation
Definition: FocalOpenClosed.h:15
focalOpenClosed::FocalOpenClosedData::data
state data
Definition: FocalOpenClosed.h:28
focalOpenClosed::FocalOpenClosedData
Definition: FocalOpenClosed.h:23
kTAStarNoNode
const uint64_t kTAStarNoNode
Definition: AStarOpenClosed.h:33
focalOpenClosed::FocalOpenClosedData::g
double g
Definition: FocalOpenClosed.h:30
focalOpenClosed
Definition: FocalOpenClosed.h:13
focalOpenClosed::FocalOpenClosedData::FocalOpenClosedData
FocalOpenClosedData(const state &theData, double fCost, double gCost, double hCost, uint64_t parent, uint64_t openLoc, dataLocation location)
Definition: FocalOpenClosed.h:26
focalOpenClosed::FocalOpenClosed::FocalOpenClosed
FocalOpenClosed()
focalOpenClosed::FocalOpenClosed::focal
Heap focal
Definition: FocalOpenClosed.h:63
focalOpenClosed::FocalOpenClosed
Definition: FocalOpenClosed.h:38
focalOpenClosed::FocalOpenClosed::Lookup
dataStructure & Lookup(uint64_t objKey)
Definition: FocalOpenClosed.h:47
Treap
Definition: Treap.h:14
focalOpenClosed::FocalOpenClosedData::FocalOpenClosedData
FocalOpenClosedData()
Definition: FocalOpenClosed.h:25
focalOpenClosed::FocalOpenClosedData::f
double f
Definition: FocalOpenClosed.h:29
focalOpenClosed::FocalOpenClosed::Reset
void Reset(uint64_t maxKey=0)
focalOpenClosed::FocalOpenClosed::Close
uint64_t Close(uint64_t objKey)
Heap
A simple & efficient Heap class which uses Graph objects.
Definition: Heap.h:27
focalOpenClosed::FocalOpenClosed::~FocalOpenClosed
~FocalOpenClosed()
focalOpenClosed::FocalOpenClosed::size
size_t size() const
focalOpenClosed::FocalOpenClosed::OpenSize
size_t OpenSize() const
focalOpenClosed::kFocalList
@ kFocalList
Definition: FocalOpenClosed.h:18
focalOpenClosed::FocalOpenClosed::AddClosedNode
uint64_t AddClosedNode(state &val, uint64_t hash, double f, double g, double h, uint64_t parent=kTAStarNoNode)
focalOpenClosed::FocalOpenClosed::ClosedSize
size_t ClosedSize() const