/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tileworld;

import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.epochx.ge.model.GEModel;
import org.epochx.life.GenerationAdapter;
import org.epochx.life.Life;
import org.epochx.stats.Stats;
import org.epochx.stats.StatField;
/**
 *
 * @author Jakub
 */
public class Test {
      
    public static void main(String[] args) throws IOException {
        
        final DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
              new FileOutputStream("output.csv")));
        GEModel model = new modelGeneticEvolution();
        model.setPopulationSize(2000);
        model.setNoGenerations(200);
        model.setMaxInitialDepth(12);
        model.setMaxDepth(17);
        model.setNoElites(3);
      
        model.setReproductionProbability(0);
        model.setMutationProbability(0.3);
        model.setCrossoverProbability(0.7);
        Life.get().addGenerationListener(new GenerationAdapter(){
            
            public void onGenerationEnd() {
                Stats.get().print(StatField.GEN_NUMBER,StatField.GEN_FITNESS_MIN,StatField.GEN_FITNESS_MAX,StatField.GEN_FITNESS_MEDIAN);
                Stats.get().print(StatField.GEN_FITTEST_PROGRAM);
                Stats.get().print(StatField.ELITE_PROGRAMS);
                Stats.get().printToStream(out, StatField.GEN_NUMBER,StatField.GEN_FITNESS_MIN,StatField.GEN_FITNESS_MAX,StatField.GEN_FITNESS_MEDIAN,StatField.GEN_FITTEST_PROGRAM);
            }
        });
        model.run();
        
    }
}
