/**
   * Writes the population and their attributes to file.
   *
   * @param outputfolder
   */
  public void writePopulation(String outputfolder) {
    if (this.sc.getPopulation().getPersons().size() == 0 || this.personAttributes == null) {
      throw new RuntimeException("Either no persons or person attributes to write.");
    } else {
      LOG.info("Writing population to file...");
      PopulationWriter pw = new PopulationWriter(this.sc.getPopulation(), this.sc.getNetwork());
      pw.writeV5(outputfolder + "Population.xml");

      LOG.info("Writing person attributes to file...");
      ObjectAttributesXmlWriter oaw = new ObjectAttributesXmlWriter(this.personAttributes);
      oaw.setPrettyPrint(true);
      oaw.writeFile(outputfolder + "PersonAttributes.xml");
    }
  }
  /**
   * Writes the households and their attributes to file.
   *
   * @param outputfolder
   */
  public void writeHouseholds(String outputfolder) {
    if (this.households == null || this.householdAttributes == null) {
      throw new RuntimeException("Either no households or household attributes to write.");
    } else {
      LOG.info("Writing households to file...");
      HouseholdsWriterV10 hw = new HouseholdsWriterV10(this.households);
      hw.setPrettyPrint(true);
      hw.writeFile(outputfolder + "Households.xml");

      LOG.info("Writing household attributes to file...");
      ObjectAttributesXmlWriter oaw = new ObjectAttributesXmlWriter(householdAttributes);
      oaw.setPrettyPrint(true);
      oaw.writeFile(outputfolder + "HouseholdAttributes.xml");
    }
  }