private void state2() throws IOException {
  int[] selectionIds=readList(new File(filePrefix + "sel"));
  int[] archivedIds=readList(new File(filePrefix + "arc"));
  int[] variationIds=new int[lambda];
  if (selectionIds.length != mu) {
    throw new IOException("invalid selection length");
  }
  updatePopulation(archivedIds);
  clearFile(new File(filePrefix + "sel"));
  clearFile(new File(filePrefix + "arc"));
  List<Solution> offspring=new ArrayList<Solution>();
  for (int i=0; i < mu; i+=variation.getArity()) {
    Solution[] parents=new Solution[variation.getArity()];
    for (int j=0; j < variation.getArity(); j++) {
      parents[j]=solutions.get(selectionIds[i + j]);
    }
    offspring.addAll(Arrays.asList(variation.evolve(parents)));
  }
  if (offspring.size() != lambda) {
    throw new IOException("invalid variation length");
  }
  evaluateAll(offspring);
  for (int i=0; i < lambda; i++) {
    variationIds[i]=addToPopulation(offspring.get(i));
  }
  writePopulation(new File(filePrefix + "var"),variationIds);
}

private void state2 ( ) throws IOException { int [ ] selectionIds = readList ( new File ( filePrefix + "sel" ) ) ; int [ ] archivedIds = readList ( new File ( filePrefix + "arc" ) ) ; int [ ] variationIds = new int [ lambda ] ; if ( selectionIds . length != mu ) { throw new IOException ( "invalid selection length" ) ; } updatePopulation ( archivedIds ) ; clearFile ( new File ( filePrefix + "sel" ) ) ; clearFile ( new File ( filePrefix + "arc" ) ) ; List < Solution > offspring = new ArrayList < Solution > ( ) ; for ( int i = 0 ; i < mu ; i += variation . getArity ( ) ) { Solution [ ] parents = new Solution [ variation . getArity ( ) ] ; for ( int j = 0 ; j < variation . getArity ( ) ; j ++ ) { parents [ j ] = solutions . get ( selectionIds [ i + j ] ) ; } offspring . addAll ( Arrays . asList ( variation . evolve ( parents ) ) ) ; } if ( offspring . size ( ) != lambda ) { throw new IOException ( "invalid variation length" ) ; } evaluateAll ( offspring ) ; for ( int i = 0 ; i < lambda ; i ++ ) { variationIds [ i ] = addToPopulation ( offspring . get ( i ) ) ; } writePopulation ( new File ( filePrefix + "var" ) , variationIds ) ; }
the commands to execute when in state 2 .
