solver
1.0
|
Generation of the (I)LP constraints. More...
#include <ConstraintsGenerator.h>
Public Member Functions | |
ConstraintsGenerator () | |
Empty constructor, the object needs to be assigned a robot or robotic cell later. | |
ConstraintsGenerator (Robot *r, const PrecalculatedMapping *m) | |
Generation of the constraints for a given robot. | |
ConstraintsGenerator (const RoboticLine &l, const PrecalculatedMapping *m) | |
Generation of the constraints for a given robotic cell. | |
void | reset () |
All the generated constraints are removed. | |
void | reset (Robot *r, const PrecalculatedMapping *m) |
Removes all the constraints and sets a new robot as active. | |
void | reset (const RoboticLine &l, const PrecalculatedMapping *m) |
Removes all the constraints and sets a new robotic cell as active. | |
uint64_t | moveConstraintsToModel (ILPModel &m) |
It efficiently moves all the generated constraints to the given model. | |
void | addEnergyFunctions1 (const map1to1 &d, const map1to1 &W, const map2to1 &x, const map2to1 &z) |
Add the constraints propagating the consumption of static activities to the criterion. More... | |
void | addEnergyFunctions2 (const map1to1 &d, const map1to1 &W, const map2to1 &y) |
Add the constraints propagating the consumption of dynamic activities to the criterion. More... | |
void | addEnergyFunctions (const map1to1 &d, const map1to1 &W, const map2to1 &x, const map2to1 &z, const map2to1 &y) |
It adds the energy functions of both the static and dynamic activities. | |
void | addUniquePointSelection (const map2to1 &x) |
Just one location, i.e. coordinate, is selected for each static activity. More... | |
void | addUniquePowerModeSelection (const map2to1 &z) |
Just one power saving mode (including the dummy one - motors) is applied for each static activity. More... | |
void | addUniqueModeSelection (const map2to1 &x, map2to1 &z) |
It calls addUniquePointSelection and addUniquePowerModeSelection methods. | |
void | addFlowConstraints (const map2to1 &x, const map2to1 &y) |
Add flow preservation constraints ensuring that robot leaves the same location as it enters. More... | |
void | addFixedPrecedences (const map1to1 &s, const map1to1 &d) |
Adds fixed precedences, i.e. enforces the have-to-be order of some activities. More... | |
void | addPrecedenceSelectionConstraints (const map2to1 &y, const map2to1 &w) |
According to the selected movements it decides which optional dynamic activities are performed. More... | |
void | addSelectablePrecedences (const map1to1 &s, const map1to1 &d, const map2to1 &w) |
It adds selectable precedences which model alternative orders of activities. More... | |
void | addAllPrecedences (const map1to1 &s, const map1to1 &d, const map2to1 &y, const map2to1 &w) |
It calls all the methods related to the order of activities. | |
void | addMinimalDurationConstraints1 (const map1to1 &d, const map2to1 &z) |
Constraints restricting the minimal duration of static activities with respect to their assigned power saving modes. More... | |
void | addMinimalDurationConstraints2 (const map1to1 &d, const map2to1 &y) |
Constraints restricting the minimal duration of dynamic activities with respect to their selected movements. More... | |
void | addMaximalDurationConstraints2 (const map1to1 &d, const map2to1 &y) |
Constraints restricting the maximal duration of dynamic activities with respect to their selected movements. More... | |
void | addDurationConstraints (const map1to1 &d, const map2to1 &z, const map2to1 &y) |
It constructs all the constraints that limit the duration of activities. | |
void | addTimeLags (const map1to1 &s, bool allRequired=true) |
Time lags enforcing correct time synchronizations between robots are added. More... | |
void | addSpatialCompatibilityConstraints (const map2to1 &x) |
It defines the spatial compatibility between robots, in other words a workpice is taken from the same place as it has been given. More... | |
void | addCollisions (const map1to1 &s, const map1to1 &d, const map2to1 &x, const map2to1 &y, const map4toN &c) |
Adds constraints that enforce a collision-free solution. More... | |
void | addGlobalConstraints (const map1to1 &s, const map1to1 &d, const map2to1 &x, const map2to1 &y, const map4toN &c) |
Adds all the global constraints, i.e. time lags, spatial compatibility, and collision resolution. | |
void | addEnergyFunction (const map1to1 &d, const map1to1 &W, Location *loc, RobotPowerMode *pwrm) |
Adds energy function for a static activity, its location, and its applied power saving mode. More... | |
void | addEnergyFunction (const map1to1 &d, const map1to1 &W, Movement *mv) |
Adds a piece-wise linear function for a dynamic activity and its movement. More... | |
void | addSelectedPrecedences (const map1to1 &s, const map1to1 &d, const std::vector< Movement * > &mvs) |
Each has-to-be movement imposes a fixed precedence that is added to the formulation in the form of a constraint. More... | |
void | addCollisionResolution (const map1to1 &s, const map1to1 &d, uint32_t i, uint32_t j, int32_t multipleOfCycleTime) |
It adds a constraint to resolve a collision, i.e. it adds a precedence for a given multiple of the robot cycle time. More... | |
Private Member Functions | |
void | initializeDataStructures () |
It initializes the member variables and removes all the constraints. | |
void | addConstraint (SparseMatrix< double >::Row &row, Operator op, const double &b, std::string conDesc="") |
Add constraint "row'*vars op b" into the formulation. More... | |
Private Attributes | |
double | mCycleTime |
Copied robot cycle time. | |
uint64_t | mConstraintsCounter |
The number of constraints generated by an instance of this class. | |
RoboticLine const * | mLine |
Pointer to an active robotic cell. | |
std::vector< Robot * > | mRobots |
Robots located in the robotic cell. | |
const PrecalculatedMapping * | mMapping |
Mapping calculated for the robotic cell. | |
std::vector< StaticActivity * > | mStaticActivities |
Static activities filtered from the robotic cell. | |
std::vector< DynamicActivity * > | mDynamicActivities |
Dynamic activities filtered from the robotic cell. | |
SparseMatrix< double > | mA |
Constraint matrix. | |
std::vector< Operator > | mOp |
Operators of constraints. | |
std::vector< double > | mB |
Right-hand side constants. | |
std::vector< std::string > | mConDesc |
Description of the constraints. | |
Generation of the (I)LP constraints.
The generator constructs the constraints related to the energy optimization of robotic cells. The description of the constraints is available at mathematical formulation and parallel hybrid heuristic pages.
Definition at line 42 of file ConstraintsGenerator.h.
void ConstraintsGenerator::addCollisionResolution | ( | const map1to1 & | s, |
const map1to1 & | d, | ||
uint32_t | i, | ||
uint32_t | j, | ||
int32_t | multipleOfCycleTime | ||
) |
It adds a constraint to resolve a collision, i.e. it adds a precedence for a given multiple of the robot cycle time.
s | Mapping of variables corresponding to the start times of activities. |
d | Mapping of variables corresponding to the durations of activities. |
i,j | First and second considered activity, respectively. |
multipleOfCycleTime | Multiple of the robot cycle time. |
Definition at line 434 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addCollisions | ( | const map1to1 & | s, |
const map1to1 & | d, | ||
const map2to1 & | x, | ||
const map2to1 & | y, | ||
const map4toN & | c | ||
) |
Adds constraints that enforce a collision-free solution.
s | Mapping of variables corresponding to the start times of activities. |
d | Mapping of variables corresponding to the durations of activities. |
x | Mapping of variables corresponding to the selection of locations. |
y | Mapping of variables corresponding to the selection of movements. |
c | Mapping of variables that decide the order of potentially colliding activities. |
Definition at line 318 of file ConstraintsGenerator.cpp.
|
private |
Add constraint "row'*vars op b" into the formulation.
row | A row of the constraint matrix, i.e. coefficients before the variables. |
op | Equal, less or equal, greater or equal. |
b | Right-hand side constant of the constraint. |
conDesc | Description of the constraint. |
Definition at line 462 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addEnergyFunction | ( | const map1to1 & | d, |
const map1to1 & | W, | ||
Location * | loc, | ||
RobotPowerMode * | pwrm | ||
) |
Adds energy function for a static activity, its location, and its applied power saving mode.
d | Mapping of variables corresponding to the durations of activities. |
W | Mapping of variables corresponding to activity consumptions. |
loc | Selected location of a static activity. |
pwrm | Power saving mode that is applied while the robot is stationary in the location. |
Definition at line 365 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addEnergyFunction | ( | const map1to1 & | d, |
const map1to1 & | W, | ||
Movement * | mv | ||
) |
Adds a piece-wise linear function for a dynamic activity and its movement.
d | Mapping of variables corresponding to the durations of activities. |
W | Mapping of variables corresponding to activity consumptions. |
mv | Selected movement of a dynamic activity. |
Definition at line 378 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addEnergyFunctions1 | ( | const map1to1 & | d, |
const map1to1 & | W, | ||
const map2to1 & | x, | ||
const map2to1 & | z | ||
) |
Add the constraints propagating the consumption of static activities to the criterion.
d | Mapping of variables corresponding to activity durations. |
W | Mapping of variables corresponding to activity consumptions. |
x | Mapping of variables corresponding to the selection of locations. |
z | Mapping of variables corresponding to the selection of power saving modes. |
Definition at line 58 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addEnergyFunctions2 | ( | const map1to1 & | d, |
const map1to1 & | W, | ||
const map2to1 & | y | ||
) |
Add the constraints propagating the consumption of dynamic activities to the criterion.
d | Mapping of variables corresponding to activity durations. |
W | Mapping of variables corresponding to activity consumptions. |
y | Mapping of variables corresponding to the selection of movements. |
Definition at line 77 of file ConstraintsGenerator.cpp.
Adds fixed precedences, i.e. enforces the have-to-be order of some activities.
s | Mapping of variables corresponding to start times of activities. |
d | Mapping of variables corresponding to durations of activities. |
Definition at line 153 of file ConstraintsGenerator.cpp.
Add flow preservation constraints ensuring that robot leaves the same location as it enters.
x | Mapping of variables corresponding to the selection of locations. |
y | Mapping of variables corresponding to the selection of movements. |
Definition at line 136 of file ConstraintsGenerator.cpp.
Constraints restricting the maximal duration of dynamic activities with respect to their selected movements.
d | Mapping of variables corresponding to durations of activities. |
y | Mapping of variables corresponding to the selection of movements. |
Definition at line 246 of file ConstraintsGenerator.cpp.
Constraints restricting the minimal duration of static activities with respect to their assigned power saving modes.
d | Mapping of variables corresponding to durations of activities. |
z | Mapping of variables corresponding to the selection of power saving modes. |
Definition at line 217 of file ConstraintsGenerator.cpp.
Constraints restricting the minimal duration of dynamic activities with respect to their selected movements.
d | Mapping of variables corresponding to durations of activities. |
y | Mapping of variables corresponding to the selection of movements. |
Definition at line 232 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addPrecedenceSelectionConstraints | ( | const map2to1 & | y, |
const map2to1 & | w | ||
) |
According to the selected movements it decides which optional dynamic activities are performed.
y | Mapping of variables corresponding to the selection of movements. |
w | Mapping of variables corresponding to the selection of optional dynamic activities. |
Definition at line 172 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addSelectablePrecedences | ( | const map1to1 & | s, |
const map1to1 & | d, | ||
const map2to1 & | w | ||
) |
It adds selectable precedences which model alternative orders of activities.
s | Mapping of variables corresponding to start times of activities. |
d | Mapping of variables corresponding to durations of activities. |
w | Mapping of variables corresponding to the selection of optional dynamic activities. |
Definition at line 190 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addSelectedPrecedences | ( | const map1to1 & | s, |
const map1to1 & | d, | ||
const std::vector< Movement * > & | mvs | ||
) |
Each has-to-be movement imposes a fixed precedence that is added to the formulation in the form of a constraint.
s | Mapping of variables corresponding to the start times of activities. |
d | Mapping of variables corresponding to the durations of activities. |
mvs | Selected movements that must occur in a solution. |
Definition at line 408 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addSpatialCompatibilityConstraints | ( | const map2to1 & | x | ) |
It defines the spatial compatibility between robots, in other words a workpice is taken from the same place as it has been given.
x | Mapping of variables corresponding to the selection of locations. |
Definition at line 290 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addTimeLags | ( | const map1to1 & | s, |
bool | allRequired = true |
||
) |
Time lags enforcing correct time synchronizations between robots are added.
s | Mapping of variables corresponding to start times of activities. |
allRequired | Whether all the time lags have to be applicable (ILP yes, reduced LP not). |
Definition at line 267 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addUniquePointSelection | ( | const map2to1 & | x | ) |
Just one location, i.e. coordinate, is selected for each static activity.
x | Mapping of variables corresponding to the selection of locations. |
Definition at line 103 of file ConstraintsGenerator.cpp.
void ConstraintsGenerator::addUniquePowerModeSelection | ( | const map2to1 & | z | ) |
Just one power saving mode (including the dummy one - motors) is applied for each static activity.
z | Mapping of variables corresponding to the selection of power saving modes. |
Definition at line 115 of file ConstraintsGenerator.cpp.