/**
   * 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");
    }
  }