Exemplo n.º 1
0
        public GameAINeuroEvolutionaryLearning(int size, FileStream file)
        {
            population = new List <Strategy>();
            this.size  = size;
            rand       = new ThreadSafeRandom();
            Strategy strategy = (Strategy)Network.Load(file);

            population.Add(strategy);
            for (int i = 0; i < size - 1; i++)
            {
                population.Add(strategy.CreateNew());
            }
        }
Exemplo n.º 2
0
        public void Regenerate()
        {
            Strategy ancestor = population[0];

            // clear population
            population.Clear();
            // add chromosomes to the population
            for (int i = 0; i < size; i++)
            {
                // create new chromosome
                Strategy c = ancestor.CreateNew();
                // calculate it's fitness
                // add it to population
                population.Add(c);
            }
            Evaluate();
        }
Exemplo n.º 3
0
        public GameAINeuroEvolutionaryLearning(int size)
        {
            population = new List <Strategy>();
            this.size  = size;
            rand       = new ThreadSafeRandom();
            Strategy strategy = new Strategy(
                //new SigmoidFunction(),
                new LineFunction(),
                Settings.MAX_CHESSES,
                Settings.NETWORK_STRUCT);

            population.Add(strategy);
            for (int i = 0; i < size - 1; i++)
            {
                population.Add(strategy.CreateNew());
            }
        }
Exemplo n.º 4
0
 public GameAINeuroEvolutionaryLearning(int size)
 {
     population = new List<Strategy>();
     this.size = size;
     rand = new ThreadSafeRandom();
     Strategy strategy = new Strategy(
         //new SigmoidFunction(),
         new LineFunction(),
         Settings.MAX_CHESSES,
         Settings.NETWORK_STRUCT);
     population.Add(strategy);
     for (int i = 0; i < size - 1; i++)
     {
         population.Add(strategy.CreateNew());
     }
 }