private List<double[]> initializeWeightsND(){
  int N=50;
  List<double[]> candidates=new ArrayList<double[]>(numberOfPoints * N);
  for (int i=0; i < numberOfPoints * N; i++) {
    double[] weight=new double[numberOfObjectives];
    for (int j=0; j < numberOfObjectives; j++) {
      weight[j]=PRNG.nextDouble();
    }
    double sum=StatUtils.sum(weight);
    for (int j=0; j < numberOfObjectives; j++) {
      weight[j]/=sum;
    }
    candidates.add(weight);
  }
  List<double[]> weights=new ArrayList<double[]>(numberOfPoints * N);
  for (int i=0; i < numberOfObjectives; i++) {
    double[] weight=new double[numberOfObjectives];
    weight[i]=1.0;
    weights.add(weight);
  }
  while (weights.size() < numberOfPoints) {
    double[] weight=null;
    double distance=Double.NEGATIVE_INFINITY;
    for (int i=0; i < candidates.size(); i++) {
      double d=Double.POSITIVE_INFINITY;
      for (int j=0; j < weights.size(); j++) {
        d=Math.min(d,MathArrays.distance(candidates.get(i),weights.get(j)));
      }
      if (d > distance) {
        weight=candidates.get(i);
        distance=d;
      }
    }
    weights.add(weight);
    candidates.remove(weight);
  }
  return weights;
}

private List < double [ ] > initializeWeightsND ( ) { int N = 50 ; List < double [ ] > candidates = new ArrayList < double [ ] > ( numberOfPoints * N ) ; for ( int i = 0 ; i < numberOfPoints * N ; i ++ ) { double [ ] weight = new double [ numberOfObjectives ] ; for ( int j = 0 ; j < numberOfObjectives ; j ++ ) { weight [ j ] = PRNG . nextDouble ( ) ; } double sum = StatUtils . sum ( weight ) ; for ( int j = 0 ; j < numberOfObjectives ; j ++ ) { weight [ j ] /= sum ; } candidates . add ( weight ) ; } List < double [ ] > weights = new ArrayList < double [ ] > ( numberOfPoints * N ) ; for ( int i = 0 ; i < numberOfObjectives ; i ++ ) { double [ ] weight = new double [ numberOfObjectives ] ; weight [ i ] = 1.0 ; weights . add ( weight ) ; } while ( weights . size ( ) < numberOfPoints ) { double [ ] weight = null ; double distance = Double . NEGATIVE_INFINITY ; for ( int i = 0 ; i < candidates . size ( ) ; i ++ ) { double d = Double . POSITIVE_INFINITY ; for ( int j = 0 ; j < weights . size ( ) ; j ++ ) { d = Math . min ( d , MathArrays . distance ( candidates . get ( i ) , weights . get ( j ) ) ) ; } if ( d > distance ) { weight = candidates . get ( i ) ; distance = d ; } } weights . add ( weight ) ; candidates . remove ( weight ) ; } return weights ; }
returns the weights for problems of arbitrary dimension .
