From d4b7637b07b998153fec78ee6b4fad76061ba627 Mon Sep 17 00:00:00 2001 From: safraeli Date: Thu, 23 May 2019 09:42:59 +0300 Subject: [PATCH] Fix the condition to use bestCost as this is what we are traceing. Added log to debug to state the termination --- .../IterationWithoutImprovementTermination.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/IterationWithoutImprovementTermination.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/IterationWithoutImprovementTermination.java index bacf33e2..aa8092d9 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/IterationWithoutImprovementTermination.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/termination/IterationWithoutImprovementTermination.java @@ -107,7 +107,11 @@ public class IterationWithoutImprovementTermination implements PrematureAlgorith return false; boolean unassignedJobsEqual = (currentJobsUnassigned == unassignedJobsCount.get(i - noIterationWithoutImprovement)); - boolean progressTooSlow = 100 * ((costs.get(i - noIterationWithoutImprovement) - currentCost) / currentCost) <= terminationByCostPercentage; - return (unassignedJobsEqual && progressTooSlow); + boolean progressTooSlow = 100 * ((costs.get(i - noIterationWithoutImprovement) - bestCost) / bestCost) <= terminationByCostPercentage; + if (unassignedJobsEqual && progressTooSlow){ + log.debug("Termination condition by percentage reached: " + this); + return true; + }else + return false; } }