solver  1.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ConstraintsGenerator Class Reference

Generation of the (I)LP constraints. More...

#include <ConstraintsGenerator.h>

+ Collaboration diagram for ConstraintsGenerator:

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 $s_{a_2} \geq s_{a_1}+d_{a_1}+CT*\mathrm{multipleOfCycleTime}$ 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 PrecalculatedMappingmMapping
 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< OperatormOp
 Operators of constraints.
 
std::vector< double > mB
 Right-hand side constants.
 
std::vector< std::string > mConDesc
 Description of the constraints.
 

Detailed Description

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.

See also
mathematical formulation, parallel hybrid heuristic

Definition at line 42 of file ConstraintsGenerator.h.

Member Function Documentation

void ConstraintsGenerator::addCollisionResolution ( const map1to1 s,
const map1to1 d,
uint32_t  i,
uint32_t  j,
int32_t  multipleOfCycleTime 
)

It adds a constraint $s_{a_2} \geq s_{a_1}+d_{a_1}+CT*\mathrm{multipleOfCycleTime}$ to resolve a collision, i.e. it adds a precedence for a given multiple of the robot cycle time.

Parameters
sMapping of variables corresponding to the start times of activities.
dMapping of variables corresponding to the durations of activities.
i,jFirst and second considered activity, respectively.
multipleOfCycleTimeMultiple 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.

Parameters
sMapping of variables corresponding to the start times of activities.
dMapping of variables corresponding to the durations of activities.
xMapping of variables corresponding to the selection of locations.
yMapping of variables corresponding to the selection of movements.
cMapping of variables that decide the order of potentially colliding activities.

Definition at line 318 of file ConstraintsGenerator.cpp.

void ConstraintsGenerator::addConstraint ( SparseMatrix< double >::Row &  row,
Operator  op,
const double &  b,
std::string  conDesc = "" 
)
private

Add constraint "row'*vars op b" into the formulation.

Parameters
rowA row of the constraint matrix, i.e. coefficients before the variables.
opEqual, less or equal, greater or equal.
bRight-hand side constant of the constraint.
conDescDescription 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.

Parameters
dMapping of variables corresponding to the durations of activities.
WMapping of variables corresponding to activity consumptions.
locSelected location of a static activity.
pwrmPower 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.

Parameters
dMapping of variables corresponding to the durations of activities.
WMapping of variables corresponding to activity consumptions.
mvSelected 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.

Parameters
dMapping of variables corresponding to activity durations.
WMapping of variables corresponding to activity consumptions.
xMapping of variables corresponding to the selection of locations.
zMapping 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.

Parameters
dMapping of variables corresponding to activity durations.
WMapping of variables corresponding to activity consumptions.
yMapping of variables corresponding to the selection of movements.

Definition at line 77 of file ConstraintsGenerator.cpp.

void ConstraintsGenerator::addFixedPrecedences ( const map1to1 s,
const map1to1 d 
)

Adds fixed precedences, i.e. enforces the have-to-be order of some activities.

Parameters
sMapping of variables corresponding to start times of activities.
dMapping of variables corresponding to durations of activities.

Definition at line 153 of file ConstraintsGenerator.cpp.

void ConstraintsGenerator::addFlowConstraints ( const map2to1 x,
const map2to1 y 
)

Add flow preservation constraints ensuring that robot leaves the same location as it enters.

Parameters
xMapping of variables corresponding to the selection of locations.
yMapping of variables corresponding to the selection of movements.

Definition at line 136 of file ConstraintsGenerator.cpp.

void ConstraintsGenerator::addMaximalDurationConstraints2 ( const map1to1 d,
const map2to1 y 
)

Constraints restricting the maximal duration of dynamic activities with respect to their selected movements.

Parameters
dMapping of variables corresponding to durations of activities.
yMapping of variables corresponding to the selection of movements.

Definition at line 246 of file ConstraintsGenerator.cpp.

void ConstraintsGenerator::addMinimalDurationConstraints1 ( const map1to1 d,
const map2to1 z 
)

Constraints restricting the minimal duration of static activities with respect to their assigned power saving modes.

Parameters
dMapping of variables corresponding to durations of activities.
zMapping of variables corresponding to the selection of power saving modes.

Definition at line 217 of file ConstraintsGenerator.cpp.

void ConstraintsGenerator::addMinimalDurationConstraints2 ( const map1to1 d,
const map2to1 y 
)

Constraints restricting the minimal duration of dynamic activities with respect to their selected movements.

Parameters
dMapping of variables corresponding to durations of activities.
yMapping 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.

Parameters
yMapping of variables corresponding to the selection of movements.
wMapping 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.

Parameters
sMapping of variables corresponding to start times of activities.
dMapping of variables corresponding to durations of activities.
wMapping 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.

Parameters
sMapping of variables corresponding to the start times of activities.
dMapping of variables corresponding to the durations of activities.
mvsSelected 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.

Parameters
xMapping 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.

Parameters
sMapping of variables corresponding to start times of activities.
allRequiredWhether 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.

Parameters
xMapping 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.

Parameters
zMapping of variables corresponding to the selection of power saving modes.

Definition at line 115 of file ConstraintsGenerator.cpp.


The documentation for this class was generated from the following files: