Computes the ideal point based on a list of solutions

@param solutionsList A list of solutions
@return The ideal point
177054
private static <S extends Solution<?>> double[] getIdealValues(List<S> solutionsList) {
    ArrayFront front = new ArrayFront(solutionsList);
    FrontExtremeValues extremeValues = new FrontExtremeValues();
    List<Double> list = extremeValues.findLowestValues(front);
    return toArray(list);
  }
258385
public double evaluate(List<? extends Solution<?>> set1, List<? extends Solution<?>> set2) {
    double result ;
    int sum = 0 ;

    if (set2.size()==0) {
      if (set1.size()==0) {
        result = 0.0 ;
      } else {
        result = 1.0 ;
      }
    } else {
      for (Solution<?> solution : set2) {
        if (SolutionListUtils.isSolutionDominatedBySolutionList(solution, set1)) {
          sum++;
        }
      }
      result = (double)sum/set2.size() ;
    }
    return result ;
  }
1132017
public static <S extends Solution<?>> void weightedSum(List<S> solutionsList, double[] weights) {
    for (S solution : solutionsList) {
      double sum = weights[0] * solution.getObjective(0);
      for (int i = 1; i < solution.getNumberOfObjectives(); i++) {
        sum += weights[i] * solution.getObjective(i);
      }
      setScalarizationValue(solution, sum);
    }

  }
651386
public static <S extends Solution<?>> void angleUtility(List<S> solutionsList, double[][] extremePoints) {
    for (S solution : solutionsList) {
      double fraction = 0.0;
      for (int i = 0; i < extremePoints.length; i++) {
        double numerator = 0.0;
        double denominator = 0.0;
        for (int j = 0; j < extremePoints.length; j++) {
          if (i == j) {
            denominator = Math.abs(extremePoints[i][j] - solution.getObjective(j));
          } else {
            numerator += Math.pow(extremePoints[i][j] - solution.getObjective(j), 2.0);
          }
        }
        // Avoid numeric instability and division by 0.
        if (denominator > 10e-6) {
          fraction = Math.max(fraction, Math.sqrt(numerator) / denominator);
        } else {
          fraction = Double.MAX_VALUE;
        }
      }
      setScalarizationValue(solution, Math.atan(fraction));
    }
  }
1205643
public S execute(List<S> solutionList) {
    if (null == solutionList) {
      throw new JMetalException("The solution list is null") ;
    } else if (solutionList.isEmpty()) {
      throw new JMetalException("The solution list is empty") ;
    }

    List<S> list = SolutionListUtils.selectNRandomDifferentSolutions(1, solutionList);

    return list.get(0) ;
  }
381579
public static Solution<?> normalize(Solution<?> solution, double[] minValues, double[] maxValues) {

		if (solution == null) {
			throw new JMetalException("The solution should not be null");
		}
		
		if (minValues == null || maxValues == null) {
			throw new JMetalException("The minValues and maxValues should not be null");
		}
		
		if (minValues.length == 0 || maxValues.length == 0) {
			throw new JMetalException("The minValues and maxValues should not be empty");
		}

		if (minValues.length != maxValues.length) {
			throw new JMetalException("The minValues and maxValues should have the same length");
		}

		if (solution.getNumberOfObjectives() != minValues.length) {
			throw new JMetalException("The number of objectives should be the same to min and max length");
		}

		Solution<?> copy = (Solution<?>) solution.copy();

		for (int i = 0; i < copy.getNumberOfObjectives(); i++) {
			copy.setObjective(i, NormalizeUtils.normalize(solution.getObjective(i), minValues[i], maxValues[i]));
		}

		return copy;
	}
1087003
private double getScore(ArrayList candidateList) {
    matched = 0;
    largestIndex = -1;
    double scoreValue = 0;
    HashMap tMap = new HashMap(),
        uMap = new HashMap();
    java.util.Iterator it = candidateList.iterator();
    while (it.hasNext()) {
      TagLink.Candidates actualCandidates = (TagLink.Candidates) it.next();
      Integer actualTPos = new Integer(actualCandidates.getTPos()),
          actualUPos = new Integer(actualCandidates.getUPos());
      if ( (!tMap.containsKey(actualTPos)) &&
          (!uMap.containsKey(actualUPos))) {
        double actualScore = actualCandidates.getScore();
        scoreValue += actualScore;
        tMap.put(actualTPos, null);
        uMap.put(actualUPos, null);
        if (largestIndex < actualTPos.intValue()) {
          largestIndex = actualTPos.intValue();
        }
        matched++;
      }
    }
    return scoreValue;
  }
83325
public static <S extends Solution<?>> void nash(List<S> solutionsList) {
    nash(solutionsList, getNadirValues(solutionsList));
  }
363864
private static <S extends Solution<?>> double[] getNadirValues(List<S> solutionsList) {
    ArrayFront front = new ArrayFront(solutionsList);
    FrontExtremeValues extremeValues = new FrontExtremeValues();
    List<Double> list = extremeValues.findHighestValues(front);
    return toArray(list);
  }
164219
public S execute(List<S> solutionList) {
    if (null == solutionList) {
      throw new JMetalException("The solution list is null") ;
    } else if (solutionList.isEmpty()) {
      throw new JMetalException("The solution list is empty") ;
    }

    int bestSolution = 0 ;
    for (int i = 1; i < solutionList.size(); i++) {
      if (comparator.compare(solutionList.get(i), solutionList.get(bestSolution)) < 0) {
        bestSolution = i;
      }
    }

    return solutionList.get(bestSolution) ;
  }
534059
public List<Point> points() {
        return positions().children().stream()
                .map(Point::new)
                .collect(Collectors.toList());

    }
741719
public Collection<Line> getPoints()
    {
        final Collection<Line> list = new ArrayList<>(npoints);
        for (int i = 0; i < npoints / 2; i++)
        {
            list.add(new Line(xpoints[i], ypoints[i], xpoints[i + npoints / 2], ypoints[i + npoints / 2]));
        }
        return list;
    }
637004
private void solve(int method) throws NullPointerException {
    // solution exists
    if(solved) {
      return;
    }

    // bring in reduced row echelon form
    if(!reducedRowEchelonForm) {
      reducedRowEchelonForm(method);
    }

    if(!isSolvable(method)) {
      if(LOG.isDebugging()) {
        LOG.debugFine("Equation system is not solvable!");
      }
      return;
    }

    // compute one special solution
    final int cols = coeff[0].length;
    int numbound = 0, numfree = 0;
    int[] boundIndices = new int[cols], freeIndices = new int[cols];
    x_0 = new double[cols];
    outer: for(int i = 0; i < coeff.length; i++) {
      for(int j = i; j < coeff[row[i]].length; j++) {
        if(coeff[row[i]][col[j]] == 1) {
          x_0[col[i]] = rhs[row[i]];
          boundIndices[numbound++] = col[i];
          continue outer;
        }
      }
      freeIndices[numfree++] = i;
    }

    StringBuilder msg = new StringBuilder();
    if(LOG.isDebugging()) {
      msg.append("\nSpecial solution x_0 = [").append(FormatUtil.format(x_0, ",", FormatUtil.NF4)).append(']') //
          .append("\nbound Indices ").append(FormatUtil.format(boundIndices, ",")) //
          .append("\nfree Indices ").append(FormatUtil.format(freeIndices, ","));
    }

    // compute solution space of homogeneous linear equation system
    Arrays.sort(boundIndices, 0, numbound);
    int freeIndex = 0;
    int boundIndex = 0;
    u = new double[cols][numfree];

    for(int j = 0; j < u[0].length; j++) {
      for(int i = 0; i < u.length; i++) {
        if(freeIndex < numfree && i == freeIndices[freeIndex]) {
          u[i][j] = 1;
        }
        else if(boundIndex < numbound && i == boundIndices[boundIndex]) {
          u[i][j] = -coeff[row[boundIndex]][freeIndices[freeIndex]];
          boundIndex++;
        }
      }
      freeIndex++;
      boundIndex = 0; // Restart
    }

    if(LOG.isDebugging()) {
      msg.append("\nU");
      for(double[] anU : u) {
        msg.append('\n').append(FormatUtil.format(anU, ",", FormatUtil.NF4));
      }
      LOG.debugFine(msg.toString());
    }

    solved = true;
  }
217367
public double feasibilityRatio(List<S> solutionSet) {
    double aux = 0.0;
    for (int i = 0; i < solutionSet.size(); i++) {
      if (overallConstraintViolation.getAttribute(solutionSet.get(i)) < 0) {
        aux = aux + 1.0;
      }
    }
    return aux / (double) solutionSet.size();
  }
1097297
public static <S extends Solution<?>> void uniform(List<S> solutionsList) {
    for (S solution : solutionsList) {
      setScalarizationValue(solution, 1.0);
    }
  }
250868
public static ArrayList<Point2> getPoints(int startX, int startY, int endX, int endY) {
    final ArrayList<Point2> result = new ArrayList<Point2>();
    for (int y = startY; y < endY; y++) {
      for (int x = startX; x < endX; x++) {
        result.add(new Point2(x, y));
      }
    }
    return result;
  }
1179853
public static <S> void restart(List<S> solutionList, Problem<S> problem,
                                 int percentageOfSolutionsToRemove) {
    if (solutionList == null) {
      throw new NullSolutionListException();
    } else if (problem == null) {
      throw new JMetalException("The problem is null");
    } else if ((percentageOfSolutionsToRemove < 0) || (percentageOfSolutionsToRemove > 100)) {
      throw new JMetalException("The percentage of solutions to remove is invalid: " + percentageOfSolutionsToRemove);
    }

    int solutionListOriginalSize = solutionList.size();
    int numberOfSolutionsToRemove = (int) (solutionListOriginalSize * percentageOfSolutionsToRemove / 100.0);

    removeSolutionsFromList(solutionList, numberOfSolutionsToRemove);
    fillPopulationWithNewSolutions(solutionList, problem, solutionListOriginalSize);
  }