generator  1.2
ProjectParameters.cpp
1 /*
2  This file is part of the GeneratorOfDatasets program.
3 
4  GeneratorOfDatasets is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  GeneratorOfDatasets is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with GeneratorOfDatasets. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #include <algorithm>
18 #include <cmath>
19 #include <limits>
20 #include <functional>
21 #include "ProjectParameters.h"
22 
23 using namespace std;
24 
26 
27  function<bool(const Interval<double>&)> negativeInterval = [](const Interval<double>& i) { return i.from() < 0.0; };
28 
29  if (par.numberOfRobots < 1)
30  return false;
31 
32  if (par.inputPowerOfModes.size() != par.minDelayOfModes.size() || par.inputPowerOfModes.empty())
33  return false;
34 
35  if (any_of(par.inputPowerOfModes.cbegin(), par.inputPowerOfModes.cend(), negativeInterval))
36  return false;
37 
38  if (any_of(par.minDelayOfModes.cbegin(), par.minDelayOfModes.cend(), negativeInterval))
39  return false;
40 
41  if (par.minDurationOfMovement.from() < 0.0 || par.prolongationOfMovement.from() < 0.0)
42  return false;
43 
44  if (par.energyFunctionCoefficients.size() != (uint32_t) (par.degreeOfCoefficients.to()-par.degreeOfCoefficients.from()+1))
45  return false;
46 
47  if (par.numberOfPoints.from() < 1)
48  return false;
49 
50  if (par.numberOfSequences.from() < 1)
51  return false;
52 
53  if (par.sequenceLength.from() < 1)
54  return false;
55 
56  if (par.minimalVertexDegree.from() < 0.0)
57  return false;
58 
59  if (par.percentageOfTableHandover < 0.0 || par.percentageOfTableHandover > 100.0)
60  return false;
61 
62  if (par.percentageOfRobotsHandover < 0.0 || par.percentageOfRobotsHandover > 100.0)
63  return false;
64 
65  if (abs((par.percentageOfRobotsHandover+par.percentageOfTableHandover)-100.0) > 3.0*numeric_limits<double>::epsilon())
66  return false;
67 
68  if (par.dilatationFactor.from() < 1.0)
69  return false;
70 
71  return true;
72 }
73 
Interval< double > dilatationFactor
Multiplicative factor by which the lower estimation of the cycle time will be adjusted.
Interval< uint32_t > numberOfPoints
The interval of the number of points (i.e. robot configurations) for each robot operation.
The structure with desired properties for the generated instances.
std::vector< Interval< double > > minDelayOfModes
The time interval of minimal duration for each power saving mode.
std::vector< Interval< double > > energyFunctionCoefficients
Intervals of energy function coefficients.
STL namespace.
Interval< int32_t > degreeOfCoefficients
The degree of coefficients, e.g. results to where are energy function coefficients.
Interval< double > minimalVertexDegree
The interval of the desired average node degree for the graph of robot interconnections.
double percentageOfRobotsHandover
The probability of the direct gripper-to-gripper handover.
std::vector< Interval< double > > inputPowerOfModes
For each power saving mode of the robot the interval of input power is defined.
The file declares the structure for storing the properties of generated instances.
double percentageOfTableHandover
The probability that the workpiece/weldment is handed over to other robot by using a bench...
Interval< double > prolongationOfMovement
The interval of prolongation for the fastest robot movements.
Interval< uint32_t > sequenceLength
The interval of the number of robot sub-operations for each atomic sequence.
bool checkProjectParameters(const ProjectParameters &par)
The function checks that the desired properties of instances are logically correct.
Interval< uint32_t > numberOfSequences
The interval of the number of atomic sequences in each (dis)assembling/welding/cutting operation...
uint32_t numberOfRobots
The number of robots in the robotic cell.
Interval< double > minDurationOfMovement
The interval of minimal duration of robot movements (defines the fastest movement).