#include <idastar.h>
Inheritance diagram for PathFind::IDAStar:
Short desciption of IDA*:
Each iteration is a depth-first search that keeps track of the cost f = g + h of each node generated. If a node is generated whose cost exceeds the threshold for that iteration, its path is cut off and the search backtracks. The cost threshold is initialized to the heuristic of the initial state and is increased in each iteration to the total cost of the lowest-cost node that was pruned during the previous iteration. The algorithm terminates when a goal state is reached whose total cost does not exceed the current threshold.
Statistics (see Search::createStatistics and Search::getStatistics):
Definition at line 43 of file idastar.h.
Public Types | |
enum | Caching { NO_CACHING, f_CACHING, F_CACHING } |
Caching strategy for f-values. More... | |
Public Member Functions | |
IDAStar (Caching caching=NO_CACHING) | |
StatisticsCollection | createStatistics () |
Create a StatisticsCollection. | |
bool | findPath (const Environment &env, int start, int target) |
Find a path. | |
const vector< int > & | getPath () const |
const StatisticsCollection & | getStatistics () const |
Get statistics of last search. | |
const vector< char > & | getVisitedNodes () const |
Get a vector with char labels for each visited node. | |
long long int | getNodesLimit () const |
void | setNodesLimit (long long int nodesLimit) |
Set nodes limit for search engine. | |
Public Attributes | |
long long int | m_nodesLimit |
Private Member Functions | |
void | addCache (int nodeId, int f, int g, int iteration) |
bool | checkCache (int nodeId, int f, int g, int iteration, int &f_min) |
Check in cache. | |
void | findPathIdaStar (int start) |
void | markVisitedNode (int nodeId, int iteration) |
bool | searchPathIdaStar (int iteration, int node, int lastNode, int depth, int g, int &f_min) |
Private Attributes | |
bool | m_abortSearch |
int | m_target |
int | m_fLimit |
Caching | m_caching |
const Environment * | m_env |
long long int | m_nodesExpanded |
long long int | m_nodesVisited |
vector< char > | m_visitedNodes |
vector< CacheNode > | m_cache |
vector< int > | m_path |
vector< vector< Environment::Successor > > | m_successorStack |
StatisticsCollection | m_statistics |
Statistics & | m_branchingFactor |
|
Caching strategy for f-values.
|
|
Definition at line 21 of file idastar.cpp. |
|
Definition at line 116 of file idastar.h. Referenced by searchPathIdaStar(). |
|
Check in cache. Check in cache if node has be visited before via a shorter path. Definition at line 28 of file idastar.cpp. References F_CACHING, m_cache, m_caching, and m_fLimit. Referenced by searchPathIdaStar(). |
|
Create a StatisticsCollection. Contains Statistics instances for all values tracked. Useful for keeping accumulated statistics by creating the collection and merging the statistics of a search as returned by getStatistics(). Implements PathFind::Search. Definition at line 54 of file idastar.cpp. References PathFind::StatisticsCollection::create(). |
|
Find a path.
Implements PathFind::Search. Definition at line 68 of file idastar.cpp. References PathFind::Statistics::add(), PathFind::StatisticsCollection::clear(), findPathIdaStar(), PathFind::StatisticsCollection::get(), PathFind::Environment::isValidNodeId(), m_abortSearch, m_cache, m_caching, m_env, m_nodesExpanded, m_nodesVisited, m_path, m_statistics, m_target, m_visitedNodes, and NO_CACHING. |
|
Definition at line 98 of file idastar.cpp. References PathFind::Statistics::add(), PathFind::StatisticsCollection::get(), PathFind::Environment::getHeuristic(), PathFind::Environment::getMaxCost(), PathFind::Environment::getMinCost(), PathFind::Environment::getNumberNodes(), m_env, m_fLimit, m_path, m_statistics, m_successorStack, m_target, and searchPathIdaStar(). Referenced by findPath(). |
|
Definition at line 48 of file search.h. References PathFind::Search::m_nodesLimit. |
|
Implements PathFind::Search. Definition at line 65 of file idastar.h. References m_path. |
|
Get statistics of last search.
Implements PathFind::Search. Definition at line 125 of file idastar.cpp. References m_statistics. |
|
Get a vector with char labels for each visited node. Space char means not visited, otherwise the char can have different values and meanings depending on the concrete search engine. Implements PathFind::Search. Definition at line 72 of file idastar.h. References m_visitedNodes. |
|
Definition at line 130 of file idastar.cpp. References PathFind::getVisitedNodeLabel(), and m_visitedNodes. Referenced by searchPathIdaStar(). |
|
|
Set nodes limit for search engine. The default is -1 and means unlimited search. The nodes limit is a hint only, the search engine may ignore it. Reimplemented in PathFind::AStar< MARKER, CLOSED >. Definition at line 71 of file search.h. References PathFind::Search::m_nodesLimit. |
|
Definition at line 90 of file idastar.h. Referenced by findPath(), and searchPathIdaStar(). |
|
Definition at line 114 of file idastar.h. Referenced by searchPathIdaStar(). |
|
Definition at line 106 of file idastar.h. Referenced by checkCache(), findPath(), and searchPathIdaStar(). |
|
Definition at line 96 of file idastar.h. Referenced by checkCache(), findPath(), and searchPathIdaStar(). |
|
Definition at line 98 of file idastar.h. Referenced by findPath(), findPathIdaStar(), and searchPathIdaStar(). |
|
Definition at line 94 of file idastar.h. Referenced by checkCache(), findPathIdaStar(), and searchPathIdaStar(). |
|
Definition at line 100 of file idastar.h. Referenced by findPath(), and searchPathIdaStar(). |
|
Definition at line 78 of file search.h. Referenced by PathFind::Search::getNodesLimit(), PathFind::Search::Search(), searchPathIdaStar(), PathFind::Search::setNodesLimit(), and PathFind::AStar< MARKER, CLOSED >::setNodesLimit(). |
|
Definition at line 102 of file idastar.h. Referenced by findPath(), and searchPathIdaStar(). |
|
Definition at line 108 of file idastar.h. Referenced by findPath(), findPathIdaStar(), getPath(), and searchPathIdaStar(). |
|
Definition at line 112 of file idastar.h. Referenced by findPath(), findPathIdaStar(), getStatistics(), and searchPathIdaStar(). |
|
Definition at line 110 of file idastar.h. Referenced by findPathIdaStar(), and searchPathIdaStar(). |
|
Definition at line 92 of file idastar.h. Referenced by findPath(), findPathIdaStar(), and searchPathIdaStar(). |
|
Definition at line 104 of file idastar.h. Referenced by findPath(), getVisitedNodes(), and markVisitedNode(). |