示例#1
0
 /**
  * Prints an entire subpopulation in a form readable by humans but also parseable by the computer
  * using readSubpopulation(EvolutionState, LineNumberReader) with a verbosity of
  * Output.V_NO_GENERAL.
  */
 public void printSubpopulation(final EvolutionState state, final int log) {
   state.output.println(NUM_INDIVIDUALS_PREAMBLE + Code.encode(individuals.length), log);
   for (int i = 0; i < individuals.length; i++) {
     state.output.println(INDIVIDUAL_INDEX_PREAMBLE + Code.encode(i), log);
     individuals[i].printIndividual(state, log);
   }
 }
示例#2
0
 /**
  * Prints an entire subpopulation in a form readable by humans but also parseable by the computer
  * using readSubpopulation(EvolutionState, LineNumberReader).
  */
 public void printSubpopulation(final EvolutionState state, final PrintWriter writer) {
   writer.println(NUM_INDIVIDUALS_PREAMBLE + Code.encode(individuals.length));
   for (int i = 0; i < individuals.length; i++) {
     writer.println(INDIVIDUAL_INDEX_PREAMBLE + Code.encode(i));
     individuals[i].printIndividual(state, writer);
   }
 }
 public String genotypeToString() {
   StringBuilder s = new StringBuilder();
   s.append(Code.encode(genome.length));
   for (int i = 0; i < genome.length; i++) s.append(Code.encode(genome[i]));
   return s.toString();
 }