18 #include "SolverConfig.h"
26 addActivities(r->activities(),
true);
30 for (
Robot* r : l.robots())
31 addActivities(r->activities(),
true);
35 uint32_t idx = numberOfVariables();
37 if ((mandatory ==
true && a->mandatory()) || (mandatory ==
false && a->optional())) {
41 variables.emplace_back(FLT, 0.0);
42 varDesc.emplace_back(
"W_{"+to_string(a->aid())+
"}");
43 W.emplace(a->aid(), idx++);
47 const vector<Robot*>& robots = l->robots();
48 variables.emplace_back(FLT, 0.0, l->productionCycleTime()*robots.size());
49 varDesc.emplace_back(
"s_{"+to_string(a->aid())+
"}");
50 s.emplace(a->aid(), idx++);
52 variables.emplace_back(FLT, a->minAbsDuration(), a->maxAbsDuration());
53 varDesc.emplace_back(
"d_{"+to_string(a->aid())+
"}");
54 d.emplace(a->aid(), idx++);
56 throw_with_nested(
SolverException(caller(),
"Activity identifications are not unique!"));
63 map<uint32_t, double> m;
64 for (
const auto& p : mapping) {
65 const auto& ret = m.emplace(p.first, solution[p.second]);
66 if (ret.second !=
true)
The base class incorporating common properties of robot operations and movements. ...
Instance of this class includes all the data structures and methods related to a robot.
void addActivities(const std::vector< Activity * > &activities, bool mandatory, bool mapW=true)
It adds the mapping for extra activities.
Mapping of continuous variables of the energy optimization problem.
A general exception of the program.
Various auxiliary functions used across the program.
The file defines extended exceptions for the better error handling in the program.
VariableMappingLP(Robot *r)
Constructs the mapping of the continuous variables.
std::map< uint32_t, uint32_t > inverseMapping(const std::vector< double > &solution, const map2to1 &mapping)
It extracts the variables set to true and returns the ,,selected" indices.
std::map< uint32_t, uint32_t > map1to1
Identification of the activity is mapped to the index of the variable.
The robotic cell corresponds to an instance of this class.