private void writeHouseholds(Households basicHouseholds) throws UncheckedIOException { Counter counter = new Counter("[HouseholdsWriter] wrote household # "); for (Household h : basicHouseholds.getHouseholds().values()) { this.writeHousehold(h); counter.incCounter(); } counter.printCounter(); }
private void createReceiverPoints() { Counter counter = new Counter("create receiver point #"); for (double y = yCoordMax + 100. ; y > yCoordMin - 100. - noiseParams.getReceiverPointGap() ; y = y - noiseParams.getReceiverPointGap()) { for (double x = xCoordMin - 100. ; x < xCoordMax + 100. + noiseParams.getReceiverPointGap() ; x = x + noiseParams.getReceiverPointGap()) { Id<ReceiverPoint> id = Id.create(counter.getCounter(), ReceiverPoint.class); Coord coord = new Coord(x, y); ReceiverPoint rp = new ReceiverPoint(id, coord); receiverPoints.put(id, rp); counter.incCounter(); } } counter.printCounter(); log.info("Total number of receiver points: " + receiverPoints.size()); }
final Map<Id, Integer> map = new HashMap<Id, Integer>(); final Counter counter = new Counter( "parse person # " ); new MatsimXmlParser() { private Id<Person> currentAgent = null; counter.printCounter();
/*package*/ void checkBinSize(double tripTime) { if (tripTime > dynamicBinSize) { dynamicBinSize = tripTime * 2; enlarge.incCounter(); } else if (tripTime * 3 < dynamicBinSize) { dynamicBinSize = tripTime * 3; shrink.incCounter(); } } }
@Override public void run(final Network network) { log.info(" running " + this.getClass().getName() + " algorithm..."); Counter ctr = new Counter("node #"); ctr.incCounter(); int nOfInLinks = n.getInLinks().size(); int nOfOutLinks = n.getOutLinks().size();
final Counter counter = new Counter( "do iteration # " ); int nextSize = 1; final int maxSize = agents.size(); while ( !agents.isEmpty() ) { if ( log.isTraceEnabled() ) { counter.incCounter(); final int nAllocated = groupPlans.getAllIndividualPlans().size(); if ( nAllocated > nextSize ) { log.trace( "did "+counter.getCounter()+ " iterations ("+(((double) counter.getCounter()) / group.getPersons().size())+" per person)" );
@Override public void endTag(String name, String content, Stack<String> context) { if (HouseholdsSchemaV10Names.HOUSEHOLD.equalsIgnoreCase(name)) { fillHousehold(); ((HouseholdsImpl)this.households).addHousehold(currentHousehold); this.currentHousehold = null; counter.incCounter(); } else if (HouseholdsSchemaV10Names.INCOME.equalsIgnoreCase(name)) { this.currentincome = this.builder.createIncome(Double.parseDouble(content.trim()), this.currentIncomePeriod); this.currentincome.setCurrency(this.currentincomeCurrency); } else if (HouseholdsSchemaV10Names.HOUSEHOLDS.equalsIgnoreCase(name)) { counter.printCounter(); } else if (name.equalsIgnoreCase(HouseholdsSchemaV10Names.ATTRIBUTES)) { this.currAttributes = null; } else if (name.equalsIgnoreCase(HouseholdsSchemaV10Names.ATTRIBUTE)) { this.attributesReader.endTag( name , content , context ); } }
private NetworkBasedTransportCosts(Builder builder) { super(); this.travelDisutility = builder.finalDisutility; this.travelTime = builder.travelTime; this.network = builder.network; this.leastCostPathCalculatorFactory = builder.leastCostPathCalculatorFactory; this.roadPricingCalc = builder.roadPricingCalculator; this.timeSliceWidth = builder.timeSliceWidth; this.defaultTypeId = builder.defaultTypeId; this.ttMemorizedCounter = new Counter("#TransportCostValues cached "); this.ttRequestedCounter = new Counter("numTravelCosts requested "); }
public void printRelocateCount() { this.relocateCounter.printCounter(); }
/** * Writes all plans to the file. */ @Override public final void write(final String filename) { try { this.openFile(filename); this.handler.writeHeaderAndStartElement(this.writer); this.handler.startPlans(this.population, this.writer); this.handler.writeSeparator(this.writer); this.writePersons(); this.handler.endPlans(this.writer); log.info("Population written to: " + filename); } catch (IOException e) { throw new UncheckedIOException(e); } finally { this.close(); counter.printCounter(); counter.reset(); } }
log.info("osm: # nodes read: " + parser.nodeCounter.getCounter()); log.info("osm: # ways read: " + parser.wayCounter.getCounter()); log.info("MATSim: # nodes created: " + this.network.getNodes().size()); log.info("MATSim: # links created: " + this.network.getLinks().size());
@Override public void handleEvent(Event event) { counter.incCounter(); }
public static TransitRouterNetworkWW createFromSchedule(final Network network, final TransitSchedule schedule, final double maxBeelineWalkConnectionDistance) { log.info("start creating transit network"); final TransitRouterNetworkWW transitNetwork = new TransitRouterNetworkWW(); final Counter linkCounter = new Counter(" link #"); final Counter nodeCounter = new Counter(" node #"); int numTravelLinks = 0, numWaitingLinks = 0, numInsideLinks = 0, numTransferLinks = 0; Map<Id<TransitStopFacility>, TransitRouterNetworkNode> stops = new HashMap<Id<TransitStopFacility>, TransitRouterNetworkNode>(); if(nodeS == null) { nodeS = transitNetwork.createNode(stop, null, null); nodeCounter.incCounter(); stops.put(stop.getStopFacility().getId(), nodeS); if (node!=node2) { transitNetwork.createLink(network, node, node2); linkCounter.incCounter(); numTransferLinks++; nodeS = stops.get(stop.getStopFacility().getId()); nodeSR = transitNetwork.createNode(stop, route, line); nodeCounter.incCounter(); if (prevNode != null) { transitNetwork.createLink(network, prevNode, nodeSR, route, line); linkCounter.incCounter(); numTravelLinks++; linkCounter.incCounter(); numWaitingLinks++; transitNetwork.createLink(network, nodeSR, nodeS); linkCounter.incCounter();
if (i == 0) { name = algo.getClass().getSimpleName(); counter = new Counter("[" + name + "] handled person # "); thread.join(); counter.printCounter(); } catch (InterruptedException e) { throw new RuntimeException(e);
public ReplanningRunnable(String counterText) { counter = new Counter(counterText); }
@Override public void endTag( final String name, final String content, final Stack<String> context) { if (name.equals( "plans" )) { counter.printCounter(); try { writer.close(); } catch (IOException e) { throw new UncheckedIOException( e ); } } } }
/** * Writes all plans to the output stream and closes it. * */ public final void write(OutputStream outputStream) { try { this.openOutputStream(outputStream); this.handler.writeHeaderAndStartElement(this.writer); this.handler.startPlans(this.population, this.writer); this.handler.writeSeparator(this.writer); this.writePersons(); this.handler.endPlans(this.writer); } catch (IOException e) { throw new UncheckedIOException(e); } finally { this.close(); counter.printCounter(); counter.reset(); } }
MatsimEventsReader r = new MatsimEventsReader(em); r.readFile(rawInput); log.info(e.counter.getCounter()); long stop = System.currentTimeMillis(); tm3 = stop - start; em.addHandler(e); new ProtoEventsParser(em).parse(output1); log.info(e.counter.getCounter()); long stop = System.currentTimeMillis(); tm4 = stop - start;
public final void run(final Population plans) { log.info("running " + this.getClass().getName() + " algorithm..."); Counter counter = new Counter(" person # "); for (Person p : plans.getPersons().values()) { counter.incCounter(); this.run(p); } counter.printCounter(); log.info("done running algorithm."); }
private void addTieInternal( final Id ego, final Id alter) { final Set<Id<Person>> alters = map.get( ego ); if ( alters == null ) throw new IllegalArgumentException( "ego "+ego+" unknown" ); final boolean added = alters.add( alter ); if ( added ) tieCounter.incCounter(); nTies++; }