|
void | controlThread () |
| Generates various alternatives, launches worker threads, prints progress info, joins the workers, and handles errors of workers. More...
|
|
void | workerThread (uint32_t threadId, std::vector< std::vector< CircuitRecord >> initialCircuits, PrecalculatedCircuits precalculatedCircuits) |
| The worker thread generates initial tuples, and optimizes them by local modifications proposed by sub-heuristics. More...
|
|
Graph | constructMinimalDurationGraph (Robot *r) const |
| Generates a distance graph for the given robot. More...
|
|
DistanceMatrix< double > | createInitialDistanceMatrix (const Graph &g) const |
| It creates an initial matrix of distances based on edge lengths. More...
|
|
std::vector< CircuitRecord > | generateRandomAlternatives (const uint32_t &threadId, const Graph &g, const DistanceMatrix< double > &m) |
| Generates some random alternatives, i.e. candidates for a feasible order, from a distance graph and distance matrix of a robot. More...
|
|
HamiltonianCircuit< Location > | getShortestCircuit (const uint32_t &threadId, const std::vector< StaticActivity * > &circuit, const std::vector< Location * > &fixed, bool writeCircuit=true) |
| It calculates the shortest circuit through locations that visits each static activity in the same order as it is in circuit parameter. More...
|
|
std::vector< std::vector< CircuitRecord > > | generateShortestCircuits (PrecalculatedCircuits &precalculatedCircuits) |
| It finds random alternatives for each robot and calculates their shortest closed paths through locations. More...
|
|
uint32_t | selectAlternative (const std::vector< CircuitRecord > &alternatives) const |
| It randomly selects a robot alternative according to a distribution function that slightly prefers the alternatives with lower estimation of the robot cycle time. More...
|
|
double | calculateNewCycleTime (const uint32_t &threadId, const double ¤tCycleTime, std::vector< StaticActivity * > &alternative, std::vector< Location * > &fixed, Location *toFix, PrecalculatedCircuits &precalculatedCircuits) |
| A highly optimized function calculates a lower estimation on the robot cycle time if toFix location is newly fixed. More...
|
|
void | addRandomTuplesToKB (const uint32_t &threadId, const uint32_t &numOfTuples, std::vector< std::vector< CircuitRecord >> &initialCircuits, PrecalculatedCircuits &precalculatedCircuits) |
| It generates and adds a requested number of tuples to the KnowledgeBase. More...
|
|
void | generatePromisingTuples (const uint32_t &threadId) |
| It generates promising tuples and adds them to the KnowledgeBase. More...
|
|
double | changeRobotPaths (uint32_t threadId, const CircuitTuple &t, PartialSolution &ps, const std::vector< std::vector< Location * >> &fixed) |
| It randomly modifies the robot paths to enable the heuristic to search otherwise unreachable parts of the solution space. More...
|
|
void | printProgressInfo (const double ¤tRuntime) |
| Prints various information about the performance of the sub-heuristics, generation of tuples, and solving reduced problems by Linear Programming. More...
|
|
void | writePerformanceRecordToLogFile (const double &initializationTime, const double &finalRuntime) |
| It writes various statistics about the heuristic performance to a CSV file. More...
|
|
|
double | mRuntime |
| The runtime of this heuristic, updated from time to time.
|
|
uint32_t | mTabuListSize |
| The number of tabu list elements calculated in the constructor.
|
|
std::atomic< bool > | mFeasible |
| Used to stop other OpenMP threads if the instance infeasibility is detected by a thread.
|
|
std::atomic< bool > | mStopCondition |
| The control thread sets this flag to true to stop all the worker threads.
|
|
RoboticLine | mLine |
| Robotic cell to be optimized.
|
|
KnowledgeBase | mKB |
| Various data of the heuristic, e.g. generated tuples, performance statistics, etc.
|
|
PrecalculatedMapping | mMapping |
| Fast searching in the data structure of the robotic cell.
|
|
HeuristicAlgorithms | algo |
| Optimization sub-heuristics and the related Linear Programming solver for partially fixed problems.
|
|
std::vector< std::vector< std::vector< double > > > | mDist |
| Preallocated 2-D array of distances for getShortestCircuit method, indexed by thread.
|
|
std::vector< std::vector< std::vector< int64_t > > > | mPreds |
| Preallocated 2-D array of predecessors for getShortestCircuit method, indexed by thread.
|
|
std::vector< std::vector< std::vector< Location * > > > | mLocs |
| Preallocated 2-D array of locations for getShortestCircuit method, indexed by thread.
|
|
std::vector< SpatialCmpTuple > | mSortedSptCmp |
| The vector of spatial compatibility pairs heuristically sorted in decreasing order of difficulty.
|
|
A parallel heuristic for the energy optimization of robotic cells.
A parallel hybrid heuristic that solves the energy optimization problem of robotic cells is implemented in this class. At first the heuristic generates a candidate tuples, i.e. a partially fixed problems, that could be resulting in initial feasible solutions. If an initial solution is feasible then it is further optimized by sub-heuristics that iteratively change the fixed locations and power saving modes with respect to the energy reasoning. The best found solution is returned after a given time limit, or an exception is thrown if such a solution does not exist.
- See also
- HeuristicAlgorithms, KnowledgeBase
Definition at line 46 of file ParallelHeuristicSolver.h.
void ParallelHeuristicSolver::controlThread |
( |
| ) |
|
|
private |
Generates various alternatives, launches worker threads, prints progress info, joins the workers, and handles errors of workers.
The control thread starts with the generation of alternatives, i.e. various orders of operations, for individual robots. Afterwards, the worker threads are launched to find good quality solutions. Meanwhile the control thread prints various statistical information about the heuristic performance and generates the promising tuples, i.e. partially fixed problems. After a given time limit, the worker threads are stopped and possible errors, which occurred in worker threads, are reported.
- Note
- Thread identification of the control thread is 0.
Definition at line 83 of file ParallelHeuristicSolver.cpp.
The worker thread generates initial tuples, and optimizes them by local modifications proposed by sub-heuristics.
- Parameters
-
threadId | Identification of the thread, i.e. a number from 1 to n where n is the total number of worker threads. |
initialCircuits | Various alternatives (orders of operations) for each robot, indexed by robots. |
precalculatedCircuits | ShortestCircuit to the fastest closed path through robot locations (including the fixed ones). |
The worker thread generates candidate tuples, i.e. partially fixed problems that could be resulting in feasible solutions, to be optimized. First of all, the tuple is loaded and an initial timing can be extracted from a solution of Linear Programming. If the timing can be obtained, the optimization phase starts and the sub-heuristics iteratively modifies the tuple in a way that could be resulting in an energy reduction. All the feasible solutions are passed to KnowledgeBase, where the list of elite solutions is located.
- See also
- HeuristicAlgorithms, MovingAverage, OptimalTiming, Settings
Definition at line 156 of file ParallelHeuristicSolver.cpp.