GeneThello Home

net.sf.genethello.ga
Class GFitnessFunction

java.lang.Object
  extended by org.jgap.BulkFitnessFunction
      extended by net.sf.genethello.ga.GFitnessFunction
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.jgap.util.ICloneable

public class GFitnessFunction
extends org.jgap.BulkFitnessFunction

Fitness function for evaluating othello individuals in genetic algorithm.

Author:
Bowo
See Also:
Serialized Form

Field Summary
static int CHROMOSOME
          Order of field 'chromosome' in insert/update population table.
static int CURRENT
          Order of field 'current' in insert/update population table.
static int DRAW
          Order of field 'draw' in insert/update population table.
static int ELO
          Order of field 'elo' in insert/update population table.
static int GENERATION
          Order of field 'generation' in insert/update population table.
static int LOSE
          Order of field 'lose' in insert/update population table.
static int WIN
          Order of field 'win' in insert/update population table.
 
Constructor Summary
GFitnessFunction(ChromosomeCreator chromosomeCreator, boolean verbose, boolean nosleep, boolean network)
          Creates new instance of fitness function.
 
Method Summary
 void evaluate(org.jgap.Population arg0)
          Performs a full cycle of othello tournament for all individuals versus all other individuals, twice for each couple playing black and white alternately, and sets the fitness value.
 void setGeneration(int gen)
          Sets current generation.
protected  void tournament(org.jgap.IChromosome a_ic, org.jgap.IChromosome b_ic, java.sql.Connection connection)
          Performs a match between two othello individuals, then updates the ELO rating.
 
Methods inherited from class org.jgap.BulkFitnessFunction
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIN

public static final int WIN
Order of field 'win' in insert/update population table.

See Also:
Constant Field Values

LOSE

public static final int LOSE
Order of field 'lose' in insert/update population table.

See Also:
Constant Field Values

DRAW

public static final int DRAW
Order of field 'draw' in insert/update population table.

See Also:
Constant Field Values

ELO

public static final int ELO
Order of field 'elo' in insert/update population table.

See Also:
Constant Field Values

GENERATION

public static final int GENERATION
Order of field 'generation' in insert/update population table.

See Also:
Constant Field Values

CHROMOSOME

public static final int CHROMOSOME
Order of field 'chromosome' in insert/update population table.

See Also:
Constant Field Values

CURRENT

public static final int CURRENT
Order of field 'current' in insert/update population table.

See Also:
Constant Field Values
Constructor Detail

GFitnessFunction

public GFitnessFunction(ChromosomeCreator chromosomeCreator,
                        boolean verbose,
                        boolean nosleep,
                        boolean network)
Creates new instance of fitness function.

Parameters:
chromosomeCreator - chromosome creator
verbose - print verbose information or not
nosleep - use full CPU power or not
network - use network or not
Method Detail

setGeneration

public void setGeneration(int gen)
Sets current generation.

Parameters:
gen - generation

tournament

protected void tournament(org.jgap.IChromosome a_ic,
                          org.jgap.IChromosome b_ic,
                          java.sql.Connection connection)
Performs a match between two othello individuals, then updates the ELO rating.

Parameters:
a_ic - chromosome for black player
b_ic - chromosome for white player
connection - database connection

evaluate

public void evaluate(org.jgap.Population arg0)
Performs a full cycle of othello tournament for all individuals versus all other individuals, twice for each couple playing black and white alternately, and sets the fitness value.

Specified by:
evaluate in class org.jgap.BulkFitnessFunction
Parameters:
arg0 - population of othello individuals

GeneThello Home

Get GeneThello: Genetic Othello at SourceForge.net. Fast, secure and Free Open Source software downloads