23 KnowledgeBase::KnowledgeBase() : mAddedTuples(0u), mProcessedTuples(0u), mOptimizationPhaseCounter(0u), mInfDueToLP(0u),
24 mInfDueToLocHeur(0u), mInfDueToPwrmHeur(0u), mInfDueToChangedPath(0u), mInfeasibleCounter(0u), mLPCalls(0u), mLPFixCalls(0u),
25 mPartProbCalls(0u), mLocHeurCalls(0u), mPwrmHeurCalls(0u), mPathChangeCalls(0u), mSumOfIters(0u), mLPTime(0.0), mLocHeurTime(0.0),
26 mPwrmHeurTime(0.0), mTupleGenTime(0.0), mSumOfDeteriorations(0u), mSumOfLocHeurErrs(0.0), mSumOfPwrmHeurErrs(0.0) { }
58 while (it != eit && it->first.totalEnergy <= s.
totalEnergy) {
108 return (((
double) infResults)/((
double) calls));
132 return (((
double) numOfLPCalls)/((
double) numOfLPFixCalls));
188 if (consideredTuples > 0)
189 return {consideredTuples, ((double) sumOfIters)/((double) consideredTuples)};
197 return 100.0*(((double) processed)/((double) added));
217 double totalValue = aggregatedValue;
218 uint64_t numCalls = counter;
221 return {numCalls, totalValue/numCalls};
223 return {numCalls, 0.0};
double totalEnergy
The amount of energy required per robot cycle.
void addTuple(CircuitTuple &&t)
Add a tuple to the mutex protected queue of tuples.
double mTupleGenTime
Aggregated processor time required for the generation of all the tuples.
The structure representing a solution found by an algorithm.
double mPwrmHeurTime
Aggregated processor time of all the (de)select power mode sub-heuristic calls.
void record(T value, T &addTo)
It carries out "addTo += value" operation, however protected by a mutex.
void candidate(const Solution &s, const CircuitTuple &t)
If a found solution ranks among the top ones, it is added to the list of elite solutions.
std::list< std::pair< Solution, CircuitTuple > > mEliteSolutions
List of elite solutions.
CircuitTuple getTuple()
Returns a partially fixed solution called tuple.
std::list< std::pair< Solution, CircuitTuple > > eliteSolutions()
Returns a list of elite solutions and their tuples from which they have been calculated.
std::atomic< uint64_t > mProcessedTuples
The number of processed tuples.
std::pair< uint64_t, double > infoLocHeur()
Returns the total number of HeuristicAlgorithms::heuristicLocationChanges calls and average runtime f...
double percentageOfProcessed()
Percentage of the processed tuples.
std::atomic< uint64_t > mAddedTuples
Total number of generated tuples.
std::atomic< uint64_t > mOptimizationPhaseCounter
Records the number of tuples coming to the optimization process of the heuristic. ...
double mSumOfLocHeurErrs
The sum of the relative estimation errors (calculated by the change locations sub-heuristic) of energ...
uint32_t MAX_ELITE_SOLUTIONS
The number of top solutions maintained by the heuristic.
std::vector< std::string > mErrorMessages
Vector containing error messages of worker threads (to throw an exception later). ...
void recordLPFixDeterioration(double deterioration)
Reports a relative deterioration in the solution quality caused by the resolution of collisions...
std::pair< uint64_t, double > infoLP()
Returns the total number of Linear Programming calls and its average runtime for one worker thread...
void recordInfeasibleLP()
Reports that the solution of the Linear Programming problem was infeasible (one call of LP)...
Solution bestSolution()
Returns the best found solution, throws an exception if not available.
std::atomic< uint64_t > mSumOfIters
The total number of optimization iterations.
std::atomic< uint64_t > mInfeasibleCounter
How many times a Linear Programming solver returned an infeasible solution.
void addErrorMessage(const std::string &msg)
Add an error message to the mutex protected vector of messages.
std::atomic< uint64_t > mPwrmHeurCalls
The number of (de)select power mode sub-heuristic calls.
A partially fixed problem, i.e. tuple.
std::mutex mStatMtx
Mutex ensuring the flawless float operations for multiple concurrent threads.
std::atomic< uint64_t > mLPFixCalls
How many times a partially fixed problem was successfully solved.
void recordPwrmHeurCall(double runtime)
Reports a real time (measured by a timer) required by HeuristicAlgorithms::heuristicPowerModeSelectio...
State status
Enum specifying whether the solution is optimal, feasible, or infeasible...
double mLocHeurTime
Aggregated processor time of all the change locations sub-heuristic calls.
void recordLPCall(double runtime)
Reports a real time (measured by a timer) required for solving a partially fixed problem by Linear Pr...
void recordLocHeurRelErr(double relativeEstError)
Reports a relative estimation error of the change locations sub-heuristic for an energy improvement...
void recordNumberOfItersPerTuple(uint64_t iters)
Reports the number of optimization iterations performed for a loaded tuple.
std::mutex mErrorsMtx
Mutex protecting the access to the vector of error messages.
std::atomic< uint64_t > mLocHeurCalls
The number of change locations sub-heuristic calls.
std::atomic< uint64_t > mLPCalls
The number of Linear Programming calls.
std::mutex mTuplesMtx
Mutex protecting the access to the queue that contains tuples.
std::pair< uint64_t, double > infoItersPerTuple()
Returns the total number of tuples used for optimization and the average number of optimization itera...
void recordPwrmHeurRelErr(double relativeEstError)
Reports a relative estimation error of the (de)select power mode sub-heuristic for an energy improvem...
It declares the namespace for program settings.
double averageErrOfLocHeur()
Returns an average estimation error of the change locations sub-heuristic.
std::pair< uint64_t, double > getInfo(double &aggregatedValue, std::atomic< uint64_t > &counter)
Auxiliary method used for the calculation of an average time of a call based on a counter value and t...
double averageNumberOfLPCallsForLPFix()
Returns an average number of added precedences required for collisions avoidance. ...
std::pair< uint64_t, double > infoPwrmHeur()
Returns the total number of HeuristicAlgorithms::heuristicPowerModeSelection calls and average runtim...
Declares the class storing the best found solutions, tuples, and information about the heuristic perf...
std::queue< CircuitTuple > mTuples
Queue with the generated tuples.
double mLPTime
Aggregated processor time of all the Linear Programming calls.
double mSumOfPwrmHeurErrs
The sum of the relative estimation errors (calculated by the (de)select power mode sub-heuristic) of ...
double averageErrOfPwrmHeur()
Returns an average estimation error of the (de)select power mode sub-heuristic.
std::atomic< uint64_t > mPartProbCalls
How many times a partially fixed problem was evaluated, i.e. the number of calls of HeuristicAlgorith...
void recordPartialProblemSolveCall()
Reports that HeuristicAlgorithms::solvePartialProblem method was called.
std::mutex mEliteMtx
Mutex protecting the access to the list of elite solutions.
double mSumOfDeteriorations
The sum of relative deteriorations of the energy consumption caused by the collision resolution...
double averageLPFixDeterioration()
Returns an average quality deterioration caused by the collisions resolution.
std::pair< uint64_t, double > infoTuplesGeneration()
Returns the total number of generated tuples and the average generation time for one worker thread...
void recordAddTuplesCall(double runtime)
Reports a real time (measured by a timer) required for ParallelHeuristicSolver::addRandomTuplesToKB c...
double infeasibilityRate()
Infeasibility rate of Linear Programming, i.e. the proportion of infeasible solutions to feasible and...
void recordLocHeurCall(double runtime)
Reports a real time (measured by a timer) required by HeuristicAlgorithms::heuristicLocationChanges s...
Thrown if the best solution of the heuristic cannot be returned since the solution pool is empty...