@Override public boolean doReplanning(MobsimAgent withinDayAgent) { random.setSeed( Integer.parseInt(withinDayAgent.getId().toString()) * this.controler.getIterationNumber()); Plan executedPlan = WithinDayAgentUtils.getModifiablePlan(withinDayAgent); // If we don't have an executed plan if (executedPlan == null) return false; PlanElement currentPlanElement = WithinDayAgentUtils.getCurrentPlanElement(withinDayAgent); if (!(currentPlanElement instanceof Leg)) return false; Leg currentLeg = (Leg) currentPlanElement; int currentLinkIndex = WithinDayAgentUtils.getCurrentRouteLinkIdIndex(withinDayAgent); // new Route for current Leg this.microRouteCurrentLegRoute( currentLeg, executedPlan.getPerson(), currentLinkIndex, this.time, scenario.getNetwork(), tripRouter, random, executedPlan); // Finally reset the cached Values of the PersonAgent - they may have changed! WithinDayAgentUtils.resetCaches(withinDayAgent); return true; }