Ejemplo n.º 1
0
  public double getDistribucion(String fileYTrue) {
    MetricsUtil metricsUtils = new MetricsUtil();

    pareto1 = GenerarYTrue(fileYTrue);

    SolutionSet yTrueSolutionSet = pareto1.getSolutionSet();

    double sumaCantidadMaxima = 0.0;
    double rho = 0.1 * getExtension(fileYTrue);
    for (int i = 0; i < pareto1.solutionSet.size(); i++) {

      Solution solutionYtrue = yTrueSolutionSet.get(i);
      double[] yTruePunto = {solutionYtrue.getObjective(0), solutionYtrue.getObjective(1)};

      double cantidadMaxima = 0.0;
      for (int j = 0; j < pareto1.solutionSet.size(); j++) {

        Solution solutionYPrima = yTrueSolutionSet.get(j);
        double[] yPrimaPunto = {solutionYPrima.getObjective(0), solutionYPrima.getObjective(1)};

        Double aux = metricsUtils.distance(yTruePunto, yPrimaPunto);

        if (aux > rho) {
          cantidadMaxima++;
        }
      }
      sumaCantidadMaxima = sumaCantidadMaxima + cantidadMaxima;
    }

    double distanciaFinal = (1.0 / yTrueSolutionSet.size()) * sumaCantidadMaxima;

    return distanciaFinal;
  }
Ejemplo n.º 2
0
  public double getDistanciaYTrue(String fileYTrue, String fileYPrima) {
    MetricsUtil metricsUtils = new MetricsUtil();

    pareto1 = GenerarYTrue(fileYTrue);
    pareto2 = GenerarYTrue(fileYPrima);

    SolutionSet yTrueSolutionSet = pareto1.getSolutionSet();
    SolutionSet yPrimaSolutionSet = pareto2.getSolutionSet();

    double sumaDistanciaMinima = 0.0;
    for (int i = 0; i < pareto1.solutionSet.size(); i++) {

      Solution solutionYtrue = yTrueSolutionSet.get(i);
      double[] yTruePunto = {solutionYtrue.getObjective(0), solutionYtrue.getObjective(1)};

      double distanciaMinima = Double.MAX_VALUE;
      for (int j = 0; j < pareto2.solutionSet.size(); j++) {

        Solution solutionYPrima = yPrimaSolutionSet.get(j);
        double[] yPrimaPunto = {solutionYPrima.getObjective(0), solutionYPrima.getObjective(1)};

        Double aux = metricsUtils.distance(yTruePunto, yPrimaPunto);

        if (distanciaMinima > aux) {
          distanciaMinima = aux;
        }
      }
      sumaDistanciaMinima = sumaDistanciaMinima + distanciaMinima;
    }

    double distanciaFinal = (1.0 / (yTrueSolutionSet.size())) * sumaDistanciaMinima;

    return distanciaFinal;
  }
Ejemplo n.º 3
0
  public double getErrorYTrue(String fileYTrue, String fileYPrima) {
    MetricsUtil metricsUtils = new MetricsUtil();

    pareto1 = GenerarYTrue(fileYTrue);
    pareto2 = GenerarYTrue(fileYPrima);

    SolutionSet yTrueSolutionSet = pareto1.getSolutionSet();
    SolutionSet yPrimaSolutionSet = pareto2.getSolutionSet();

    double acumulador = 0;
    for (int i = 0; i < pareto1.solutionSet.size(); i++) {

      Solution solutionYtrue = yTrueSolutionSet.get(i);
      double[] yTruePunto = {solutionYtrue.getObjective(0), solutionYtrue.getObjective(1)};

      double distanciaMinima = Double.MAX_VALUE;
      for (int j = 0; j < pareto2.solutionSet.size(); j++) {

        Solution solutionYPrima = yPrimaSolutionSet.get(j);
        double[] yPrimaPunto = {solutionYPrima.getObjective(0), solutionYPrima.getObjective(1)};

        if (yTruePunto[0] == yPrimaPunto[0] && yTruePunto[1] == yPrimaPunto[1]) {
          acumulador++;
        }
      }
    }

    double error = 1.0 - ((1.0 / (yPrimaSolutionSet.size())) * acumulador);

    return error;
  }
Ejemplo n.º 4
0
  public double getExtension(String fileYTrue) {
    MetricsUtil metricsUtils = new MetricsUtil();

    pareto2 = GenerarYTrue(fileYTrue);

    SolutionSet yTrueSolutionSet = pareto2.getSolutionSet();
    Solution solutionYPrima;
    Solution solutionYtrue;
    double sumaDistanciaMaxima = 0.0;
    for (int i = 0; i < pareto2.solutionSet.size(); i++) {

      solutionYtrue = yTrueSolutionSet.get(i);
      double[] yTruePunto = {solutionYtrue.getObjective(0), solutionYtrue.getObjective(1)};

      double distanciaMaxima = Double.MIN_VALUE;
      for (int j = 0; j < pareto2.solutionSet.size(); j++) {

        solutionYPrima = yTrueSolutionSet.get(j);
        double[] yPrimaPunto = {solutionYPrima.getObjective(0), solutionYPrima.getObjective(1)};

        Double aux = metricsUtils.distance(yTruePunto, yPrimaPunto);

        if (distanciaMaxima < aux) {
          distanciaMaxima = aux;
        }
      }
      sumaDistanciaMaxima = sumaDistanciaMaxima + distanciaMaxima;
    }

    double distanciaFinal = Math.sqrt(sumaDistanciaMaxima);

    return distanciaFinal;
  }