MATSIM
TripTimeAllocationMutator.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * TransitTimeAllocationMutator.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2009 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.modules;
22 
23 import com.google.inject.Inject;
24 import org.matsim.core.config.Config;
31 
32 import jakarta.inject.Provider;
33 
41 
42  private final Provider<TripRouter> tripRouterProvider;
43 
44  public final static String CONFIG_GROUP = "TimeAllocationMutator";
45  public final static String CONFIG_MUTATION_RANGE = "mutationRange";
46 
47  private double mutationRange = 1800.0;
48  private boolean useActivityDurations = true;
49  private final boolean affectingDuration;
50 
55  public TripTimeAllocationMutator(Config config, Provider<TripRouter> tripRouterProvider) {
56  super(config.global());
57  this.tripRouterProvider = tripRouterProvider;
58  this.mutationRange = config.timeAllocationMutator().getMutationRange() ;
59  this.affectingDuration = config.timeAllocationMutator().isAffectingDuration() ;
62  useActivityDurations = true ;
63  } else if ( actDurInterpr == PlansConfigGroup.ActivityDurationInterpretation.endTimeOnly ) {
64  useActivityDurations = false ;
66  throw new UnsupportedOperationException( "need to clarify the correct setting here. Probably not a big deal, but not done yet. kai, aug'10") ;
67  } else {
68  throw new IllegalStateException( "beahvior not defined for this configuration setting") ;
69  }
70  }
71 
72  public TripTimeAllocationMutator(Config config, Provider<TripRouter> tripRouterProvider, final double mutationRange, boolean affectingDuration) {
73  super(config.global());
74  this.tripRouterProvider = tripRouterProvider;
75  this.mutationRange = mutationRange;
76  this.affectingDuration = affectingDuration;
77  }
78 
79  @Override
83  this.mutationRange,
84  affectingDuration, MatsimRandom.getLocalInstance());
85  pmta.setUseActivityDurations(this.useActivityDurations);
86  return pmta;
87  }
88 
89 }
TripTimeAllocationMutator(Config config, Provider< TripRouter > tripRouterProvider, final double mutationRange, boolean affectingDuration)
TripTimeAllocationMutator(Config config, Provider< TripRouter > tripRouterProvider)
TimeAllocationMutatorConfigGroup timeAllocationMutator()
Definition: Config.java:464
final PlansConfigGroup plans()
Definition: Config.java:416
final GlobalConfigGroup global()
Definition: Config.java:396
PlansConfigGroup.ActivityDurationInterpretation getActivityDurationInterpretation()