From d7b4122e10c7df4b7d3aabce0be7a721f187bcc5 Mon Sep 17 00:00:00 2001 From: oblonski Date: Mon, 30 Jan 2017 20:05:49 +0100 Subject: [PATCH] account for more prio levels in scorer and obj function --- .../com/graphhopper/jsprit/core/algorithm/box/Jsprit.java | 2 +- .../graphhopper/jsprit/core/algorithm/recreate/Scorer.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/Jsprit.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/Jsprit.java index 3ad56495..472bb792 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/Jsprit.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/Jsprit.java @@ -720,7 +720,7 @@ public class Jsprit { } } for(Job j : solution.getUnassignedJobs()){ - costs += maxCosts * 2 * (4 - j.getPriority()); + costs += maxCosts * 2 * (11 - j.getPriority()); } return costs; } diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/Scorer.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/Scorer.java index 6aabb134..a6607d26 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/Scorer.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/Scorer.java @@ -33,9 +33,9 @@ class Scorer { if (secondBest == null) { //either there is only one vehicle or there are more vehicles, but they cannot load unassignedJob //if only one vehicle, I want the job to be inserted with min iCosts //if there are more vehicles, I want this job to be prioritized since there are no alternatives - score = (4 - unassignedJob.getPriority()) * (Integer.MAX_VALUE - best.getInsertionCost()) + scoringFunction.score(best, unassignedJob); + score = (11 - unassignedJob.getPriority()) * (Integer.MAX_VALUE - best.getInsertionCost()) + scoringFunction.score(best, unassignedJob); } else { - score = (4 - unassignedJob.getPriority()) * (secondBest.getInsertionCost() - best.getInsertionCost()) + scoringFunction.score(best, unassignedJob); + score = (11 - unassignedJob.getPriority()) * (secondBest.getInsertionCost() - best.getInsertionCost()) + scoringFunction.score(best, unassignedJob); } return score; }