MATSIM
SubtourModeChoice.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * SubtourModeChoice.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2008 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 
30 
50 
51  private final double probaForChangeSingleTripMode;
52  private final double coordDist;
53 
54  public enum Behavior {
60  @Deprecated
62 
69 
73  betweenAllAndFewerConstraints
74  }
75 
77 
79 
80  private final String[] chainBasedModes;
81  private final String[] modes;
82 
83  public SubtourModeChoice(GlobalConfigGroup globalConfigGroup,
84  SubtourModeChoiceConfigGroup subtourModeChoiceConfigGroup, PermissibleModesCalculator permissibleModesCalculator) {
85  this(globalConfigGroup.getNumberOfThreads(),
86  subtourModeChoiceConfigGroup.getModes(),
87  subtourModeChoiceConfigGroup.getChainBasedModes(),
88  subtourModeChoiceConfigGroup.getProbaForRandomSingleTripMode(),
89  permissibleModesCalculator, subtourModeChoiceConfigGroup.getCoordDistance()
90  );
91  this.setBehavior(subtourModeChoiceConfigGroup.getBehavior());
92  }
93 
95  final int numberOfThreads,
96  final String[] modes,
97  final String[] chainBasedModes,
98  double probaForChangeSingleTripMode,
99  PermissibleModesCalculator permissibleModesCalculator,
100  double coordDist) {
101  super(numberOfThreads);
102  this.modes = modes.clone();
103  this.chainBasedModes = chainBasedModes.clone();
104  this.permissibleModesCalculator = permissibleModesCalculator;
105  this.probaForChangeSingleTripMode = probaForChangeSingleTripMode;
106  this.coordDist = coordDist;
107  }
108 
109  @Deprecated // only use when backwards compatibility is needed. kai, may'18
110  public final void setBehavior ( Behavior behavior ) {
111  this.behavior = behavior ;
112  }
113 
114  protected String[] getModes() {
115  return modes.clone();
116  }
117 
118  @Override
120 
121  final ChooseRandomLegModeForSubtour chooseRandomLegMode =
125  this.modes,
126  this.chainBasedModes,
128  return chooseRandomLegMode;
129  }
130 
131 
132 }
SubtourModeChoice(GlobalConfigGroup globalConfigGroup, SubtourModeChoiceConfigGroup subtourModeChoiceConfigGroup, PermissibleModesCalculator permissibleModesCalculator)
static MainModeIdentifier getRoutingModeIdentifier()
final PermissibleModesCalculator permissibleModesCalculator