Skip to content

Commit

Permalink
Account for compatibility in vehicles/jobs evals, also related to #671.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoupey committed Sep 6, 2023
1 parent c91574b commit ce2d998
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/structures/vroom/eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ struct Eval {
}
};

constexpr Eval MAX_EVAL = {std::numeric_limits<Cost>::max(),
std::numeric_limits<Duration>::max()};
constexpr Eval NO_EVAL = {std::numeric_limits<Cost>::max(), 0};
constexpr Eval NO_GAIN = {std::numeric_limits<Cost>::min(), 0};

Expand Down
8 changes: 7 additions & 1 deletion src/structures/vroom/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,8 @@ void Input::set_jobs_vehicles_evals() {
// in an empty route from vehicle at rank v.
_jobs_vehicles_evals =
std::vector<std::vector<Eval>>(jobs.size(),
std::vector<Eval>(vehicles.size()));
std::vector<Eval>(vehicles.size(),
MAX_EVAL));

for (std::size_t j = 0; j < jobs.size(); ++j) {
Index j_index = jobs[j].index();
Expand All @@ -733,6 +734,11 @@ void Input::set_jobs_vehicles_evals() {

for (std::size_t v = 0; v < vehicles.size(); ++v) {
const auto& vehicle = vehicles[v];

if (!vehicle_ok_with_job(v, j)) {
continue;
}

auto& current_eval = _jobs_vehicles_evals[j][v];

current_eval = is_pickup ? vehicle.eval(j_index, last_job_index) : Eval();
Expand Down

0 comments on commit ce2d998

Please sign in to comment.