18 #ifndef HLIDAC_PES_DATASTRUCTURES_H
19 #define HLIDAC_PES_DATASTRUCTURES_H
28 #include <unordered_map>
37 LP_INITIAL_PROBLEM = 0, POWER_MODE_HEURISTIC = 1, LOCATION_CHANGE_HEURISTIC = 2, PATH_CHANGE = 4
275 assert(!
isTabu(l, from, to) &&
"Adding already forbidden combination!");
280 throw SolverException(caller(),
"Cannot add an element to an empty tabu list!");
290 int32_t toErase = (int32_t) ceil(0.3*
mTabu.size());
292 if (!
mTabu[startIdx].isEmpty()) {
297 startIdx = ((startIdx+1) %
mTabu.size());
299 }
while (startIdx !=
mListIdx && toErase > 0);
311 return loc ==
nullptr &&
m1 ==
nullptr &&
m2 ==
nullptr;
354 return std::accumulate(
mData.cbegin(),
mData.cend(), T())/
mData.size();
361 mData.push_back(val);
364 mData.push_back(val);
std::vector< T * > circuit
Closed path through locations or static activities, each static activity is visited just once...
bool isTabu(Location *l, RobotPowerMode *from, RobotPowerMode *to) const
It checks whether the modification of a partial solution is allowed, i.e. the move/modification is no...
std::vector< std::vector< double > > durLocs
Durations assigned to static activities' locations.
void addTabu(Location *l, RobotPowerMode *from, RobotPowerMode *to)
It adds a performed modification into the tabu list.
The base class incorporating common properties of robot operations and movements. ...
uint32_t mListIdx
Current index to the tabu list, i.e. a current write position.
An element of the tabu list.
std::vector< std::vector< double > > startMvs
Start times assigned to dynamic activities' movements.
CollisionResolution()
Empty collision constructed – a1 and a2 are null pointers.
std::vector< StaticActivity * > idToActivity
Node index to static activity, note that dynamic activities are already incorporated in the lengths o...
std::unordered_map< ShortestCircuit, HamiltonianCircuit< Location >> PrecalculatedCircuits
Mapping of ShortestCircuit to the related shortest closed path through locations. ...
StaticActivity * t
Edge enters to activity t.
Closed path through locations or static activities including an order of operations, i.e. alternative.
RobotPowerMode * to
The candidate power saving mode to switch to.
Shortest closed path through locations.
RobotPowerMode * pwrm
Power saving mode of the robot if it applies, i.e. mode can be cast to Location.
Hamiltonian circuit through static activities and the fixed locations.
double energy
Energy required by the activity for the current duration.
Activity * a2
Second activity involved in the collision.
double estimatedEnergy
Estimated energy consumption after switching to the candidate power saving mode.
A general exception of the program.
std::vector< CircuitRecord > tuple
Tuple, i.e. a partially fixed problem.
The structure stores how to resolve one collision between robots.
bool filled() const
Returns whether the average is calculated from the full length.
ShortestCircuit sc
Selected alternative and fixed locations.
A graph edge in the distance graph.
std::vector< Edge > edges
Graph edges.
double minDuration
Minimal possible duration of the activity for the given mode, robot, and power saving mode (if mode ~...
double curStartTime
Current start time of the activity.
bool operator==(const Element &e) const
The element is equal to the another one if all the data members are equal.
A short-term memory, containing a list of forbidden moves, that mitigates the risk of cycling...
ActivityMode * mode
Selected mode of an activity, i.e. movement or location.
Various auxiliary functions used across the program.
uint64_t hashOW(const C &v)
It calculates a hash of the container, the order of elements influences (Order Wise) the hash value...
std::vector< std::vector< double > > startLocs
Start times assigned to static activities' locations.
uintptr_t hashEW(const C &v)
It calculates a hash of the container, the order of elements does not influence (Element Wise) the ha...
int32_t multiplier
Multiplier addressing the time shift in the number of cycles.
double curDuration
Current duration of the activity.
The file defines extended exceptions for the better error handling in the program.
double maxDuration
Maximal possible duration of the activity limited by e.g. the robot, performed operation, etc.
double totalEnergy
Energy consumption of a robotic cell for this timing.
A partially fixed problem, i.e. tuple.
Exception is thrown if a method is given invalid parameters or a user provides invalid program argume...
Collection of locations in which a robot operation (or waiting) can be performed. ...
Structure encapsulates the time and energy properties of an activity with its selected mode (a moveme...
void clear()
Remove all the values from which the running average is calculated.
TabuList(const uint32_t &tabuListSize)
Constructs a tabu list with the fixed size.
bool operator<(const CircuitRecord &cr) const
It enables to sort the circuits according to their lengths (shorter is better).
It represents the power saving mode of the robot.
bool operator<(const ModeSwitchInfo &msi) const
Sorting the switching alternatives according to the estimated energy consumption (less is better)...
void addValue(const T &val)
Add a new value to the moving average.
Location * loc
Location where a power saving mode was changed.
MovingAverage(uint32_t length)
It constructs an instance of the moving average.
std::vector< Element > mTabu
Tabu list containing the forbidden modifications.
bool operator<(const ActivityModeInfo &ami) const
Sort the activities according to start time, left to right direction in the Gantt.
double minLength
The lower bound on the robot cycle time for this circuit (neglecting global constraints).
A graph in which random alternatives will be searched for.
Algo
Defining constants for different states of the heuristic.
std::vector< std::vector< Edge > > idToSuccessors
Node index to leaving edges that enters to its (node) successors.
uint32_t endIdent
An index of the end node.
double intersection
Duration of the collision between activities a1 and a2.
uint32_t locationIdx
Index of the related location of the robot.
bool isEmpty() const
Whether a tabu list element is empty, i.e. it does not contain a modification.
HamiltonianCircuit< Location > hc
Shortest closed path through locations, fixed locations are included.
RobotPowerMode * from
The original power saving mode.
Either a movement or location.
uint32_t startIdent
An index of the start node.
StaticActivity * f
Edge leaves the activity f.
std::vector< T > mData
The vector of values from which the running average is calculated.
Records a potential energy impact if a power saving mode of a robot is switched to another one...
uint32_t j
An index assigned to the activity t, used for an access to the distance matrix.
Location of the robot used either during work (welding) or waiting.
std::map< Activity *, std::pair< double, double > > actToStartAndDur
Activity to the assigned start time and duration.
Location * loc
A pointer to the considered location.
The file contains various classes devoted to abstract representation of the robotic cell...
std::map< ActivityMode *, std::pair< double, double > > modeToStartAndDur
Selected location/movement to the assigned start time and duration.
std::vector< std::vector< double > > durMvs
Durations assigned to dynamic activities' movements.
std::vector< StaticActivity * > circuit
Selected alternative, i.e. order of operations.
std::vector< Location * > fixedLocations
Locations required to be fixed to enforce the spatial compatibility between robots.
The class encapsulating the calculation of the moving average.
Obtained timing for a partial problem.
uint32_t robotIdx
Index of the robot.
Activity * a1
First activity involved in the collision.
uint32_t i
An index assigned to the activity f, used for an access to the distance matrix.
uint32_t mLength
The maximal number of values used for the calculation of the moving average.
double average() const
Current value of the running average.
RobotPowerMode * m2
The power saving mode which replaced the original one.
RobotPowerMode * m1
Original power saving mode that was replaced by another one.