@Override public Map<String, Object> getCustomAttributes() { return delegate.getCustomAttributes(); }
@Override public Map<String, Object> getCustomAttributes() { return this.delegate.getCustomAttributes(); }
private PlanBuilder<Measurement> getPlanStepFactoryForPlan(final Plan selectedPlan) { @SuppressWarnings("unchecked") PlanBuilder<Measurement> planStepFactory = (PlanBuilder<Measurement>) selectedPlan.getCustomAttributes().get(STR_PLANSTEPFACTORY); Integer factoryIteration = (Integer) selectedPlan.getCustomAttributes().get(STR_ITERATION); if (planStepFactory == null || factoryIteration == null || factoryIteration != this.iteration) { // attach the iteration number to the plan: selectedPlan.getCustomAttributes().put(STR_ITERATION, this.iteration); // construct a new PlanBulder and attach it to the plan: planStepFactory = new PlanBuilder<Measurement>(); selectedPlan.getCustomAttributes().put(STR_PLANSTEPFACTORY, planStepFactory); // memorize the plan as being seen: this.plansEverSeen.add(selectedPlan); } return planStepFactory; }
private PlanBuilder<Link> getPlanStepFactoryForPlan(final Plan selectedPlan) { PlanBuilder<Link> planStepFactory = null; planStepFactory = (PlanBuilder<Link>) selectedPlan.getCustomAttributes().get(STR_PLANSTEPFACTORY); Integer factoryIteration = (Integer) selectedPlan.getCustomAttributes().get(STR_ITERATION); if (planStepFactory == null || factoryIteration == null || factoryIteration != this.iteration) { // attach the iteration number to the plan: selectedPlan.getCustomAttributes().put(STR_ITERATION, this.iteration); // construct a new PlanBulder and attach it to the plan: planStepFactory = new PlanBuilder<Link>(); selectedPlan.getCustomAttributes().put(STR_PLANSTEPFACTORY, planStepFactory); // memorize the plan as being seen: this.plansEverSeen.add(selectedPlan); } return planStepFactory; }
private PlanBuilder<TransitStopFacility> getPlanStepFactoryForPlan(final Plan selectedPlan) { PlanBuilder<TransitStopFacility> planStepFactory = null; planStepFactory = (PlanBuilder<TransitStopFacility>) selectedPlan.getCustomAttributes().get(STR_PLANSTEPFACTORY); Integer factoryIteration = (Integer) selectedPlan.getCustomAttributes().get(STR_ITERATION); if (planStepFactory == null || factoryIteration == null || factoryIteration != this.iteration) { // attach the iteration number to the plan: selectedPlan.getCustomAttributes().put(STR_ITERATION, this.iteration); // construct a new PlanBulder and attach it to the plan: planStepFactory = new PlanBuilder<>(); selectedPlan.getCustomAttributes().put(STR_PLANSTEPFACTORY, planStepFactory); // memorize the plan as being seen: this.plansEverSeen.add(selectedPlan); } return planStepFactory; }
@Override public final cadyts.demand.Plan<T> getCadytsPlan(final Plan plan) { @SuppressWarnings("unchecked") // getting stuff from custom attributes has to be untyped. PlanBuilder<T> planStepFactory = (PlanBuilder<T>) plan.getCustomAttributes().get(STR_PLANSTEPFACTORY); if (planStepFactory == null) { this.plansNotFound++; return null; } this.plansFound++; final cadyts.demand.Plan<T> planSteps = planStepFactory.getResult(); return planSteps; }
@Override public final cadyts.demand.Plan<Measurement> getCadytsPlan(final Plan plan) { @SuppressWarnings("unchecked") PlanBuilder<Measurement> planStepFactory = (PlanBuilder<Measurement>) plan.getCustomAttributes().get(STR_PLANSTEPFACTORY); if (planStepFactory == null) { this.plansNotFound++; return null; } this.plansFound++; final cadyts.demand.Plan<Measurement> planSteps = planStepFactory.getResult(); return planSteps; }
@Override public final cadyts.demand.Plan<Link> getCadytsPlan(final Plan plan) { @SuppressWarnings("unchecked") PlanBuilder<Link> planStepFactory = (PlanBuilder<Link>) plan.getCustomAttributes().get(STR_PLANSTEPFACTORY); if (planStepFactory == null) { this.plansNotFound++; return null; } this.plansFound++; final cadyts.demand.Plan<Link> planSteps = planStepFactory.getResult(); return planSteps; }
@Override public void reset(final int it) { this.iteration = it; log.warn("found " + this.plansFound + " out of " + (this.plansFound + this.plansNotFound) + " (" + (100. * this.plansFound / (this.plansFound + this.plansNotFound)) + "%)"); log.warn("(above values may both be at zero for a couple of iterations if multiple plans per agent all have no score)"); long nPlans = 0 ; long nMemorizedPlans = 0 ; for ( Person person : this.sc.getPopulation().getPersons().values() ) { for ( Plan plan : person.getPlans() ) { nPlans ++ ; @SuppressWarnings("unchecked") // getting stuff from custom attributes has to be untyped. PlanBuilder<T> planStepFactory = (PlanBuilder<T>) plan.getCustomAttributes().get(STR_PLANSTEPFACTORY); if ( planStepFactory!=null ) { nMemorizedPlans ++ ; } } } log.warn( "nPlans=" + nPlans + ", nMemorizedPlans=" + nMemorizedPlans ); this.personsFromVehId.clear(); this.transitDrivers.clear(); this.transitVehicles.clear(); }
double otherScore = otherPlan.getScore() + cadytsWeight * otherPlanCadytsCorrection; Map<String,Object> planAttributes = currentPlan.getCustomAttributes() ; planAttributes.put(CadytsPlanChanger.CADYTS_CORRECTION,currentPlanCadytsCorrection) ; Map<String,Object> planAttributesOther = otherPlan.getCustomAttributes() ; planAttributesOther.put(CadytsPlanChanger.CADYTS_CORRECTION,otherPlanCadytsCorrection) ;
@Override public void notifyIterationEnds(final IterationEndsEvent event) { this.experiencedPlansService.finishIteration(); // (currently sets scores to experienced plans) if(planCalcScoreConfigGroup.isWriteExperiencedPlans()) { final int writePlansInterval = controlerConfigGroup.getWritePlansInterval(); if (writePlansInterval > 0 && event.getIteration() % writePlansInterval == 0) { this.experiencedPlansService.writeExperiencedPlans(controlerIO.getIterationFilename(event.getIteration(), "experienced_plans.xml.gz")); this.scoringFunctionsForPopulation.writePartialScores(controlerIO.getIterationFilename(event.getIteration(), "experienced_plans_scores.txt.gz")); } } if (planCalcScoreConfigGroup.isMemorizingExperiencedPlans() ) { for ( Person person : this.population.getPersons().values() ) { Plan experiencedPlan = this.experiencedPlansService.getExperiencedPlans().get( person.getId() ) ; if ( experiencedPlan==null ) { throw new RuntimeException("experienced plan is null; I don't think this should happen") ; } Plan selectedPlan = person.getSelectedPlan() ; selectedPlan.getCustomAttributes().put(PlanCalcScoreConfigGroup.EXPERIENCED_PLAN_KEY, experiencedPlan ) ; } } }