示例#1
0
文件: DTLZ6.java 项目: nh295/MOHEA
  @Override
  public Solution generate() {
    Solution solution = newSolution();

    for (int i = 0; i < numberOfObjectives - 1; i++) {
      ((RealVariable) solution.getVariable(i)).setValue(PRNG.nextDouble());
    }

    for (int i = numberOfObjectives - 1; i < numberOfVariables; i++) {
      ((RealVariable) solution.getVariable(i)).setValue(0);
    }

    evaluate(solution);

    return solution;
  }
示例#2
0
文件: SSX.java 项目: nh295/MOHEA
  @Override
  public Solution[] evolve(Solution[] parents) {
    Solution result1 = parents[0].copy();
    Solution result2 = parents[1].copy();

    for (int i = 0; i < result1.getNumberOfVariables(); i++) {
      Variable variable1 = result1.getVariable(i);
      Variable variable2 = result2.getVariable(i);

      if ((PRNG.nextDouble() <= probability)
          && (variable1 instanceof Subset)
          && (variable2 instanceof Subset)) {
        evolve((Subset) variable1, (Subset) variable2);
      }
    }

    return new Solution[] {result1, result2};
  }