Exemplo n.º 1
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);
   }
 }
 /**
  * Prints the gene in a way that can be read by readGene(). The default form simply calls
  * printGeneToString(state). Override this gene to do custom writing, or just override
  * printGeneToString(...), which is probably easier to do.
  *
  * @deprecated use printGeneToString instead
  */
 public void printGene(final EvolutionState state, final PrintWriter writer) {
   writer.println(printGeneToString(state));
 }