21 package org.matsim.core.router.costcalculators;
23 import org.apache.logging.log4j.LogManager;
24 import org.apache.logging.log4j.Logger;
30 import java.util.Collections;
32 import java.util.concurrent.atomic.AtomicInteger;
48 private static final AtomicInteger
wrnCnt =
new AtomicInteger(0);
60 this.cnScoringGroup = config.
scoring();
73 if ( params == null ) {
74 throw new NullPointerException( mode+
" is not part of the valid mode parameters "+cnScoringGroup.
getModes().keySet() );
78 final double marginalCostOfTime_s = (-params.getMarginalUtilityOfTraveling() / 3600.0) + (cnScoringGroup.
getPerforming_utils_hr() / 3600.0);
80 - params.getMarginalUtilityOfDistance() ;
82 double normalization = 1;
84 normalization = 1. / Math.exp(this.sigma * this.sigma / 2);
85 if (normalisationWrnCnt.getAndIncrement() < 10) {
86 log.info(
" sigma: " + this.sigma +
"; resulting normalization: " + normalization);
90 return new RandomizingTimeDistanceTravelDisutility(
93 marginalCostOfDistance_m,
99 if ( wrnCnt.getAndIncrement() < 1 ) {
100 if ( cnScoringGroup.
getModes().get( mode ).getMonetaryDistanceRate() > 0. ) {
101 log.warn(
"Monetary distance cost rate needs to be NEGATIVE to produce the normal " +
102 "behavior; just found positive. Continuing anyway.") ;
105 final Set<String> monoSubpopKeyset = Collections.singleton( null );
107 log.warn(
"Scoring parameters are defined for different subpopulations." +
108 " The routing disutility will only consider the ones of the default subpopulation.");
109 log.warn(
"This warning can safely be ignored if disutility of traveling only depends on travel time.");
112 if ( cnScoringGroup.
getModes().get( mode ).getMonetaryDistanceRate() == 0. && this.sigma != 0. ) {
113 log.warn(
"There will be no routing randomness. The randomization of the travel disutility requires the monetary distance rate " 114 +
"to be different than zero. Continuing anyway.") ;
117 if ( (cnScoringGroup.
getModes().get( mode ).getMarginalUtilityOfTraveling() + cnScoringGroup.
getPerforming_utils_hr()) == 0. && this.sigma != 0. ) {
118 log.warn(
"There will be no routing randomness. The randomization of the travel disutility requires the travel time cost rate " 119 +
"to be different than zero. Continuing anyway.") ;
double getPerforming_utils_hr()
Map< String, ModeParams > getModes()
final ScoringConfigGroup cnScoringGroup
double getMarginalUtilityOfMoney()
RandomizingTimeDistanceTravelDisutilityFactory(final String mode, Config config)
final ScoringConfigGroup scoring()
double getRoutingRandomness()
void logWarningsIfNecessary(final ScoringConfigGroup cnScoringGroup)
static final AtomicInteger normalisationWrnCnt
RoutingConfigGroup routing()
static final AtomicInteger wrnCnt
TravelDisutility createTravelDisutility(final TravelTime travelTime)
Map< String, ScoringParameterSet > getScoringParametersPerSubpopulation()