Exemple #1
0
  private void generateAutoOwnership() {
    // select number of cars for every household

    JobDataManager jobData = new JobDataManager(rb);
    jobData.calculateJobDensityByZone();
    AutoOwnershipModel ao = new AutoOwnershipModel(rb); // calculate auto-ownership probabilities
    for (Household hh : Household.getHouseholdArray()) {
      int autos = ao.simulateAutoOwnership(hh);
      hh.setAutos(autos);
    }
  }
Exemple #2
0
  private void createJobs() {
    // method to generate synthetic jobs

    logger.info("  Generating base year jobs");
    TableDataSet jobs =
        SiloUtil.readCSVfile(
            ResourceUtil.getProperty(rb, JobDataManager.PROPERTIES_JOB_CONTROL_TOTAL));
    new JobType(rb);

    // jobInventory by [industry][taz]
    float[][] jobInventory =
        new float[JobType.getNumberOfJobTypes()][geoData.getHighestZonalId() + 1];
    tazByWorkZonePuma =
        new HashMap<>(); // this HashMap has same content as "HashMap tazByPuma", though is kept
                         // separately in case external workzones will be defined

    // read employment data
    // For reasons that are not explained in the documentation, some of the PUMA work zones were
    // aggregated to the
    // next higher level. Keep this information.

    for (int row = 1; row <= jobs.getRowCount(); row++) {
      int taz = (int) jobs.getValueAt(row, "SMZ");
      int pumaOfWorkZone = geoData.getSimplifiedPUMAofZone(taz);
      if (tazByWorkZonePuma.containsKey(pumaOfWorkZone)) {
        int[] list = tazByWorkZonePuma.get(pumaOfWorkZone);
        int[] newList = SiloUtil.expandArrayByOneElement(list, taz);
        tazByWorkZonePuma.put(pumaOfWorkZone, newList);
      } else {
        tazByWorkZonePuma.put(pumaOfWorkZone, new int[] {taz});
      }
      for (int jobTp = 0; jobTp < JobType.getNumberOfJobTypes(); jobTp++) {
        jobInventory[jobTp][taz] = jobs.getValueAt(row, JobType.getJobType(jobTp) + "00");
      }
    }

    // create base year employment
    for (int zone : geoData.getZones()) {
      for (int jobTp = 0; jobTp < JobType.getNumberOfJobTypes(); jobTp++) {
        if (jobInventory[jobTp][zone] > 0) {
          for (int i = 1; i <= jobInventory[jobTp][zone]; i++) {
            int id = JobDataManager.getNextJobId();
            new Job(id, zone, -1, JobType.getJobType(jobTp));
            if (id == SiloUtil.trackJj) {
              SiloUtil.trackWriter.println("Generated job with following attributes:");
              Job.getJobFromId(id).logAttributes(SiloUtil.trackWriter);
            }
          }
        }
      }
    }
    identifyVacantJobsByZone();
  }