MATSIM
RaptorStaticConfig.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.* *
3  *
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2023 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 package ch.sbb.matsim.routing.pt.raptor;
21 
27 
28 import java.util.HashMap;
29 import java.util.Map;
30 
39 public class RaptorStaticConfig {
40 
41 
42 
43  public enum RaptorOptimization {
53  OneToAllRouting }
54 
62 
68  Adaptive
69  }
70 
71 
76  private double beelineWalkConnectionDistance = 200.0;
77  private double beelineWalkSpeed; // meter / second
78  private double beelineWalkDistanceFactor = 1.0;
79 
80  private double minimalTransferTime = 60;
81  private double transferWalkMargin = 5;
82 
83  private boolean useModeMappingForPassengers = false;
84  private final Map<String, String> passengerModeMappings = new HashMap<>();
85  private final Map<String, Map<String,Double>> modeToModeTransferPenalties = new HashMap<>();
86 
87  private boolean useCapacityConstraints = false;
88 
91 
93 
96  }
97 
98  public void setBeelineWalkConnectionDistance(double beelineWalkConnectionDistance) {
99  this.beelineWalkConnectionDistance = beelineWalkConnectionDistance;
100  }
101 
102  public double getBeelineWalkSpeed() {
103  return this.beelineWalkSpeed;
104  }
105 
106  public void setBeelineWalkSpeed(double beelineWalkSpeed) {
107  this.beelineWalkSpeed = beelineWalkSpeed;
108  }
109 
111  return this.beelineWalkDistanceFactor;
112  }
113 
114  public void setBeelineWalkDistanceFactor(double beelineWalkDistanceFactor) {
115  this.beelineWalkDistanceFactor = beelineWalkDistanceFactor;
116  }
117 
118  public double getTransferWalkMargin() {
119  return transferWalkMargin;
120  }
121 
122  public void setTransferWalkMargin(double transferWalkMargin) {
123  this.transferWalkMargin = transferWalkMargin;
124  }
125 
126  public double getMinimalTransferTime() {
127  return this.minimalTransferTime;
128  }
129 
130  public void setMinimalTransferTime(double minimalTransferTime) {
131  this.minimalTransferTime = minimalTransferTime;
132  }
133 
134  public boolean isUseModeMappingForPassengers() {
135  return this.useModeMappingForPassengers;
136  }
137 
138  public void setUseModeMappingForPassengers(boolean useModeMappingForPassengers) {
139  this.useModeMappingForPassengers = useModeMappingForPassengers;
140  }
141  public void addModeToModeTransferPenalty(String fromMode, String toMode, double transferPenalty) {
142  this.modeToModeTransferPenalties.computeIfAbsent(fromMode,s->new HashMap<>()).put(toMode,transferPenalty);
143  }
144  public double getModeToModeTransferPenalty(String fromMode, String toMode){
145  var fromModeSet = this.modeToModeTransferPenalties.get(fromMode);
146  if (fromModeSet!=null){
147  return fromModeSet.getOrDefault(toMode,0.0);
148  }
149  else return 0.0;
150  }
151 
153  return !this.modeToModeTransferPenalties.isEmpty();
154  }
155 
156  public boolean isUseCapacityConstraints() {
157  return this.useCapacityConstraints;
158  }
159 
160  public void setUseCapacityConstraints(boolean useCapacityConstraints) {
161  this.useCapacityConstraints = useCapacityConstraints;
162  }
163 
164  public void addModeMappingForPassengers(String routeMode, String passengerMode) {
165  this.passengerModeMappings.put(routeMode, passengerMode);
166  }
167 
168  public String getPassengerMode(String routeMode) {
169  return this.passengerModeMappings.get(routeMode);
170  }
171 
173  return this.optimization;
174  }
175 
176  public void setOptimization(RaptorOptimization optimization) {
177  this.optimization = optimization;
178  }
179 
182  }
183 
186  }
187 
189  return this.transferCalculation;
190  }
191 
192  public void setTransferCalculation(RaptorTransferCalculation transferCalculation) {
193  this.transferCalculation = transferCalculation;
194  }
195 }
void addModeMappingForPassengers(String routeMode, String passengerMode)
SwissRailRaptorConfigGroup.IntermodalLegOnlyHandling intermodalLegOnlyHandling
void setMinimalTransferTime(double minimalTransferTime)
void setBeelineWalkConnectionDistance(double beelineWalkConnectionDistance)
SwissRailRaptorConfigGroup.IntermodalLegOnlyHandling getIntermodalLegOnlyHandling()
void setUseModeMappingForPassengers(boolean useModeMappingForPassengers)
final Map< String, Map< String, Double > > modeToModeTransferPenalties
void setOptimization(RaptorOptimization optimization)
double getModeToModeTransferPenalty(String fromMode, String toMode)
void setBeelineWalkDistanceFactor(double beelineWalkDistanceFactor)
void setIntermodalLegOnlyHandling(SwissRailRaptorConfigGroup.IntermodalLegOnlyHandling intermodalLegOnlyHandling)
void setUseCapacityConstraints(boolean useCapacityConstraints)
void addModeToModeTransferPenalty(String fromMode, String toMode, double transferPenalty)
void setTransferCalculation(RaptorTransferCalculation transferCalculation)