コード例 #1
0
  /**
   * Returns a new {@link SMPSO} instance.
   *
   * @param properties the properties for customizing the new {@code SMPSO} instance
   * @param problem the problem
   * @return a new {@code SMPSO} instance
   */
  private Algorithm newSMPSO(TypedProperties properties, Problem problem) {
    if (!checkType(RealVariable.class, problem)) {
      throw new FrameworkException("unsupported decision variable type");
    }

    int populationSize = (int) properties.getDouble("populationSize", 100);
    int archiveSize = (int) properties.getDouble("archiveSize", 100);
    double mutationProbability =
        properties.getDouble("pm.rate", 1.0 / problem.getNumberOfVariables());
    double distributionIndex = properties.getDouble("pm.distributionIndex", 20.0);

    return new SMPSO(problem, populationSize, archiveSize, mutationProbability, distributionIndex);
  }
コード例 #2
0
  /**
   * Returns a new {@link OMOPSO} instance.
   *
   * @param properties the properties for customizing the new {@code OMOPSO} instance
   * @param problem the problem
   * @return a new {@code OMOPSO} instance
   */
  private Algorithm newOMOPSO(TypedProperties properties, Problem problem) {
    if (!checkType(RealVariable.class, problem)) {
      throw new FrameworkException("unsupported decision variable type");
    }

    int populationSize = (int) properties.getDouble("populationSize", 100);
    int archiveSize = (int) properties.getDouble("archiveSize", 100);
    int maxIterations = (int) properties.getDouble("maxEvaluations", 25000) / populationSize;
    double mutationProbability =
        properties.getDouble("mutationProbability", 1.0 / problem.getNumberOfVariables());
    double perturbationIndex = properties.getDouble("perturbationIndex", 0.5);
    double[] epsilon =
        properties.getDoubleArray("epsilon", new double[] {EpsilonHelper.getEpsilon(problem)});

    return new OMOPSO(
        problem,
        populationSize,
        archiveSize,
        epsilon,
        mutationProbability,
        perturbationIndex,
        maxIterations);
  }