예제 #1
0
  /**
   * Obtains the parameters used in the execution of the algorithm and stores them in the private
   * variables of the class
   *
   * @param ficheroScript Name of the configuration script that indicates the parameters that are
   *     going to be used during the execution of the algorithm
   */
  public void leerConfiguracion(String ficheroScript) {

    String fichero, linea, token;
    StringTokenizer lineasFichero, tokens;
    byte line[];
    int i, j;

    ficheroSalida = new String[2];

    fichero = Fichero.leeFichero(ficheroScript);
    lineasFichero = new StringTokenizer(fichero, "\n\r");

    lineasFichero.nextToken();
    linea = lineasFichero.nextToken();

    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();

    /*Getting the names of the training and test files*/
    line = token.getBytes();
    for (i = 0; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroTraining = new String(line, i, j - i);
    for (i = j + 1; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroTest = new String(line, i, j - i);

    /*Getting the path and base name of the results files*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();

    /*Getting the names of output files*/
    line = token.getBytes();
    for (i = 0; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroSalida[0] = new String(line, i, j - i);
    for (i = j + 1; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroSalida[1] = new String(line, i, j - i);

    /*Getting the seed*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    semilla = Long.parseLong(tokens.nextToken().substring(1));

    /*Getting the number of neighbors*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    k = Integer.parseInt(tokens.nextToken().substring(1));
  }
예제 #2
0
파일: SGA.java 프로젝트: Navieclipse/KEEL
  /**
   * Reads configuration script, and extracts its contents.
   *
   * @param ficheroScript Name of the configuration script
   */
  public void leerConfiguracion(String ficheroScript) {

    String fichero, linea, token;
    StringTokenizer lineasFichero, tokens;
    byte line[];
    int i, j;

    ficheroSalida = new String[2];

    fichero = Fichero.leeFichero(ficheroScript);
    lineasFichero = new StringTokenizer(fichero, "\n\r");

    lineasFichero.nextToken();
    linea = lineasFichero.nextToken();

    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();

    /*Getting the names of training and test files*/
    line = token.getBytes();
    for (i = 0; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroTraining = new String(line, i, j - i);
    for (i = j + 1; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroTest = new String(line, i, j - i);

    /*Getting the path and base name of the results files*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();

    /*Getting the names of output files*/
    line = token.getBytes();
    for (i = 0; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroSalida[0] = new String(line, i, j - i);
    for (i = j + 1; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroSalida[1] = new String(line, i, j - i);

    /*Getting the seed*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    semilla = Long.parseLong(tokens.nextToken().substring(1));

    /*Getting the mutation and cross probability*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    pMutacion1to0 = Double.parseDouble(tokens.nextToken().substring(1));
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    pMutacion0to1 = Double.parseDouble(tokens.nextToken().substring(1));
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    pCruce = Double.parseDouble(tokens.nextToken().substring(1));

    /*Getting the size of the population and number of evaluations*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    tamPoblacion = Integer.parseInt(tokens.nextToken().substring(1));
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    nEval = Integer.parseInt(tokens.nextToken().substring(1));

    /*Getting the alfa equilibrate factor*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    alfa = Double.parseDouble(tokens.nextToken().substring(1));

    /*Getting the type of selection*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();
    token = token.substring(1);
    if (token.equalsIgnoreCase("binary_tournament")) torneo = true;
    else torneo = false;

    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    kNeigh = Integer.parseInt(tokens.nextToken().substring(1));

    /*Getting the type of distance function*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    distanceEu = tokens.nextToken().substring(1).equalsIgnoreCase("Euclidean") ? true : false;
  } // end-method
예제 #3
0
파일: Depur.java 프로젝트: Navieclipse/KEEL
  public void leerConfiguracion(String ficheroScript) {

    String fichero, linea, token;
    StringTokenizer lineasFichero, tokens;
    byte line[];
    int i, j;

    ficheroSalida = new String[2];

    fichero = Fichero.leeFichero(ficheroScript);
    lineasFichero = new StringTokenizer(fichero, "\n\r");

    lineasFichero.nextToken();
    linea = lineasFichero.nextToken();

    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();

    /*Getting the names of the training and test files*/
    line = token.getBytes();
    for (i = 0; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroTraining = new String(line, i, j - i);
    for (i = j + 1; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroTest = new String(line, i, j - i);

    /*Getting the path and base name of the results files*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();

    /*Getting the names of output files*/
    line = token.getBytes();
    for (i = 0; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroSalida[0] = new String(line, i, j - i);
    for (i = j + 1; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroSalida[1] = new String(line, i, j - i);

    /*Getting the number of neighbours*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    k = Integer.parseInt(tokens.nextToken().substring(1));

    /*Getting the k' */
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    k2 = Integer.parseInt(tokens.nextToken().substring(1));

    /*Getting the type of distance function*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    distanceEu = tokens.nextToken().substring(1).equalsIgnoreCase("Euclidean") ? true : false;
  }