private void convert(Problem problem,boolean reduced,ResultFileReader reader,PrintWriter writer){
  int numberOfVariables=problem.getNumberOfVariables();
  int numberOfObjectives=problem.getNumberOfObjectives();
  if (reduced) {
    numberOfVariables=0;
  }
  while (reader.hasNext()) {
    ResultEntry entry=reader.next();
    Population population=entry.getPopulation();
    Properties properties=entry.getProperties();
    if (population.isEmpty()) {
      continue;
    }
    if (properties.containsKey("NFE")) {
      writer.print(properties.getProperty("NFE"));
    }
 else {
      writer.print("0");
    }
    writer.print(" ");
    if (properties.containsKey("ElapsedTime")) {
      writer.println(properties.getProperty("ElapsedTime"));
    }
 else {
      writer.println("0");
    }
    writer.println("#");
    for (    Solution solution : population) {
      for (int i=0; i < numberOfVariables; i++) {
        if (i > 0) {
          writer.print(" ");
        }
        writer.print(solution.getVariable(i));
      }
      for (int i=0; i < numberOfObjectives; i++) {
        if ((i > 0) || (numberOfVariables > 0)) {
          writer.print(" ");
        }
        writer.print(solution.getObjective(i));
      }
      writer.println();
    }
    writer.println("#");
  }
}

private void convert ( Problem problem , boolean reduced , ResultFileReader reader , PrintWriter writer ) { int numberOfVariables = problem . getNumberOfVariables ( ) ; int numberOfObjectives = problem . getNumberOfObjectives ( ) ; if ( reduced ) { numberOfVariables = 0 ; } while ( reader . hasNext ( ) ) { ResultEntry entry = reader . next ( ) ; Population population = entry . getPopulation ( ) ; Properties properties = entry . getProperties ( ) ; if ( population . isEmpty ( ) ) { continue ; } if ( properties . containsKey ( "NFE" ) ) { writer . print ( properties . getProperty ( "NFE" ) ) ; } else { writer . print ( "0" ) ; } writer . print ( " " ) ; if ( properties . containsKey ( "ElapsedTime" ) ) { writer . println ( properties . getProperty ( "ElapsedTime" ) ) ; } else { writer . println ( "0" ) ; } writer . println ( "#" ) ; for ( Solution solution : population ) { for ( int i = 0 ; i < numberOfVariables ; i ++ ) { if ( i > 0 ) { writer . print ( " " ) ; } writer . print ( solution . getVariable ( i ) ) ; } for ( int i = 0 ; i < numberOfObjectives ; i ++ ) { if ( ( i > 0 ) || ( numberOfVariables > 0 ) ) { writer . print ( " " ) ; } writer . print ( solution . getObjective ( i ) ) ; } writer . println ( ) ; } writer . println ( "#" ) ; } }
converts and writes the contents of the result file to the aerovis format .
