9 #ifndef CASTARALGORITHM_H    10 #define CASTARALGORITHM_H    73     virtual double getCost(
const T& sol) = 0;
    93         const T& initialSol, T& finalSol, 
double upperLevel = HUGE_VAL,
    94         double maxComputationTime = HUGE_VAL)
   101         std::multimap<double, T> partialSols;
   103             std::pair<double, T>(
getTotalCost(initialSol), initialSol));
   106         double currentOptimal = upperLevel;
   108         std::vector<T> children;
   111         while (!partialSols.empty())
   114             if (time.
Tac() >= maxComputationTime) 
return found ? 2 : 0;
   117             double tempCost = it->first;
   121             if (tempCost >= currentOptimal) 
return found ? 1 : 0;
   122             T tempSol = it->second;
   123             partialSols.erase(it);
   129                 currentOptimal = tempCost;
   139                  it2 != children.end(); ++it2)
   142                     bool alreadyPresent = 
false;
   147                         range = partialSols.equal_range(cost);
   150                          it3 != 
range.second; ++it3)
   151                         if (it3->second == *it2)
   153                             alreadyPresent = 
true;
   162         return found ? 1 : 0;
 double Tac() noexcept
Stops the stopwatch. 
 
Abstract graph and tree data structures, plus generic graph algorithms. 
 
virtual bool isSolutionEnded(const T &sol)=0
Client code must implement this method. 
 
A high-performance stopwatch, with typical resolution of nanoseconds. 
 
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. 
 
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...
 
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. 
 
virtual double getHeuristic(const T &sol)=0
Client code must implement this method. 
 
void Tic() noexcept
Starts the stopwatch. 
 
const Scalar * const_iterator