Print

Print


On Jul 23, 2004, at 1:40 PM, #TA NGUYEN BINH DUONG# wrote:

> Thank you for your help. But what's the format of the file to init the
> population? I could not find it anywhere in the documents provided.

Each subpopulation can load from a separate file, where each individual
is written, in order, to that file using the format produced with
Individual.printIndividual(...).

If you'd like to see what such a file looks like, change SimpleFinisher
to look like this, and it will write out a file at the end of the
evolutionary run for Subpopulation 0:

package ec.simple;
import ec.Finisher;
import ec.EvolutionState;
import ec.util.Parameter;

public class SimpleFinisher extends Finisher
     {
     public void setup(final EvolutionState state, final Parameter base)
{ }
     public void finishPopulation(final EvolutionState state, final int
result)
         {
         try
             {
             int log = state.output.addLog(
                 new java.io.File("example.log"),0,false,false);
             for (int
x=0;x<state.population.subpops[0].individuals.length;x++)
                 {
                 ec.Individual i =
state.population.subpops[0].individuals[x];
                 i.printIndividual(state,log,100);
                 }
             }
         catch (java.io.IOException e) { }
         return;
         }
     }