Beispiel #1
0
  @Override
  public Solution generate() {
    Solution solution = newSolution();

    EncodingUtils.setReal(solution.getVariable(0), 3.0);
    EncodingUtils.setReal(solution.getVariable(1), 0.5);

    evaluate(solution);
    return solution;
  }
Beispiel #2
0
  @Override
  public void evaluate(Solution solution) {
    double[] x = EncodingUtils.getReal(solution);
    double[] psum = new double[numberOfObjectives];
    double[] zz = new double[numberOfVariables];

    // apply transform to convert from UF11 to DTLZ2
    CEC2009.transform(
        x,
        zz,
        psum,
        numberOfVariables == 10 ? M_10D : M_30D,
        numberOfVariables == 10 ? lamda_l_10D : lamda_l_30D,
        numberOfVariables,
        numberOfObjectives);

    // evaluate the transformed solution with DTLZ2
    Solution transformedSolution = problem.newSolution();
    EncodingUtils.setReal(transformedSolution, zz);
    problem.evaluate(transformedSolution);

    // convert the DTLZ2 results back to UF11
    for (int i = 0; i < numberOfObjectives; i++) {
      solution.setObjective(
          i, 2.0 / (1.0 + Math.exp(-psum[i])) * (transformedSolution.getObjective(i) + 1));
    }
  }