SOLA
Loading...
Searching...
No Matches
metrics.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_CPPS_LOGICAL_TASK_MANAGEMENT_METRICS_H_
18#define DAISI_CPPS_LOGICAL_TASK_MANAGEMENT_METRICS_H_
19
20#include <algorithm>
21#include <functional>
22
23#include "solanet/serializer/serialize.h"
24#include "utils/structure_helpers.h"
25
26namespace daisi::cpps::logical {
27
28class Metrics {
29public:
30 Metrics() = default;
31
32 Metrics(daisi::util::Duration empty_travel_time, daisi::util::Duration loaded_travel_time,
33 daisi::util::Duration action_time, daisi::util::Distance empty_travel_distance,
34 daisi::util::Distance loaded_travel_distance);
35
36 void setMakespan(const daisi::util::Duration &makespan);
37
38 bool isStartTimeSet() const;
39 void setStartTime(const daisi::util::Duration &start_time);
40
41 bool isExecutionStartTimeSet() const;
42 void setExecutionStartTime(const daisi::util::Duration &start_time);
43
44 daisi::util::Duration getMakespan() const;
45
46 daisi::util::Duration getTime() const;
47
48 daisi::util::Duration getExecutionTime() const;
49
50 daisi::util::Distance getDistance() const;
51
52 Metrics operator-(const Metrics &other) const;
53
54 Metrics operator+(const Metrics &other) const;
55
56 friend bool operator<(const Metrics &lhs, const Metrics &rhs);
57 friend bool operator<=(const Metrics &lhs, const Metrics &rhs);
58 friend bool operator>(const Metrics &lhs, const Metrics &rhs);
59 friend bool operator>=(const Metrics &lhs, const Metrics &rhs);
60 friend bool operator==(const Metrics &lhs, const Metrics &rhs);
61 friend bool operator!=(const Metrics &lhs, const Metrics &rhs);
62
63 static std::function<double(const Metrics &)> utility_function_;
64
65 daisi::util::Duration empty_travel_time = 0.0;
66 daisi::util::Duration loaded_travel_time = 0.0;
67 daisi::util::Duration action_time = 0.0;
68 daisi::util::Distance empty_travel_distance = 0.0;
69 daisi::util::Distance loaded_travel_distance = 0.0;
70
71 util::Duration start_up_time = 0.0;
72
73 SERIALIZE(empty_travel_time, loaded_travel_time, action_time, empty_travel_distance,
74 loaded_travel_distance, makespan_, start_time_, execution_start_time_, start_time_set_,
75 execution_start_time_set_, start_up_time);
76
77private:
78 daisi::util::Duration makespan_ = 0.0;
79
80 daisi::util::Duration start_time_ = 0.0;
81 bool start_time_set_ = false;
82
83 daisi::util::Duration execution_start_time_ = 0.0;
84 bool execution_start_time_set_ = false;
85};
86
87} // namespace daisi::cpps::logical
88
89#endif
Definition metrics.h:28
Modified Round Robin Algorithm that centrally assigns tasks of incoming material flows to the corresp...
Definition algorithm_config.h:22