21 package org.matsim.core.config.consistency;
23 import org.apache.logging.log4j.Level;
24 import org.apache.logging.log4j.LogManager;
25 import org.apache.logging.log4j.Logger;
40 import java.util.Collection;
62 log.info(
"NOT running vsp config consistency check because vsp defaults checking level is set to IGNORE" );
65 case info -> lvl = Level.INFO;
66 case warn -> lvl = Level.WARN;
67 case abort -> lvl = Level.WARN;
70 log.info(
"running checkConsistency ...");
72 boolean problem = false ;
118 boolean containsModeChoice = false ;
120 if ( settings.getStrategyName().contains(
"Mode") ) {
121 containsModeChoice = true ;
128 && containsModeChoice
132 log.log( lvl,
"You can't use more than one main (=vehicular) mode while using the agent ID as missing vehicle ID ... " 133 +
"because in this case the person can only have one vehicle and thus cannot switch to a different vehicle type." ) ;
139 String str =
"found a situation that leads to vsp-abort. aborting ..." ;
164 log.log( lvl,
"you are insisting on config v1. vsp default is using v2." ) ;
172 log.log( lvl,
"travelTimeCalculator is not analyzing different modes separately; vsp default is to do that. Otherwise, you are using the same travel times " +
173 "for, say, bike and car.") ;
177 boolean found = false ;
180 if ( settings.getStrategyName().equalsIgnoreCase(
"ChangeExpBeta") ) {
187 log.log( lvl,
"You have no strategy configured that uses ChangeExpBeta. vsp default is to use ChangeExpBeta at least in one strategy." );
194 log.log( lvl,
"You have not set fractionOfIterationsToDisableInnovation; vsp default is to set this to 0.8 or similar. Add the following config lines:" ) ;
195 log.log( lvl,
"<module name=\"strategy\">" );
196 log.log( lvl,
" <param name=\"fractionOfIterationsToDisableInnovation\" value=\"0.8\" />" );
197 log.log( lvl,
"</module>" );
201 boolean usingTimeMutator = false ;
204 usingTimeMutator = true ;
208 if ( usingTimeMutator ) {
213 log.log( lvl,
"timeAllocationMutator mutationRange < 7200; vsp default is 7200. This means you have to add the following lines to your config file: " ) ;
214 log.log( lvl,
"<module name=\"TimeAllocationMutator\">" );
215 log.log( lvl,
" <param name=\"mutationRange\" value=\"7200.0\" />" );
216 log.log( lvl,
"</module>" );
222 log.log( lvl,
"timeAllocationMutator is affecting duration; vsp default is to not do that. This will be more strictly" +
223 " enforced in the future. This means you have to add the following lines to your config file: ") ;
224 log.log( lvl,
"<module name=\"TimeAllocationMutator\">" );
225 log.log( lvl,
" <param name=\"affectingDuration\" value=\"false\" />" );
226 log.log( lvl,
"</module>" );
231 boolean usingSMC = false ;
242 log.log( lvl,
"SubTourModeChoice 'probaForRandomSingleTripMode' is very small and below 0.2. Recommendation is, to set this to a value around 0.5." );
250 log.log( lvl,
"found qsim.vehiclesSource=defaultVehicle; vsp should use one of the other settings or talk to kai");
253 log.log( lvl,
"found qsim.linkDynamics=" + config.
qsim().
getLinkDynamics() +
"; vsp should use PassingQ or talk to kai");
258 log.log( lvl,
"found qsim.usePersonIdForMissingVehicleId==true; vsp should set this to false or talk to kai" ) ;
263 log.log( lvl,
"found `qsim.usingTravelTimeCheckInTeleporation==false'; vsp should try out `true' and report." ) ;
276 log.log( lvl,
" found 'qsim.trafficDynamics==" + config.
qsim().
getTrafficDynamics() +
"'; vsp standard is`" 284 log.log( lvl,
"found that the qsim is removing stuck vehicles. vsp default is setting this to false." );
296 log.log( lvl,
"You are not removing unnecessary plan attributes; vsp default is to do that." ) ;
309 "conjunction with the matsim transit module. This is not working at all as pt interaction activities never have an end time and " +
310 "thus will never end!");
320 "This means you have to add the following lines into the vspExperimental section of your config file: ") ;
322 log.log( lvl,
"Please report if this causes odd results (this will simplify many code maintenance issues, but is unfortunately not well tested)." ) ;
331 log.log( lvl,
"You are using a brainExpBeta != 1; vsp default is 1. (Different values may cause conceptual " +
332 "problems during paper writing.) This means you have to add the following lines to your config file: ") ;
333 log.log( lvl,
"<module name=\"planCalcScore\">" );
334 log.log( lvl,
" <param name=\"BrainExpBeta\" value=\"1.0\" />" );
335 log.log( lvl,
"</module>" );
342 log.log( lvl,
"found marginal utility of waiting != 0. vsp default is setting this to 0. " ) ;
351 switch( params.getTypicalDurationScoreComputation() ) {
356 log.log( lvl,
"found `typicalDurationScoreComputation == uniform' for activity type " + params.getActivityType() +
"; vsp should use `relative'. " ) ;
363 if ( params.getMonetaryDistanceRate() > 0. ) {
366 log.error(
"found monetary distance rate for mode " + params.getMode() +
" > 0. You probably want a value < 0 here.\n" ) ;
368 if ( params.getMonetaryDistanceRate() < -0.01 ) {
370 log.error(
"found monetary distance rate for mode " + params.getMode() +
" < -0.01. -0.01 per meter means -10 per km. You probably want to divide your value by 1000." ) ;
381 log.error(
"found monetary distance rate pt > 0. You probably want a value < 0 here." ) ;
386 log.error(
"found marginal utility of money < 0. You almost certainly want a value > 0 here. " ) ;
391 log.log( lvl,
"found `PlansCalcRouteConfigGroup.AccessEgressType.none'; vsp should use `accessEgressModeToLink' or " +
392 "some other value or talk to Kai." ) ;
398 log.log( lvl,
"You are not setting fractionOfIterationsToStartScoreMSA; vsp default is to set this to something like 0.8. " +
399 "This means you have to add the following lines to your config file: ") ;
400 log.log( lvl,
"<module name=\"planCalcScore\">" );
401 log.log( lvl,
" <param name=\"fractionOfIterationsToStartScoreMSA\" value=\"0.8\" />" );
402 log.log( lvl,
"</module>" );
408 if( activityParam.getMinimalDuration().isDefined() ){
409 log.log( lvl,
"Vsp default is to not define minimal duration. Activity type=" + activityParam.getActivityType() +
"; subpopulation=" + entry.getKey() );
418 log.log( lvl,
"You are setting the marginal utility of traveling with mode " + params.getMode() +
" to " + params.getMarginalUtilityOfTraveling()
419 +
". VSP standard is to set this to zero. Please document carefully why you are using a value different from zero, e.g. by showing distance distributions." );
422 if ( params.getMode().equals(
TransportMode.
walk ) && params.getConstant() != 0. ) {
424 log.log( lvl,
"You are setting the alternative-specific constant for the walk mode to " + params.getConstant()
425 +
". Values different from zero cause problems here because the ASC is also used for access/egress modes" );
431 boolean usingLocationChoice = false ;
432 if ( config.
getModule(
"locationchoice" )!=null ) {
433 usingLocationChoice = true ;
436 if ( usingLocationChoice ) {
437 final String samplePercent = config.
findParam(
"locationchoice",
"destinationSamplePercent" );
438 if ( samplePercent!=null && !samplePercent.equals(
"100.") ) {
441 log.error(
"vsp will not accept location choice destination sample percent other than 100 until the corresponding warning in " +
442 "DestinationSampler is resolved. kai, jan'13") ;
452 log.error(
"vsp will not accept location choice without including opportunity cost of time into the approximation. kai,jan'13") ;
462 log.log( lvl,
"vsp should move away from facilitiesSource=FacilitiesSource.none" );
471 log.log( lvl,
"did not find xml as one of the events file formats. vsp default is using xml events.");
478 log.log( lvl,
"you are not using SpeedyALT as routing algorithm. vsp default (since may'21) is to use SpeedeALT.") ;
488 log.log( lvl,
"found writePlansInterval==0. vsp default is to write plans at least once (for simwrapper).") ;
494 log.log( lvl,
"found writeTripsInterval==0. vsp default is to write trips at least once (for simwrapper).") ;
void checkConsistency(Config config)
AccessEgressType getAccessEgressType()
TrafficDynamics getTrafficDynamics()
double getProbaForRandomSingleTripMode()
static boolean checkGlobalConfigGroup(Config config, Level lvl, boolean problem)
Map< String, ModeParams > getModes()
VspDefaultsCheckingLevel getVspDefaultsCheckingLevel()
double getMarginalUtilityOfMoney()
Collection< String > getMainModes()
boolean getSeparateModes()
Collection< ActivityParams > getActivityParams()
Double getFractionOfIterationsToStartScoreMSA()
double getFractionOfIterationsToDisableInnovation()
boolean isAffectingDuration()
static void checkPlansCalcScoreConfigGroup(Config config, Level lvl)
LinkDynamics getLinkDynamics()
static boolean checkLocationChoiceConfigGroup(Config config, boolean problem)
boolean isRemoveStuckVehicles()
static final String TRANSIT_ACTIVITY_TYPE
static boolean checkControlerConfigGroup(Config config, Level lvl, boolean problem)
Set< EventsFileFormat > getEventsFileFormats()
final ScoringConfigGroup scoring()
final String findParam(final String moduleName, final String paramName)
boolean isUsingOpportunityCostOfTimeForLocationChoice
final boolean isInsistingOnDeprecatedConfigVersion()
final FacilitiesConfigGroup facilities()
TravelTimeCalculatorConfigGroup travelTimeCalculator()
VspExperimentalConfigGroup vspExperimental()
static void checkTravelTimeCalculatorConfigGroup(Config config, Level lvl)
final VehiclesSource getVehiclesSource()
double getMutationRange()
final String getValue(final String param_name)
TransitConfigGroup transit()
double getMarginalUtlOfWaiting_utils_hr()
TimeAllocationMutatorConfigGroup timeAllocationMutator()
int getWriteTripsInterval()
static boolean checkPlanCalcScoreConfigGroup(Config config, Level lvl, boolean problem)
final PlansConfigGroup plans()
int getWritePlansInterval()
double getMonetaryDistanceRate()
boolean isRemovingUnneccessaryPlanAttributes()
RoutingConfigGroup routing()
static boolean checkStrategyConfigGroup(Config config, Level lvl, boolean problem)
SubtourModeChoiceConfigGroup subtourModeChoice()
CheckingOfMarginalUtilityOfTravellng getCheckingOfMarginalUtilityOfTravellng()
FacilitiesSource getFacilitiesSource()
static boolean checkPlansConfigGroup(Config config, Level lvl, boolean problem)
boolean isUsingTravelTimeCheckInTeleportation()
boolean getUsePersonIdForMissingVehicleId()
RoutingAlgorithmType getRoutingAlgorithmType()
final ReplanningConfigGroup replanning()
static boolean checkQsimConfigGroup(Config config, Level lvl, boolean problem)
final ControllerConfigGroup controller()
final ConfigGroup getModule(final String moduleName)
final GlobalConfigGroup global()
VspConfigConsistencyCheckerImpl()
String TimeAllocationMutator
StrategySettings getStrategySettings(final Id< StrategySettings > index, final boolean createIfMissing)
static boolean checkFacilitiesConfigGroup(Config config, Level lvl, boolean problem)
PlansConfigGroup.ActivityDurationInterpretation getActivityDurationInterpretation()
Map< String, ScoringParameterSet > getScoringParametersPerSubpopulation()