usesDeprecatedSyntax = true ; ActivityParams actParams = getActivityTypeByNumber(key.substring("activityClosingTime_".length())); actParams.setClosingTime(Time.parseTime(value)); } else if (key.startsWith("scoringThisActivityAtAll_")) { log.warn( key + msg );
transitActivityParams.setTypicalDuration(120.0); transitActivityParams.setOpeningTime(0.) ; transitActivityParams.setClosingTime(0.) ; ActivityUtilityParameters.Builder modeParamsBuilder = new ActivityUtilityParameters.Builder(transitActivityParams); modeParamsBuilder.setScoreAtAll(false);
final ActivityParams settings = new ActivityParams(); settings.setActivityType( "activity-type-"+i ); settings.setClosingTime( random.nextInt( 24*3600 ) ); settings.setEarliestEndTime( random.nextInt( 24*3600 ) ); settings.setLatestStartTime( random.nextInt( 24*3600 ) );
wParams.setClosingTime(15*3600.0); // the agent stays 1h too long double score = calcScore(f); wParams.setClosingTime(21*3600.0); wParams.setClosingTime(2*3600.0); wParams.setClosingTime (8.*3600.0 + 15.*60. );
ActivityParams workParams = new ActivityParams("work"); workParams.setOpeningTime(7*3600); workParams.setClosingTime(19*3600); config.addActivityParams(homeParams); config.addActivityParams(workParams);
private static void enrichConfig(Config c) { PlanCalcScoreConfigGroup.ActivityParams pre = new PlanCalcScoreConfigGroup.ActivityParams("origin"); pre.setTypicalDuration(49); // needs to be geq 49, otherwise when // running a simulation one gets // "java.lang.RuntimeException: zeroUtilityDuration of type pre-evac must be greater than 0.0. Did you forget to specify the typicalDuration?" // the reason is the double precision. see also comment in // ActivityUtilityParameters.java (gl) pre.setMinimalDuration(49); pre.setClosingTime(49); pre.setEarliestEndTime(49); pre.setLatestStartTime(49); pre.setOpeningTime(49); PlanCalcScoreConfigGroup.ActivityParams post = new PlanCalcScoreConfigGroup.ActivityParams("destination"); post.setTypicalDuration(49); // dito post.setMinimalDuration(49); post.setClosingTime(49); post.setEarliestEndTime(49); post.setLatestStartTime(49); post.setOpeningTime(49); c.planCalcScore().addActivityParams(pre); c.planCalcScore().addActivityParams(post); c.planCalcScore().setLateArrival_utils_hr(0.); c.planCalcScore().setPerforming_utils_hr(0.); }
@Test public void testCheckPlanCalcScore_PtInteractionActivity() { Config config = new Config(); config.addCoreModules(); ActivityParams transitActivityParams = new ActivityParams(PtConstants.TRANSIT_ACTIVITY_TYPE); transitActivityParams.setClosingTime(1.) ; config.planCalcScore().addActivityParams(transitActivityParams); try { new ConfigConsistencyCheckerImpl().checkPlanCalcScore(config); Assert.assertEquals(0,1) ; // should never get here } catch ( Exception ee ){ System.out.println("expected exception") ; } config.vspExperimental().setAbleToOverwritePtInteractionParams(true) ; try { new ConfigConsistencyCheckerImpl().checkPlanCalcScore(config); } catch ( Exception ee ){ Assert.assertEquals(0,1) ; // should never get here } }
/** * Test the performing part of the scoring function when an activity has a ClosingTime set. */ @Test public void testClosingTime() { Fixture f = new Fixture(); double perf = +6.0; f.config.planCalcScore().setPerforming_utils_hr(perf); double initialScore = calcScore(f); ActivityParams wParams = f.config.planCalcScore().getActivityParams("w"); wParams.setClosingTime(15*3600.0); // now the agent stays 1h too long at the LAST work activity double score = calcScore(f); // check the difference between 2.5 and 1.5 hours working assertEquals(perf * 3.0 * Math.log(2.5 / 1.5), initialScore - score, EPSILON); }
/** * Test the waiting part of the scoring function. */ @Test public void testWaitingTime() { Fixture f = new Fixture(); double waiting = -10.0; f.config.planCalcScore().setMarginalUtlOfWaiting_utils_hr(waiting); ActivityParams wParams = f.config.planCalcScore().getActivityParams("w"); wParams.setOpeningTime( 8*3600.0); // the agent arrives 30min early wParams.setClosingTime(15*3600.0); // the agent stays 1h too long // the agent spends 1.5h waiting at the work place assertEquals(waiting * 1.5, calcScore(f), EPSILON); }
@StringSetter("closingTime") private void setClosingTime(final String closingTime) { testForLocked(); setClosingTime(Time.parseTime(closingTime)); }