@Override public PlanAlgorithm getPlanAlgoInstance() { TripPlanMutateTimeAllocation pmta = new TripPlanMutateTimeAllocation( tripRouterProvider.get().getStageActivityTypes(), this.mutationRange, affectingDuration, MatsimRandom.getLocalInstance()); pmta.setUseActivityDurations(this.useActivityDurations); return pmta; }
@Override public void run(final Plan plan) { mutatePlan(plan); }
Activity lastAct = (Activity) plan.getPlanElements().listIterator(plan.getPlanElements().size()).previous(); final String subpopulation = this.getSubpopulation(plan); final boolean affectingDuration = this.isAffectingDuration(subpopulation); final double mutationRange = this.getMutationRange(subpopulation); act.setEndTime(mutateTime(act.getEndTime(), mutationRange)); act.setMaximumDuration(mutateTime(act.getMaximumDuration(), mutationRange)); double newEndTime = mutateTime(act.getEndTime(), mutationRange); if (newEndTime < now) { newEndTime = now; throw new IllegalStateException("Can not mutate activity end time because it is not set for Person: " + plan.getPerson().getId()); double newEndTime = mutateTime(act.getEndTime(), mutationRange); if (newEndTime < now) { newEndTime = now;
new TripPlanMutateTimeAllocation( new StageActivityTypesImpl( PtConstants.TRANSIT_ACTIVITY_TYPE ), 3600., affectingDuration, new Random(2011)); mutator.run(plan);
@Override public PlanAlgorithm getPlanAlgoInstance() { PlanAlgorithm pmta; switch (this.activityDurationInterpretation) { case minOfDurationAndEndTime: pmta = new TripPlanMutateTimeAllocation(this.tripRouterProvider.get().getStageActivityTypes(), this.mutationRange, this.affectingDuration, MatsimRandom.getLocalInstance(), this.subpopulationAttribute, this.personAttributes, this.subpopulationMutationRanges, this.subpopulationAffectingDuration); break; default: pmta = new PlanMutateTimeAllocationSimplified( this.tripRouterProvider.get().getStageActivityTypes(), this.mutationRange, this.affectingDuration, MatsimRandom.getLocalInstance()); } return pmta; } }
/** * Tests that the mutation range given in the constructor is respected. * * @author mrieser */ public void testMutationRangeParam() { boolean affectingDuration = true ; runMutationRangeTest(new TripPlanMutateTimeAllocation(new StageActivityTypesImpl(PtConstants.TRANSIT_ACTIVITY_TYPE ), 750, affectingDuration, MatsimRandom.getLocalInstance()), 750); runMutationRangeTest(new TripPlanMutateTimeAllocation(new StageActivityTypesImpl(PtConstants.TRANSIT_ACTIVITY_TYPE ), 7200, affectingDuration, MatsimRandom.getLocalInstance()), 7200); }