Skip to content

Commit 19aff96

Browse files
committed
Get rid of more debug boilerplate and helpers.
1 parent e1bfae7 commit 19aff96

2 files changed

Lines changed: 0 additions & 75 deletions

File tree

src/utils/helpers.cpp

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -28,75 +28,6 @@ Amount max_amount(std::size_t size) {
2828
return max;
2929
}
3030

31-
INIT get_init(std::string_view s) {
32-
using enum INIT;
33-
if (s == "NONE") {
34-
return NONE;
35-
}
36-
if (s == "HIGHER_AMOUNT") {
37-
return HIGHER_AMOUNT;
38-
}
39-
if (s == "NEAREST") {
40-
return NEAREST;
41-
}
42-
if (s == "FURTHEST") {
43-
return FURTHEST;
44-
}
45-
if (s == "EARLIEST_DEADLINE") {
46-
return EARLIEST_DEADLINE;
47-
}
48-
throw InputException("Invalid heuristic parameter in command-line.");
49-
}
50-
51-
SORT get_sort(std::string_view s) {
52-
if (s == "AVAILABILITY") {
53-
return SORT::AVAILABILITY;
54-
}
55-
if (s == "COST") {
56-
return SORT::COST;
57-
}
58-
throw InputException("Invalid heuristic parameter in command-line.");
59-
}
60-
61-
HeuristicParameters str_to_heuristic_param(const std::string& s) {
62-
// Split command-line string describing parameters.
63-
constexpr char delimiter = ';';
64-
std::vector<std::string> tokens;
65-
tokens.reserve(4);
66-
std::string token;
67-
std::istringstream tokenStream(s);
68-
while (std::getline(tokenStream, token, delimiter)) {
69-
tokens.push_back(token);
70-
}
71-
72-
if ((tokens.size() != 3 && tokens.size() != 4) || tokens[0].size() != 1) {
73-
throw InputException("Invalid heuristic parameter in command-line.");
74-
}
75-
76-
auto init = get_init(tokens[1]);
77-
auto sort = (tokens.size() == 3) ? SORT::AVAILABILITY : get_sort(tokens[3]);
78-
79-
try {
80-
auto h = std::stoul(tokens[0]);
81-
82-
if (h != 0 && h != 1) {
83-
throw InputException("Invalid heuristic parameter in command-line.");
84-
}
85-
86-
auto regret_coeff = std::stof(tokens[2]);
87-
if (regret_coeff < 0) {
88-
throw InputException("Invalid heuristic parameter in command-line.");
89-
}
90-
91-
return HeuristicParameters(static_cast<HEURISTIC>(h),
92-
init,
93-
regret_coeff,
94-
sort);
95-
} catch (const std::exception&) {
96-
throw InputException("Invalid heuristic parameter in command-line.");
97-
}
98-
}
99-
10031
Priority priority_sum_for_route(const Input& input,
10132
const std::vector<Index>& route) {
10233
return std::accumulate(route.begin(),

src/utils/helpers.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ inline unsigned get_nb_searches(unsigned exploration_level) {
7070
return nb_searches;
7171
}
7272

73-
INIT get_init(std::string_view s);
74-
75-
SORT get_sort(std::string_view s);
76-
77-
HeuristicParameters str_to_heuristic_param(const std::string& s);
78-
7973
// Evaluate adding job with rank job_rank in given route at given rank
8074
// for vehicle v.
8175
inline Eval addition_eval(const Input& input,

0 commit comments

Comments
 (0)