solver  1.0
Solution.h
Go to the documentation of this file.
1 /*
2  This file is part of the EnergyOptimizatorOfRoboticCells program.
3 
4  EnergyOptimizatorOfRoboticCells 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  EnergyOptimizatorOfRoboticCells 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 EnergyOptimizatorOfRoboticCells. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef HLIDAC_PES_SOLUTION_H
19 #define HLIDAC_PES_SOLUTION_H
20 
27 #include <iostream>
28 #include <map>
29 #include <utility>
31 
33 
38 enum State {
39  OPTIMAL, FEASIBLE, INFEASIBLE, UNKNOWN
40 };
41 
43 State convert(const Status& ilpStatus);
44 
50 struct Solution {
52  Solution() : status(UNKNOWN), totalEnergy(0.0), lowerBound(0.0), runTime(-1.0), memUsage(-1.0) { }
53 
57  double totalEnergy;
59  double lowerBound;
61  double runTime;
63  double memUsage;
65  std::map<uint32_t, std::pair<double, double> > startTimeAndDuration;
67  std::map<uint32_t, std::pair<uint32_t, uint32_t> > pointAndPowerMode;
68 
69 };
70 
79 std::ostream& operator<<(std::ostream& out, const Solution& s);
82 std::ostream& operator<<(std::ostream& out, const State& st);
83 
90 void writeBriefResultToStream(std::ostream& OUT, const std::string& instanceName, const Solution& s);
97 void writeBriefResultToCsvFile(const std::string& instanceName, const std::string& pathToFile, const Solution& s);
105 void writeSolutionToCsvFile(const std::string& file, const Solution& s, const PrecalculatedMapping& mapper);
106 
108 
109 #endif
110 
Solution()
It constructs an empty solution.
Definition: Solution.h:52
double totalEnergy
The amount of energy required per robot cycle.
Definition: Solution.h:57
The structure representing a solution found by an algorithm.
Definition: Solution.h:50
double runTime
Run time (seconds) of the optimization algorithm required for obtaining this solution.
Definition: Solution.h:61
State convert(const Status &ilpStatus)
Conversion between the ILP solver status and the solution state.
Definition: Solution.cpp:29
std::ostream & operator<<(std::ostream &out, const Solution &s)
It prints the solution to the output stream.
Definition: Solution.cpp:48
std::map< uint32_t, std::pair< uint32_t, uint32_t > > pointAndPowerMode
It maps the identification of a static activity to its assigned coordinate and used power saving mode...
Definition: Solution.h:67
Solver-independent interface for solving Integer Linear Programming problems.
State status
Enum specifying whether the solution is optimal, feasible, or infeasible...
Definition: Solution.h:55
void writeBriefResultToCsvFile(const std::string &instanceName, const std::string &pathToFile, const Solution &s)
It writes the solution to the file in the same format as writeBriefResultToStream function...
Definition: Solution.cpp:164
Status
Constants specifying whether a solution is optimal, feasible, infeasible, unbounded, or undefined, respectively.
double memUsage
Memory usage (bytes) of the optimization algorithm, currently not used due to implementation issues...
Definition: Solution.h:63
void writeSolutionToCsvFile(const std::string &file, const Solution &s, const PrecalculatedMapping &mapper)
It writes the solution to a csv file, the header is 'activity id, start time, duration, type, point, power saving mode, movement, energy'.
Definition: Solution.cpp:109
State
Enum declares constants specifying whether a found solution is optimal, feasible, infeasible...
Definition: Solution.h:38
double lowerBound
Lower bound on energy, i.e. there is not a solution consuming less energy than this number...
Definition: Solution.h:59
void writeBriefResultToStream(std::ostream &OUT, const std::string &instanceName, const Solution &s)
It prints the solution as follows: 'instance name (state, runtime s): energy'.
Definition: Solution.cpp:152
The structure contains the maps for fast searching in the robotic cell.
std::map< uint32_t, std::pair< double, double > > startTimeAndDuration
Mapping of the activity identification to its start time and duration.
Definition: Solution.h:65