private void readPrefs() { String prefsFileName = this.dccg.getPrefsFile(); if (prefsFileName != null) { ObjectAttributesXmlReader prefsReader = new ObjectAttributesXmlReader(this.prefsAttributes); try { prefsReader.readFile(prefsFileName); log.info("reading prefs attributes from: \n"+ prefsFileName); } catch (UncheckedIOException e) { // reading was not successful log.error("unsuccessful prefs reading from files!\n" + prefsFileName); } } else { log.warn("prefs are taken from the config and if available from the desires as there is no preferences file specified \n"); for (ActivityParams activityParams : this.scenario.getConfig().planCalcScore().getActivityParams()) { for (Person p : this.scenario.getPopulation().getPersons().values()) { prefsAttributes.putAttribute(p.getId().toString(), "typicalDuration_" + activityParams.getActivityType(), activityParams.getTypicalDuration()); prefsAttributes.putAttribute(p.getId().toString(), "latestStartTime_" + activityParams.getActivityType(), activityParams.getLatestStartTime()); prefsAttributes.putAttribute(p.getId().toString(), "earliestEndTime_" + activityParams.getActivityType(), activityParams.getEarliestEndTime()); prefsAttributes.putAttribute(p.getId().toString(), "minimalDuration_" + activityParams.getActivityType(), activityParams.getMinimalDuration()); } } } }
module.addParam( "activityLatestStartTime_"+suffix , ""+settings.getLatestStartTime() ); module.addParam( "activityMinimalDuration_"+suffix , ""+settings.getMinimalDuration() ); module.addParam( "activityOpeningTime_"+suffix , ""+settings.getOpeningTime() );
/** * Convenience constructor for main use case */ public Builder(ActivityParams ppp ) { this.type = ppp.getActivityType() ; this.priority = ppp.getPriority() ; this.typicalDuration_s = ppp.getTypicalDuration() ; this.closingTime = ppp.getClosingTime() ; this.earliestEndTime = ppp.getEarliestEndTime() ; this.latestStartTime = ppp.getLatestStartTime() ; this.minimalDuration = ppp.getMinimalDuration() ; this.openingTime = ppp.getOpeningTime() ; this.scoreAtAll = ppp.isScoringThisActivityAtAll() ; switch( ppp.getTypicalDurationScoreComputation() ) { case relative: this.zeroUtilityComputation = new SameRelativeScore() ; break; case uniform: this.zeroUtilityComputation = new SameAbsoluteScore() ; break; default: throw new RuntimeException("not defined"); } // seems to be somewhat overkill to set a computation method that is only used in the builder ... but the builder has a method to // (re)set the }
Assert.assertEquals( "wrong latestStartTime "+msg, initialSettings.getLatestStartTime(), inputSettings.getLatestStartTime(), 1e-7 ); Assert.assertEquals(
@StringGetter("latestStartTime") private String getLatestStartTimeString() { return Time.writeTime(getLatestStartTime()); }