public ScoringParameterSet getScoringParameters(String subpopulation) { final ScoringParameterSet params = getScoringParametersPerSubpopulation().get(subpopulation); // If no config parameters defined for a specific subpopulation, // use the ones of the "default" subpopulation return params != null ? params : getScoringParametersPerSubpopulation().get(null); }
private void logWarningsIfNecessary(final PlanCalcScoreConfigGroup cnScoringGroup) { if ( wrnCnt < 1 ) { wrnCnt++ ; if ( cnScoringGroup.getModes().get( mode ).getMonetaryDistanceRate() > 0. ) { log.warn("Monetary distance cost rate needs to be NEGATIVE to produce the normal " + "behavior; just found positive. Continuing anyway.") ; } final Set<String> monoSubpopKeyset = Collections.singleton( null ); if ( !cnScoringGroup.getScoringParametersPerSubpopulation().keySet().equals( monoSubpopKeyset ) ) { log.warn( "Scoring parameters are defined for different subpopulations." + " The routing disutility will only consider the ones of the default subpopulation."); log.warn( "This warning can safely be ignored if disutility of traveling only depends on travel time."); } } }
public Collection<String> getActivityTypes() { if (getScoringParameters(null) != null) return getScoringParameters(null).getActivityParamsPerType().keySet(); else{ Set<String> activities = new HashSet<>(); getScoringParametersPerSubpopulation().values().forEach(item -> activities.addAll(item.getActivityParamsPerType().keySet())); return activities; } }
public ScoringParameterSet getOrCreateScoringParameters(String subpopulation) { ScoringParameterSet params = getScoringParametersPerSubpopulation().get(subpopulation); if (params == null) { params = new ScoringParameterSet(subpopulation); this.addScoringParameters(params); } return params; }
public Collection<String> getAllModes() { if (getScoringParameters(null) != null) { return getScoringParameters(null).getModes().keySet(); } else { Set<String> modes = new HashSet<>(); getScoringParametersPerSubpopulation().values().forEach(item -> modes.addAll(item.getModes().keySet())); return modes; } }
if (getScoringParametersPerSubpopulation().size()>1){ if (!getScoringParametersPerSubpopulation().containsKey(PlanCalcScoreConfigGroup.DEFAULT_SUBPOPULATION)){ throw new RuntimeException("Using several subpopulations in "+PlanCalcScoreConfigGroup.GROUP_NAME+" requires defining a \""+PlanCalcScoreConfigGroup.DEFAULT_SUBPOPULATION+" \" subpopulation." + " Otherwise, crashes can be expected."); for (ScoringParameterSet scoringParameterSet : this.getScoringParametersPerSubpopulation().values()) { for (String mode : config.plansCalcRoute().getNetworkModes()) { String interactionActivityType = mode + " interaction";
if (pcsConfig.getScoringParametersPerSubpopulation().size()>1){ Logger.getLogger(getClass()).warn("More than one subpopulation is used in plansCalcScore. " + "This is not currently implemented in the TransitRouter (but should work for scoring),"