/**
   * Creates instances of CloudSim's PowerPe class from a host registry.
   *
   * @param hr a host registry.
   * @return a list of PowerPe instances.
   * @since 1.0
   */
  static List<Pe> createPes(HostRegistry hr) {
    List<Pe> list = new ArrayList<Pe>();

    for (int i = 0; i < hr.getNumOfPes(); i++) {

      Optional<PeProvisioner> pp =
          PE_PROVISIONER.getExtensionInstanceByName(hr.getPeProvisionerAlias(), hr.getMipsPerPe());

      if (!pp.isPresent()) {
        Dialog.showErrorMessage(
            null,
            format("Error on loading the PE provisioning policy [%s]", hr.getPeProvisionerAlias()));
        return null;
      }

      list.add(new Pe(i, pp.get()));
    }

    return list;
  }