Print

Print


I'm coevolving strategies for the game of Go.  Since evaluation
(playing games) take so long, my plan is to divide the strategies
(individuals) into pairs and have each pair play two games (one with
each player moving first).  The fitness of each individual ranges
from 0 to 100.  It is initially 50.  After a game, the winner's
fitness increases by the difference in scores, and the loser's
fitness decreases by this much.  An individual that stays around for
a long time will have a more accurate fitness score.

(Go players:  I'm using Chinese scoring on a 4x4 board with no komi,
so a player could gain or lose at most 16 points in one game.)

FIRST QUESTION:

Is it true that the setting below will evaluate the individuals in
groups of two, with each individual in one group?

eval = ec.coevolve.CompetitiveEvaluator
eval.style = rand-2-ways
eval.group-size = 2

SECOND QUESTION:

When an individual is copied, is the copy marked evaluated?  I don't
seem to be retaining the fitness individual from the previous round.
Specifically, given the problem class described below, the "residual
fitness" message is never printed.  Any ideas why this might be
happening?

(In the params file, I've got "pop.subpop.0.species.crossover-prob      =
0.1".)


public class GaProblem extends Problem implements GroupedProblemForm {

        /** Set all individuals to a default fitness of 50. */
        public void preprocessPopulation(EvolutionState state, Population
pop) {
                for (int i = 0; i < pop.subpops.length; i++) {
                        for (int j = 0; j < pop.subpops[i].individuals.length; j++) {
                                Individual ind = pop.subpops[i].individuals[j];
                                if (ind.evaluated) {
                                        System.out.println("Individual " + ind.hashCode()
                                                        + " has residual fitness "
                                                        + ((SimpleFitness) (ind.fitness)).fitness());
                                } else {
                                        System.out.println("Setting initial fitness of individual "
                                                        + ind.hashCode());
                                        ((SimpleFitness) (ind.fitness))
                                                        .setFitness(state, 50, false);
                                }
                        }
                }
        }

        /** Set any fitnesses above 100 to 100, below 0 to 0. */
        public void postprocessPopulation(EvolutionState state, Population
pop) {
                for (int i = 0; i < pop.subpops.length; i++) {
                        for (int j = 0; j < pop.subpops[i].individuals.length; j++) {
                                Individual ind = pop.subpops[i].individuals[j];
                                float raw = ((SimpleFitness) (ind.fitness)).fitness();
                                float cooked = Math.max(0, Math.min(100, raw));
                                ((SimpleFitness) (ind.fitness))
                                                .setFitness(state, cooked, false);
                                ind.evaluated = true;
                        }
                }
        }

     // ... other details of class omitted.

}

Peter Drake
Assistant Professor of Computer Science
Lewis & Clark College
http://www.lclark.edu/~drake/