HOG2
|
#include <PDBHeuristic.h>
Public Member Functions | |
PDBHeuristic (abstractEnvironment *e) | |
virtual | ~PDBHeuristic () |
void | SetGoal (const state &goal) |
void | SetGoal (const std::vector< state > &goals) |
virtual double | HCost (const state &a, const state &b) const |
virtual uint64_t | GetPDBSize () const =0 |
virtual uint64_t | GetPDBHash (const abstractState &s, int threadID=0) const =0 |
virtual uint64_t | GetAbstractHash (const state &s, int threadID=0) const =0 |
virtual void | GetStateFromPDBHash (uint64_t hash, abstractState &s, int threadID=0) const =0 |
virtual state | GetStateFromAbstractState (abstractState &s) const =0 |
virtual bool | Load (const char *prefix)=0 |
virtual void | Save (const char *prefix)=0 |
virtual bool | Load (FILE *f) |
virtual void | Save (FILE *f) |
virtual std::string | GetFileName (const char *prefix)=0 |
void | ShuffleValues () |
This methods randomizes the entries in the PDB. More... | |
void | BuildPDB (const state &goal) |
void | BuildPDB (const state &goal, int numThreads) |
void | BuildPDBForward (const state &goal, int numThreads, bool useCoarseOpen=true, bool verbose=false) |
void | BuildPDBForward (const std::vector< state > &goal, int numThreads, bool useCoarseOpen=true, bool verbose=false) |
void | BuildPDBBackward (const state &goal, int numThreads) |
void | BuildPDBForwardBackward (const state &goal, int numThreads) |
void | BuildAdditivePDB (const state &goal, int numThreads, bool useCourseOpen=true) |
void | DivCompress (int factor, bool print_histogram) |
void | ModCompress (int factor, bool print_histogram) |
void | ModCompress (uint64_t newEntries, bool print_histogram) |
void | ZeroLowValues (int limit) |
void | DeltaCompress (Heuristic< state > *h, state goal, bool print_histogram) |
void | FractionalDivCompress (uint64_t count, bool print_histogram) |
void | FractionalModCompress (uint64_t factor, bool print_histogram) |
void | ValueCompress (int maxValue, bool print_histogram) |
void | ValueCompress (std::vector< int > cutoffs, bool print_histogram) |
void | ValueRangeCompress (int numBits, bool print_histogram) |
void | CustomValueRangeCompress (std::vector< uint64_t > dist, int numBits, bool print_histogram) |
void | ValueRangeCompress (PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 5 > *, bool print_histogram) |
void | ValueRangeCompress (PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 4 > *, bool print_histogram) |
void | ValueRangeCompress (PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 3 > *, bool print_histogram) |
void | ValueRangeCompress (PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 2 > *, bool print_histogram) |
void | ValueRangeCompress (PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 1 > *, bool print_histogram) |
double | PrintHistogram () |
double | GetAverageValue () |
void | GetHistogram (std::vector< uint64_t > &histogram) |
Public Member Functions inherited from Heuristic< abstractState > | |
Heuristic () | |
virtual | ~Heuristic () |
virtual double | HCost (const abstractState &a, const abstractState &b) const |
Public Attributes | |
NBitArray< pdbBits > | PDB |
int | vrcValues [1<< pdbBits] |
PDBLookupType | type |
uint64_t | compressionValue |
abstractEnvironment * | env |
std::vector< abstractState > | goalState |
Public Attributes inherited from Heuristic< abstractState > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Private Member Functions | |
void | AdditiveForwardThreadWorker (int threadNum, int depth, NBitArray< pdbBits > &DB, std::vector< bool > &coarse, SharedQueue< std::pair< uint64_t, uint64_t > > *work, SharedQueue< uint64_t > *results, std::mutex *lock) |
void | GetAdditiveNeighbors (const abstractState &s, std::vector< std::pair< abstractState, int >> &neighbors) |
void | ForwardThreadWorker (int threadNum, int depth, NBitArray< pdbBits > &DB, std::vector< bool > &coarse, SharedQueue< std::pair< uint64_t, uint64_t > > *work, SharedQueue< uint64_t > *results, std::mutex *lock) |
void | BackwardThreadWorker (int threadNum, int depth, NBitArray< pdbBits > &DB, std::vector< bool > &coarse, SharedQueue< std::pair< uint64_t, uint64_t > > *work, SharedQueue< uint64_t > *results, std::mutex *lock) |
void | ForwardBackwardThreadWorker (int threadNum, int depth, bool forward, NBitArray< pdbBits > &DB, std::vector< bool > &coarseOpen, std::vector< bool > &coarseClosed, SharedQueue< std::pair< uint64_t, uint64_t > > *work, SharedQueue< uint64_t > *results, std::mutex *lock) |
Private Attributes | |
bool | goalSet |
Definition at line 39 of file PDBHeuristic.h.
|
inline |
Definition at line 41 of file PDBHeuristic.h.
|
inlinevirtual |
Definition at line 43 of file PDBHeuristic.h.
|
private |
Definition at line 975 of file PDBHeuristic.h.
|
private |
Definition at line 656 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::BuildAdditivePDB | ( | const state & | goal, |
int | numThreads, | ||
bool | useCourseOpen = true |
||
) |
Definition at line 868 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::BuildPDB | ( | const state & | goal | ) |
Definition at line 193 of file PDBHeuristic.h.
|
inline |
Definition at line 82 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::BuildPDBBackward | ( | const state & | goal, |
int | numThreads | ||
) |
Definition at line 379 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::BuildPDBForward | ( | const state & | goal, |
int | numThreads, | ||
bool | useCoarseOpen = true , |
||
bool | verbose = false |
||
) |
Definition at line 259 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::BuildPDBForward | ( | const std::vector< state > & | goal, |
int | numThreads, | ||
bool | useCoarseOpen = true , |
||
bool | verbose = false |
||
) |
Definition at line 267 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::BuildPDBForwardBackward | ( | const state & | goal, |
int | numThreads | ||
) |
Definition at line 466 of file PDBHeuristic.h.
Referenced by PDBHeuristic< TOHState< patternDisks >, TOHMove, TOH< patternDisks >, TOHState< totalDisks > >::BuildPDB().
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::CustomValueRangeCompress | ( | std::vector< uint64_t > | dist, |
int | numBits, | ||
bool | print_histogram | ||
) |
Definition at line 1179 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::DeltaCompress | ( | Heuristic< state > * | h, |
state | goal, | ||
bool | print_histogram | ||
) |
Definition at line 1117 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::DivCompress | ( | int | factor, |
bool | print_histogram | ||
) |
Definition at line 1075 of file PDBHeuristic.h.
|
private |
Definition at line 734 of file PDBHeuristic.h.
|
private |
Definition at line 582 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::FractionalDivCompress | ( | uint64_t | count, |
bool | print_histogram | ||
) |
Definition at line 1132 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::FractionalModCompress | ( | uint64_t | factor, |
bool | print_histogram | ||
) |
Definition at line 1138 of file PDBHeuristic.h.
|
pure virtual |
Implemented in TOHPDB< patternDisks, totalDisks, offset >, PermutationPDB< state, action, environment, 8 >, PermutationPDB< state, action, environment, bits >, MR1PermutationPDB< state, action, environment, bits >, TreePermutationPDB< state, action, environment, bits >, LexPermutationPDB< state, action, environment, bits >, RubikPDB, RubikCornerPDB, RubikEdgeOrientationPDB, RubikEdgePDB, and RCPDB.
Referenced by PDBHeuristic< TOHState< patternDisks >, TOHMove, TOH< patternDisks >, TOHState< totalDisks > >::SetGoal().
|
private |
double PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::GetAverageValue |
Definition at line 1545 of file PDBHeuristic.h.
|
pure virtual |
Implemented in TOHPDB< patternDisks, totalDisks, offset >, RCPDB, RubikEdgeOrientationPDB, RubikPDB, RubikEdgePDB, RubikCornerPDB, MR1PermutationPDB< state, action, environment, bits >, PermutationPDB< state, action, environment, bits >, PermutationPDB< state, action, environment, 8 >, TreePermutationPDB< state, action, environment, bits >, and LexPermutationPDB< state, action, environment, bits >.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::GetHistogram | ( | std::vector< uint64_t > & | histogram | ) |
Definition at line 1491 of file PDBHeuristic.h.
|
pure virtual |
Implemented in TOHPDB< patternDisks, totalDisks, offset >, PermutationPDB< state, action, environment, 8 >, PermutationPDB< state, action, environment, bits >, MR1PermutationPDB< state, action, environment, bits >, TreePermutationPDB< state, action, environment, bits >, LexPermutationPDB< state, action, environment, bits >, RubikPDB, RubikCornerPDB, RubikEdgeOrientationPDB, RubikEdgePDB, and RCPDB.
|
pure virtual |
Implemented in PermutationPDB< state, action, environment, 8 >.
|
pure virtual |
Implemented in TOHPDB< patternDisks, totalDisks, offset >, PermutationPDB< state, action, environment, 8 >, PermutationPDB< state, action, environment, bits >, MR1PermutationPDB< state, action, environment, bits >, LexPermutationPDB< state, action, environment, bits >, RubikPDB, RubikCornerPDB, RubikEdgeOrientationPDB, RubikEdgePDB, and RCPDB.
|
pure virtual |
Implemented in TOHPDB< patternDisks, totalDisks, offset >, PermutationPDB< state, action, environment, 8 >, PermutationPDB< state, action, environment, bits >, MR1PermutationPDB< state, action, environment, bits >, TreePermutationPDB< state, action, environment, bits >, LexPermutationPDB< state, action, environment, bits >, RubikPDB, RubikCornerPDB, RubikEdgeOrientationPDB, RubikEdgePDB, and RCPDB.
Referenced by PDBHeuristic< TOHState< patternDisks >, TOHMove, TOH< patternDisks >, TOHState< totalDisks > >::SetGoal().
|
virtual |
Definition at line 163 of file PDBHeuristic.h.
Referenced by RubikDualPDB::HCost(), and RubikArbitraryGoalPDB::HCost().
|
pure virtual |
|
virtual |
Reimplemented in RCPDB, RubikEdgeOrientationPDB, RubikPDB, RubikEdgePDB, RubikCornerPDB, PermutationPDB< state, action, environment, bits >, and PermutationPDB< state, action, environment, 8 >.
Definition at line 1472 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ModCompress | ( | int | factor, |
bool | print_histogram | ||
) |
Definition at line 1094 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ModCompress | ( | uint64_t | newEntries, |
bool | print_histogram | ||
) |
Definition at line 1100 of file PDBHeuristic.h.
double PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::PrintHistogram |
Definition at line 1505 of file PDBHeuristic.h.
Referenced by PDBHeuristic< TOHState< patternDisks >, TOHMove, TOH< patternDisks >, TOHState< totalDisks > >::ValueRangeCompress().
|
pure virtual |
Implemented in TOHPDB< patternDisks, totalDisks, offset >, RCPDB, RubikEdgeOrientationPDB, RubikPDB, RubikEdgePDB, RubikCornerPDB, PermutationPDB< state, action, environment, bits >, and PermutationPDB< state, action, environment, 8 >.
Referenced by PermutationPDB< state, action, environment, 8 >::Save(), RubikCornerPDB::Save(), RubikEdgePDB::Save(), RubikPDB::Save(), and RubikEdgeOrientationPDB::Save().
|
virtual |
Reimplemented in RCPDB, RubikEdgeOrientationPDB, RubikPDB, RubikEdgePDB, RubikCornerPDB, PermutationPDB< state, action, environment, bits >, and PermutationPDB< state, action, environment, 8 >.
Definition at line 1483 of file PDBHeuristic.h.
|
inline |
Definition at line 45 of file PDBHeuristic.h.
|
inline |
Definition at line 52 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ShuffleValues |
This methods randomizes the entries in the PDB.
Only useful for testing purposes. (eg to test structure in compression)
Definition at line 1556 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ValueCompress | ( | int | maxValue, |
bool | print_histogram | ||
) |
Definition at line 1144 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ValueCompress | ( | std::vector< int > | cutoffs, |
bool | print_histogram | ||
) |
Definition at line 1150 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ValueRangeCompress | ( | int | numBits, |
bool | print_histogram | ||
) |
Definition at line 1209 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ValueRangeCompress | ( | PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 1 > * | newPDB, |
bool | print_histogram | ||
) |
Definition at line 1425 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ValueRangeCompress | ( | PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 2 > * | newPDB, |
bool | print_histogram | ||
) |
Definition at line 1379 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ValueRangeCompress | ( | PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 3 > * | newPDB, |
bool | print_histogram | ||
) |
Definition at line 1333 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ValueRangeCompress | ( | PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 4 > * | newPDB, |
bool | print_histogram | ||
) |
Definition at line 1287 of file PDBHeuristic.h.
void PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::ValueRangeCompress | ( | PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, 5 > * | newPDB, |
bool | print_histogram | ||
) |
Definition at line 1241 of file PDBHeuristic.h.
|
inline |
Definition at line 94 of file PDBHeuristic.h.
uint64_t PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::compressionValue |
Definition at line 126 of file PDBHeuristic.h.
Referenced by PDBHeuristic< TOHState< patternDisks >, TOHMove, TOH< patternDisks >, TOHState< totalDisks > >::ValueRangeCompress().
abstractEnvironment* PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::env |
Definition at line 128 of file PDBHeuristic.h.
|
private |
std::vector<abstractState> PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::goalState |
Definition at line 129 of file PDBHeuristic.h.
Referenced by PDBHeuristic< TOHState< patternDisks >, TOHMove, TOH< patternDisks >, TOHState< totalDisks > >::SetGoal().
NBitArray<pdbBits> PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::PDB |
PDBLookupType PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::type |
Definition at line 125 of file PDBHeuristic.h.
Referenced by PDBHeuristic< TOHState< patternDisks >, TOHMove, TOH< patternDisks >, TOHState< totalDisks > >::ValueRangeCompress().
int PDBHeuristic< abstractState, abstractAction, abstractEnvironment, state, pdbBits >::vrcValues[1<< pdbBits] |
Definition at line 124 of file PDBHeuristic.h.
Referenced by PDBHeuristic< TOHState< patternDisks >, TOHMove, TOH< patternDisks >, TOHState< totalDisks > >::ValueRangeCompress().