@@ -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-
10031Priority priority_sum_for_route (const Input& input,
10132 const std::vector<Index>& route) {
10233 return std::accumulate (route.begin (),
0 commit comments