コード例 #1
0
ファイル: GWASFGA.java プロジェクト: kaikyle7997/jMetal
  public AbstractUtilityFunctionsSet<S> createUtilityFunction(
      List<Double> referencePoint, double[][] weights) {
    weights = WeightVector.invertWeights(weights, true);
    ASFWASFGA<S> aux = new ASFWASFGA<>(weights, referencePoint);

    return aux;
  }
コード例 #2
0
ファイル: GWASFGA.java プロジェクト: kaikyle7997/jMetal
  public GWASFGA(
      Problem<S> problem,
      int populationSize,
      int maxIterations,
      CrossoverOperator<S> crossoverOperator,
      MutationOperator<S> mutationOperator,
      SelectionOperator<List<S>, S> selectionOperator,
      SolutionListEvaluator<S> evaluator) {
    super(
        problem,
        populationSize,
        maxIterations,
        crossoverOperator,
        mutationOperator,
        selectionOperator,
        evaluator,
        null);
    setMaxPopulationSize(populationSize);

    double[][] weights = WeightVector.initUniformWeights2D(0.005, getMaxPopulationSize());

    int halfVectorSize = weights.length / 2;
    int evenVectorsSize = (weights.length % 2 == 0) ? halfVectorSize : (halfVectorSize + 1);
    int oddVectorsSize = halfVectorSize;

    double[][] evenVectors = new double[evenVectorsSize][getProblem().getNumberOfObjectives()];
    double[][] oddVectors = new double[oddVectorsSize][getProblem().getNumberOfObjectives()];

    int index = 0;
    for (int i = 0; i < weights.length; i = i + 2) evenVectors[index++] = weights[i];

    index = 0;
    for (int i = 1; i < weights.length; i = i + 2) oddVectors[index++] = weights[i];

    this.achievementScalarizingNadir = createUtilityFunction(this.getNadirPoint(), evenVectors);
    this.achievementScalarizingUtopia = createUtilityFunction(this.getReferencePoint(), oddVectors);
  }