Loading...
Searching...
No Matches
SRP_Instance.h
1//
2// Created by henri on 12.07.23.
3//
4
5#ifndef IDOL_SRP_INSTANCE_H
6#define IDOL_SRP_INSTANCE_H
7
8#include <vector>
9#include <ostream>
10
11namespace idol::Problems::SRP {
12
13 class Instance;
14
15 Instance generate_random_instance_Zhao_et_al_2012(unsigned int t_n_regular_staff, unsigned int t_n_part_time_staff, unsigned int t_n_time_periods);
16 Instance read_instance_from_file(const std::string& t_path_to_file);
17
18 std::ostream &operator<<(std::ostream &t_os, const Instance& t_instance);
19}
20
22 const unsigned int m_n_regular_staff;
23 const unsigned int m_n_part_time_staff;
24 const unsigned int m_n_time_periods;
25
26 unsigned int m_regular_staff_shift_duration = 0;
27 std::vector<std::vector<double>> m_regular_staff_fixed_wage_cost;
28 std::vector<double> m_regular_staff_minimum_number_of_shifts;
29 std::vector<double> m_regular_staff_maximum_number_of_shifts;
30 std::vector<std::vector<double>> m_part_time_staff_fixed_wage_cost;
31 std::vector<std::vector<double>> m_part_time_staff_hourly_wage_cost;
32 std::vector<double> m_part_time_staff_minimum_number_of_shifts;
33 std::vector<double> m_part_time_staff_maximum_number_of_shifts;
34 std::vector<double> m_unmet_demand_penalty_cost;
35 std::vector<double> m_demand;
36public:
37 Instance(unsigned int t_n_regular_staff, unsigned int t_n_part_time_staff, unsigned int t_n_time_periods);
38
39 [[nodiscard]] unsigned int n_regular_staff() const { return m_n_regular_staff; }
40
41 [[nodiscard]] unsigned int n_part_time_staff() const { return m_n_part_time_staff; }
42
43 [[nodiscard]] unsigned int n_time_periods() const { return m_n_time_periods; }
44
45 [[nodiscard]] unsigned int shift_duration() const { return m_regular_staff_shift_duration; }
46
47 [[nodiscard]] double regular_staff_fixed_wage_cost(unsigned int t_staff_index, unsigned int t_time_index) const {
48 return m_regular_staff_fixed_wage_cost.at(t_staff_index).at(t_time_index);
49 }
50
51 [[nodiscard]] double regular_staff_minimum_number_of_shifts(unsigned int t_staff_index) const {
52 return m_regular_staff_minimum_number_of_shifts.at(t_staff_index);
53 }
54
55 [[nodiscard]] double regular_staff_maximum_number_of_shifts(unsigned int t_staff_index) const {
56 return m_regular_staff_maximum_number_of_shifts.at(t_staff_index);
57 }
58
59 [[nodiscard]] double part_time_fixed_wage_cost(unsigned int t_staff_index, unsigned int t_time_index) const {
60 return m_part_time_staff_fixed_wage_cost.at(t_staff_index).at(t_time_index);
61 }
62
63 [[nodiscard]] double part_time_staff_hourly_wage_cost(unsigned int t_staff_index, unsigned int t_time_index) const {
64 return m_part_time_staff_hourly_wage_cost.at(t_staff_index).at(t_time_index);
65 }
66
67 [[nodiscard]] double part_time_staff_minimum_number_of_shifts(unsigned int t_staff_index) const {
68 return m_part_time_staff_minimum_number_of_shifts.at(t_staff_index);
69 }
70
71 [[nodiscard]] double part_time_staff_maximum_number_of_shifts(unsigned int t_staff_index) const {
72 return m_part_time_staff_maximum_number_of_shifts.at(t_staff_index);
73 }
74
75 [[nodiscard]] double unmet_demand_penalty_cost(unsigned int t_time_index) const {
76 return m_unmet_demand_penalty_cost.at(t_time_index);
77 }
78
79 [[nodiscard]] double demand(unsigned int t_time_index) const {
80 return m_demand.at(t_time_index);
81 }
82
83 void set_regular_staff_shift_duration(unsigned int t_value) {
84 m_regular_staff_shift_duration = t_value;
85 }
86
87 void set_regular_staff_fixed_wage_cost(unsigned int t_staff_index, unsigned int t_time_index, double t_value) {
88 m_regular_staff_fixed_wage_cost.at(t_staff_index).at(t_time_index) = t_value;
89 }
90
91 void set_regular_staff_minimum_number_of_shifts(unsigned int t_staff_index, double t_value) {
92 m_regular_staff_minimum_number_of_shifts.at(t_staff_index) = t_value;
93 }
94
95 void set_regular_staff_maximum_number_of_shifts(unsigned int t_staff_index, double t_value) {
96 m_regular_staff_maximum_number_of_shifts.at(t_staff_index) = t_value;
97 }
98
99 void set_part_time_fixed_wage_cost(unsigned int t_staff_index, unsigned int t_time_index, double t_value) {
100 m_part_time_staff_fixed_wage_cost.at(t_staff_index).at(t_time_index) = t_value;
101 }
102
103 void set_part_time_staff_hourly_wage_cost(unsigned int t_staff_index, unsigned int t_time_index, double t_value) {
104 m_part_time_staff_hourly_wage_cost.at(t_staff_index).at(t_time_index) = t_value;
105 }
106
107 void set_part_time_staff_minimum_number_of_shifts(unsigned int t_staff_index, double t_value) {
108 m_part_time_staff_minimum_number_of_shifts.at(t_staff_index) = t_value;
109 }
110
111 void set_part_time_staff_maximum_number_of_shifts(unsigned int t_staff_index, double t_value) {
112 m_part_time_staff_maximum_number_of_shifts.at(t_staff_index) = t_value;
113 }
114
115 void set_unmet_demand_penalty_cost(unsigned int t_index_index, double t_value) {
116 m_unmet_demand_penalty_cost.at(t_index_index) = t_value;
117 }
118
119 void set_demand(unsigned int t_time_index, double t_value) {
120 m_demand.at(t_time_index) = t_value;
121 }
122
123 friend std::ostream & operator<<(std::ostream&, const Instance&);
124 friend Instance read_instance_from_file(const std::string&);
125};
126
127
128#endif //IDOL_SRP_INSTANCE_H