protected Solution select(List<Solution> solutions,int index){
  double[] weight=weights.get(index);
  double minDistance=Double.POSITIVE_INFINITY;
  Solution minSolution=null;
  for (  Solution solution : solutions) {
    if (!solution.violatesConstraints()) {
      double[] objectives=(double[])solution.getAttribute(NORMALIZED_OBJECTIVES);
      double penalty=numberOfObjectives * Math.pow(scalingFactor,alpha) * acosine(weight,objectives) / minAngles[index];
      double tempDistance=Vector.magnitude(objectives) * (1.0 + penalty);
      if (tempDistance < minDistance) {
        minDistance=tempDistance;
        minSolution=solution;
      }
    }
  }
  if (minSolution == null) {
    for (    Solution solution : solutions) {
      double tempDistance=0.0;
      for (int i=0; i < solution.getNumberOfConstraints(); i++) {
        tempDistance+=Math.abs(solution.getConstraint(i));
      }
      if (tempDistance < minDistance) {
        minDistance=tempDistance;
        minSolution=solution;
      }
    }
  }
  return minSolution;
}

protected Solution select ( List < Solution > solutions , int index ) { double [ ] weight = weights . get ( index ) ; double minDistance = Double . POSITIVE_INFINITY ; Solution minSolution = null ; for ( Solution solution : solutions ) { if ( ! solution . violatesConstraints ( ) ) { double [ ] objectives = ( double [ ] ) solution . getAttribute ( NORMALIZED_OBJECTIVES ) ; double penalty = numberOfObjectives * Math . pow ( scalingFactor , alpha ) * acosine ( weight , objectives ) / minAngles [ index ] ; double tempDistance = Vector . magnitude ( objectives ) * ( 1.0 + penalty ) ; if ( tempDistance < minDistance ) { minDistance = tempDistance ; minSolution = solution ; } } } if ( minSolution == null ) { for ( Solution solution : solutions ) { double tempDistance = 0.0 ; for ( int i = 0 ; i < solution . getNumberOfConstraints ( ) ; i ++ ) { tempDistance += Math . abs ( solution . getConstraint ( i ) ) ; } if ( tempDistance < minDistance ) { minDistance = tempDistance ; minSolution = solution ; } } } return minSolution ; }
select the solution with the smallest penalized distance .
