9 #ifndef CASTARALGORITHM_H    10 #define CASTARALGORITHM_H    13 #define _USE_MATH_DEFINES // (For VS to define M_PI, etc. in cmath)    62                         virtual double getCost(
const T &sol)=0;
    75                         int getOptimalSolution(
const T &initialSol,T &finalSol,
double upperLevel=HUGE_VAL,
double maxComputationTime=HUGE_VAL)   {
    80                                 std::multimap<double,T> partialSols;
    81                                 partialSols.insert(std::pair<double,T>(
getTotalCost(initialSol),initialSol));
    83                                 double currentOptimal=upperLevel;
    85                                 std::vector<T> children;
    87                                 while (!partialSols.empty())    {
    89                                         if (time.
Tac()>=maxComputationTime) 
return found?2:0;
    91                                         double tempCost=it->first;
    93                                         if (tempCost>=currentOptimal) 
return found?1:0;
    95                                         partialSols.erase(it);
    98                                                 currentOptimal=tempCost;
   106                                                 bool alreadyPresent=
false;
   113                                                 if (!alreadyPresent) partialSols.insert(std::pair<double,T>(
getTotalCost(*it2),*it2));
 
virtual bool isSolutionEnded(const T &sol)=0
Client code must implement this method. 
 
const Scalar * const_iterator
 
void Tic()
Starts the stopwatch. 
 
double getTotalCost(const T &sol)
Calculates the total cost (known+estimated) of a solution. 
 
virtual void generateChildren(const T &sol, std::vector< T > &sols)=0
Client code must implement this method. 
 
This class implements a high-performance stopwatch. 
 
virtual bool isSolutionValid(const T &sol)=0
Client code must implement this method. 
 
This class is intended to efficiently solve graph-search problems using heuristics to determine the b...
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
int getOptimalSolution(const T &initialSol, T &finalSol, double upperLevel=HUGE_VAL, double maxComputationTime=HUGE_VAL)
Finds the optimal solution for a problem, using the A* algorithm. 
 
virtual double getCost(const T &sol)=0
Client code must implement this method. 
 
double Tac()
Stops the stopwatch. 
 
virtual double getHeuristic(const T &sol)=0
Client code must implement this method.