MATSIM
TimeAllocationMutatorModule.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * TimeAllocationMutator.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2007 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 
21 package org.matsim.core.replanning.strategies;
22 
23 import org.apache.logging.log4j.LogManager;
24 import org.apache.logging.log4j.Logger;
32 
41 class TimeAllocationMutatorModule extends AbstractMultithreadedModule{
42 
43 
44  private static final Logger log = LogManager.getLogger( TimeAllocationMutatorModule.class );
45  private final double mutationRange;
46  private final boolean affectingDuration;
47  private final TimeAllocationMutatorConfigGroup timeAllocationMutatorConfigGroup;
48 
49 
50  TimeAllocationMutatorModule( TimeAllocationMutatorConfigGroup timeAllocationMutatorConfigGroup, GlobalConfigGroup globalConfigGroup) {
51  super(globalConfigGroup);
52  this.mutationRange = timeAllocationMutatorConfigGroup.getMutationRange();
53  this.affectingDuration = timeAllocationMutatorConfigGroup.isAffectingDuration();
54  this.timeAllocationMutatorConfigGroup = timeAllocationMutatorConfigGroup;
55 
56  }
57 
58  @Override
59  public PlanAlgorithm getPlanAlgoInstance() {
60  PlanAlgorithm pmta = new MutateActivityTimeAllocation
61  (this.mutationRange, this.affectingDuration, MatsimRandom.getLocalInstance(),
62  timeAllocationMutatorConfigGroup.getLatestActivityEndTime(), timeAllocationMutatorConfigGroup.isMutateAroundInitialEndTimeOnly(),
63  timeAllocationMutatorConfigGroup.getMutationRangeStep());
64  return pmta;
65  }
66 }