21 package org.matsim.core.replanning.selectors;
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.List;
63 protected Map<Plan,Double>
calcWeights(
final List<? extends Plan> plans ) {
66 Map<Plan,Double> weights =
new HashMap<Plan,Double>() ;
68 double maxScore = Double.NEGATIVE_INFINITY;
70 HashMap<Id<Link>, ArrayList<Double>> linksInTime =
new HashMap<>();
73 HashMap<Integer,Double> planLength =
new HashMap<Integer, Double>();
83 for (
Plan plan : plans) {
85 if (plan.getScore() > maxScore) maxScore = plan.getScore();
88 double currentEndTime = 0.0;
90 if (pe instanceof
Leg) {
101 ArrayList<Double> lit = linksInTime.get(linkId);
103 lit =
new ArrayList<Double>();
104 linksInTime.put(linkId, lit);
106 lit.add(currentEndTime);
110 planLength.put(plan.hashCode(), pathSize);
113 for (
Plan plan : plans) {
117 if (pe instanceof
Leg) {
122 double denominator = 0;
123 for (
double dbl : linksInTime.get(linkId)){
128 if (Math.abs(dbl - currentTime) <= 3600)
142 double PSi = Math.pow(tmp/planLength.get(plan.hashCode()), this.pathSizeLogitExponent);
145 if (Double.isInfinite(maxScore)) {
156 weight = Math.exp(this.logitScaleFactor * (plan.getScore() - maxScore))*PSi;
161 if (weight <= 0.0) weight = 0;
165 weights.put( plan, weight) ;
PathSizeLogitSelector(final double pathSizeLogitExponent, final double logitScaleFactor, final Network network)
double getPathSizeLogitBeta()
OptionalTime getDepartureTime()
final double logitScaleFactor
List< Id< Link > > getLinkIds()
Map< Id< Link >, ? extends Link > getLinks()
static double calcDistanceExcludingStartEndLink(final NetworkRoute route, final Network network)
final double pathSizeLogitExponent
Map< Plan, Double > calcWeights(final List<? extends Plan > plans)
PathSizeLogitSelector(final ScoringConfigGroup config, final Network network)