Skip to content

Commit 7163563

Browse files
committed
Merge branch 'fix/geometry-plan-with-single-location'
2 parents 2027415 + 8c384d9 commit 7163563

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

src/routing/wrapper.h

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,22 @@ class Wrapper {
5252
route_locs.reserve(v.steps.size());
5353

5454
bool has_job_steps = false;
55+
56+
if (v.has_start()) {
57+
route_locs.push_back(v.start.value());
58+
}
59+
5560
for (const auto& step : v.steps) {
56-
switch (step.type) {
57-
using enum STEP_TYPE;
58-
case START:
59-
if (v.has_start()) {
60-
route_locs.push_back(v.start.value());
61-
}
62-
break;
63-
case END:
64-
if (v.has_end()) {
65-
route_locs.push_back(v.end.value());
66-
}
67-
break;
68-
case BREAK:
69-
break;
70-
case JOB:
61+
if (step.type == STEP_TYPE::JOB) {
7162
has_job_steps = true;
7263
route_locs.push_back(jobs[step.rank].location);
73-
break;
7464
}
7565
}
7666

67+
if (v.has_end()) {
68+
route_locs.push_back(v.end.value());
69+
}
70+
7771
if (has_job_steps) {
7872
assert(route_locs.size() >= 2);
7973

src/structures/vroom/input/input.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ void Input::set_matrices(unsigned nb_thread, bool sparse_filling) {
10811081
assert(!define_durations || define_distances);
10821082

10831083
if (define_durations || define_distances) {
1084-
if (_locations.size() == 1) {
1084+
if (_locations.size() == 1 && !sparse_filling) {
10851085
durations_m->second = Matrix<UserDuration>(1);
10861086
distances_m->second = Matrix<UserDistance>(1);
10871087
} else {
@@ -1355,6 +1355,7 @@ Solution Input::check(unsigned nb_thread) {
13551355
auto search = route_rank_to_v_rank.find(i);
13561356
assert(search != route_rank_to_v_rank.end());
13571357
const auto v_rank = search->second;
1358+
assert(v_rank < _vehicles_geometry.size());
13581359
route.geometry = std::move(_vehicles_geometry[v_rank]);
13591360
}
13601361

0 commit comments

Comments
 (0)