@Override
  public void restart(EvolutionaryAlgorithm algorithm) {

    int curr_pop_size, new_pop_size;

    if (curr_num_restarts < max_num_restarts) {

      curr_num_restarts++;

      curr_pop_size = algorithm.getPopulation().getSize();
      new_pop_size =
          (int) Math.ceil(curr_pop_size * Math.pow(this.incr_factor, this.curr_num_restarts));

      // Re-configure the algorithm:
      algorithm.configure(EAFConfiguration.getInstance());

      algorithm.setPopulationSize(new_pop_size);

      algorithm.setState(EvolutionaryAlgorithm.INIT_STATE);

    } else {
      // Continue with the algorithm:
      algorithm.setState(EvolutionaryAlgorithm.SELECT_STATE);
    }
  }
  /**
   * Configures this object.
   *
   * <p>Configuration example:
   *
   * <pre>
   * &lt;AcceptancePolicy&gt;
   *     &lt;Class&gt;subclass of BinaryAcceptancePolicy&lt;/Class&gt;
   *
   *     &lt;AcceptancePolicy&gt;
   *         &lt;Class&gt;...GenerationBasedAcceptance&lt;/Class&gt;
   *         &lt;AcceptIndividualsFrom&gt;ANY_GENERATION&lt;/AcceptIndividualsFrom&gt;
   *     &lt;/AcceptancePolicy&gt;
   *
   *     &lt;AcceptancePolicy&gt;
   *         &lt;Class&gt;subclass of BinaryAcceptancePolicy&lt;/Class&gt;
   *
   *         &lt;AcceptancePolicy&gt;
   *             &lt;Class&gt;...GenerationBasedAcceptance&lt;/Class&gt;
   *         &lt;AcceptIndividualsFrom&gt;SOME_GENERATION&lt;/AcceptIndividualsFrom&gt;
   *         &lt;/AcceptancePolicy&gt;
   *
   *         &lt;AcceptancePolicy&gt;
   *             &lt;Class&gt;some MigAcceptancePolicy&lt;/Class&gt;
   *             ...
   *         &lt;/AcceptancePolicy&gt;
   *     &lt;/AcceptancePolicy&gt;
   * &lt;/AcceptancePolicy&gt;
   * </pre>
   *
   * <p>This constructs the following tree:
   *
   * <pre>
   *               (B1)
   *              /    \
   *            (G1)  (B2)
   *                 /    \
   *               (G2)   (M)
   * </pre>
   *
   * <p>B1 is the constructed BinaryAcceptancePolicy. Its left component is a {@link
   * GenerationBasedAcceptance} (G1) with parameter ANY_GENERATION. Its right component is also a
   * BinaryAcceptancePolicy with another GenerationBasedAcceptance (G2) with parameter
   * SOME_GENERATION as left component and some other implementation of {@link MigAcceptancePolicy}
   * as right component.
   */
  @Override
  public void configure(Configuration conf) {

    EAFConfiguration eafconf = (EAFConfiguration) conf;

    MigAcceptancePolicy left = (MigAcceptancePolicy) eafconf.getObject("AcceptancePolicy(0).Class");

    MigAcceptancePolicy right =
        (MigAcceptancePolicy) eafconf.getObject("AcceptancePolicy(1).Class");

    if (left != null) {
      left.configure(eafconf.subset("AcceptancePolicy(0)"));
    }

    if (right != null) {
      right.configure(eafconf.subset("AcceptancePolicy(1)"));
    }

    setLeftComponent(left);
    setRightComponent(right);
  }