Skip to content

Commit

Permalink
Adjust SolutionIndicators comparison operators to account for hash va…
Browse files Browse the repository at this point in the history
…lue.
  • Loading branch information
jcoupey committed Dec 12, 2024
1 parent 85212f9 commit e5f2320
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
- Crash when input is valid JSON but not an object (#1172)
- Capacity array check consistency (#1086)
- Segfault when using the C++ API with empty vehicles (#1187)
- Solution "shadowing" when only comparing indicators (#1199)

#### Internals

Expand Down
32 changes: 18 additions & 14 deletions src/structures/vroom/solution_indicators.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,32 @@ struct SolutionIndicators {
lhs.eval.cost,
lhs.used_vehicles,
lhs.eval.duration,
lhs.eval.distance) < std::tie(lhs.priority_sum,
lhs.assigned,
rhs.eval.cost,
rhs.used_vehicles,
rhs.eval.duration,
rhs.eval.distance);
lhs.eval.distance,
lhs.routes_hash) < std::tie(lhs.priority_sum,
lhs.assigned,
rhs.eval.cost,
rhs.used_vehicles,
rhs.eval.duration,
rhs.eval.distance,
rhs.routes_hash);
}

#ifdef LOG_LS
friend bool operator==(const SolutionIndicators& lhs,
const SolutionIndicators& rhs) {
return std::tie(rhs.priority_sum,
rhs.assigned,
return std::tie(lhs.priority_sum,
lhs.assigned,
lhs.eval.cost,
lhs.used_vehicles,
lhs.eval.duration,
lhs.eval.distance) == std::tie(lhs.priority_sum,
lhs.assigned,
rhs.eval.cost,
rhs.used_vehicles,
rhs.eval.duration,
rhs.eval.distance);
lhs.eval.distance,
lhs.routes_hash) == std::tie(rhs.priority_sum,
rhs.assigned,
rhs.eval.cost,
rhs.used_vehicles,
rhs.eval.duration,
rhs.eval.distance,
rhs.routes_hash);
}
#endif
};
Expand Down

0 comments on commit e5f2320

Please sign in to comment.