@StringSetter(END_TIME) public void setSimulationEndTime(String simulationEndTime) { double parsedTime = Time.parseTime(simulationEndTime); if (!Time.isUndefinedTime(parsedTime)) { this.simulationEndTime = parsedTime; } }
@Override public boolean applyAgentFilter(Id<Person> id, double time) { Double earliestLinkExitTime = this.earliestLinkExitTimeProvider.getEarliestLinkExitTime(id); if (Time.isUndefinedTime(earliestLinkExitTime)) return false; else if (earliestLinkExitTime <= time) return false; else return true; } }
@Override public double set(Id<TransitStopFacility> fromStop, Id<TransitStopFacility> toStop, double seconds) { if (Double.isNaN(seconds) || Time.isUndefinedTime(seconds)) { return remove(fromStop, toStop); } Map<Id<TransitStopFacility>, Double> innerMap = this.minimalTransferTimes.computeIfAbsent(fromStop, key -> new ConcurrentHashMap<>()); Double value = innerMap.put(toStop, seconds); if (value == null) { return Double.NaN; } return 0; }
@Override public final void handleActivity(Activity activity) { double startTime = activity.getStartTime(); double endTime = activity.getEndTime(); if (Time.isUndefinedTime(startTime) && !Time.isUndefinedTime(endTime)) { for (ActivityScoring activityScoringFunction : this.activityScoringFunctions) { activityScoringFunction.handleFirstActivity(activity); } } else if (!Time.isUndefinedTime(startTime) && !Time.isUndefinedTime(endTime)) { for (ActivityScoring activityScoringFunction : this.activityScoringFunctions) { activityScoringFunction.handleActivity(activity); } } else if (!Time.isUndefinedTime(startTime) && Time.isUndefinedTime(endTime)) { for (ActivityScoring activityScoringFunction : this.activityScoringFunctions) { activityScoringFunction.handleLastActivity(activity); } } else { throw new RuntimeException("Trying to score an activity without start or end time. Should not happen."); } }
private void writeCost(Cost cost) throws IOException { this.writer.write("\t<cost "); if (!Time.isUndefinedTime(cost.startTime)) { this.writer.write("start_time=\"" + Time.writeTime(cost.startTime) + "\" "); } if (!Time.isUndefinedTime(cost.endTime) && cost.endTime != Double.POSITIVE_INFINITY // The toll reader converts undefined time to POSITIVE_INFINITY since otherwise it does not make sense. // This, however, means that we need to deal with this here as well. kai, aug'14 ) { this.writer.write("end_time=\"" + Time.writeTime(cost.endTime) + "\" "); } this.writer.write("amount=\"" + cost.amount + "\" />\n"); }
public DynAgent(Id<Person> id, Id<Link> startLinkId, EventsManager events, DynAgentLogic agentLogic) { this.id = id; this.currentLinkId = startLinkId; this.agentLogic = agentLogic; this.events = events; // initial activity dynActivity = this.agentLogic.computeInitialActivity(this); state = Time.isUndefinedTime(dynActivity.getEndTime()) ? MobsimAgent.State.ABORT : MobsimAgent.State.ACTIVITY; }
private static void startLeg(final Leg leg, final BufferedWriter out) throws IOException { out.write("\t\t\t<leg mode=\""); out.write(leg.getMode()); out.write("\""); if (!Time.isUndefinedTime(leg.getDepartureTime())) { out.write(" dep_time=\""); out.write(Time.writeTime(leg.getDepartureTime())); out.write("\""); } if (!Time.isUndefinedTime(leg.getTravelTime())) { out.write(" trav_time=\""); out.write(Time.writeTime(leg.getTravelTime())); out.write("\""); } // if (leg instanceof LegImpl) { // LegImpl l = (LegImpl)leg; // if (l.getDepartureTime() + l.getTravelTime() != Time.UNDEFINED_TIME) { // out.write(" arr_time=\""); // out.write(Time.writeTime(l.getDepartureTime() + l.getTravelTime())); // out.write("\""); // } // } // arrival time is in dtd, but no longer evaluated in code (according to not being in API). kai, jun'16 out.write(">\n"); }
private void startLeg(final Leg leg, final BufferedWriter out) throws IOException { out.write("\t\t\t<leg mode=\""); out.write(leg.getMode()); out.write("\""); if (!Time.isUndefinedTime(leg.getDepartureTime())) { out.write(" dep_time=\""); out.write(Time.writeTime(leg.getDepartureTime())); out.write("\""); } if (!Time.isUndefinedTime(leg.getTravelTime())) { out.write(" trav_time=\""); out.write(Time.writeTime(leg.getTravelTime())); out.write("\""); } // if (leg instanceof LegImpl) { // LegImpl l = (LegImpl)leg; // if (l.getDepartureTime() + l.getTravelTime() != Time.UNDEFINED_TIME) { // out.write(" arr_time=\""); // out.write(Time.writeTime(l.getDepartureTime() + l.getTravelTime())); // out.write("\""); // } // } // arrival time is in dtd, but no longer evaluated in code (according to not being in API). kai, jun'16 out.write(">\n"); this.attributesWriter.writeAttributes( "\t\t\t\t" , out , leg.getAttributes() ); }
out.write("\""); if (!Time.isUndefinedTime(act.getStartTime())) { out.write(" start_time=\""); out.write(Time.writeTime(act.getStartTime())); out.write("\""); if (!Time.isUndefinedTime(act.getMaximumDuration())) { out.write(" max_dur=\""); out.write(Time.writeTime(act.getMaximumDuration())); out.write("\""); if (!Time.isUndefinedTime(act.getEndTime())) { out.write(" end_time=\""); out.write(Time.writeTime(act.getEndTime()));
if (!Time.isUndefinedTime(act.getStartTime())) { out.write(" start_time=\""); out.write(Time.writeTime(act.getStartTime())); out.write("\""); if (!Time.isUndefinedTime(act.getMaximumDuration())) { out.write(" max_dur=\""); out.write(Time.writeTime(act.getMaximumDuration())); out.write("\""); if (!Time.isUndefinedTime(act.getEndTime())) { out.write(" end_time=\""); out.write(Time.writeTime(act.getEndTime()));
@Override public void run(final Plan plan) { for ( Activity act : TripStructureUtils.getActivities( plan , blackList ) ) { // this is deliberately simplistic. Cleanup up of the time information should be done somewhere else. if ( !Time.isUndefinedTime( act.getEndTime() ) ) { act.setEndTime(mutateTime(act.getEndTime())); } if ( affectingDuration ) { if ( !Time.isUndefinedTime( act.getMaximumDuration() ) ) { act.setMaximumDuration(mutateTime(act.getMaximumDuration())); } } } // the legs are not doing anything. kai, jun'12 }
@Override public void startAct(final Activity act, final BufferedWriter out) throws IOException { out.write("\t\t\t<act"); out.write(" type=\"" + act.getType() + "\""); if (act.getCoord() != null) { final Coord coord = coordinateTransformation.transform( act.getCoord() ); out.write(" x100=\"" + coord.getX() + "\""); out.write(" y100=\"" + coord.getY() + "\""); } if (act.getLinkId() != null) out.write(" link=\"" + act.getLinkId() + "\""); if (act.getStartTime() != Integer.MIN_VALUE) out.write(" start_time=\"" + Time.writeTime(act.getStartTime()) + "\""); if (!Time.isUndefinedTime(act.getMaximumDuration())) out.write(" dur=\"" + Time.writeTime(act.getMaximumDuration()) + "\""); if (act.getEndTime() != Integer.MIN_VALUE) out.write(" end_time=\"" + Time.writeTime(act.getEndTime()) + "\""); out.write(" />\n"); }
@Override public void checkConsistency(Config config) { new BeanValidationConfigConsistencyChecker().checkConsistency(config); if (config.qsim().getStartTime() != 0 && !Time.isUndefinedTime(config.qsim().getStartTime())) { // If properly handled this should not be a concern log.warn("QSim.startTime should be 0:00:00 (or 0). This is what typically DynAgents assume"); } if (config.qsim().getTimeStepSize() != 1) { // If properly handled this should not be a concern log.warn("QSim.timeStepSize should be 1. This is what typically DynAgents assume"); } if (config.qsim().getSimStarttimeInterpretation() != StarttimeInterpretation.onlyUseStarttime) { throw new RuntimeException("DynAgents require simulation to start from the very beginning" + " Set 'QSim.simStarttimeInterpretation' to " + StarttimeInterpretation.onlyUseStarttime); } } }
if (params.isScoringThisActivityAtAll() && Time.isUndefinedTime(params.getTypicalDuration())) { throw new RuntimeException("In activity type=" + params.getActivityType() + ", the typical duration is undefined. This will lead to errors that are difficult to debug, "