JavaGenes, NASA Ames. Written largely by Al Globus

gov.nasa.javaGenes.core
Class Breeder

java.lang.Object
  extended bygov.nasa.javaGenes.core.Breeder
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Breeder, Breeder, BreederElitist, BreederSteadyState, BreederSteadyState2

public abstract class Breeder
extends java.lang.Object
implements java.io.Serializable

Used to breed a population.

See Also:
Serialized Form

Field Summary
protected  ChildMakerProvider childMakerProvider
           
static boolean debug
           
protected  double tournamentProbability
           
 
Constructor Summary
Breeder(Parameters p)
          The argument contains many parameters including those necessary for breeding
 
Method Summary
 int antiTournamentGetIndex(Population p)
          returns index of tournament loser
 Population breed(Population parents)
          execute the breeding.
abstract  Population breed(Population parents, int kidsPerGeneration)
           
protected  Individual chooseBest(Individual first, Individual second)
           
protected  Individual chooseWorst(Individual first, Individual second)
           
 void generationIsComplete()
           
 boolean generationJustStarting()
           
 boolean generationNotComplete(int kidsPerGeneration)
           
 FitnessFunction getFitnessFunction()
           
 int getGenerationIndex()
           
 int getTotalNumberOfKidsProduced()
           
protected  boolean isProtected(Individual i)
          can protect certain individuals from losing an antiTournament and being replaced
 void newChild(Individual child)
           
 void newChildrenCreated(int number)
           
 Individual pickOne(Population p)
           
 void reportOnGeneration(int generation, java.lang.String filename)
           
 void setFitnessFunction(FitnessFunction f)
           
 void setGenerationIndex(int value)
           
 void setTotalNumberOfKidsProduced(int value)
           
 void stateRestore(TokenizeInput tokenizer)
          restore from a checkpoint
 void stateSave(TokenizeOutput tokenizer)
          checkpoint
 Individual tournament(Population p, Individual alreadyChosen)
          implements a two-way tournament.
 boolean useTournament()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values

childMakerProvider

protected ChildMakerProvider childMakerProvider

tournamentProbability

protected double tournamentProbability
Constructor Detail

Breeder

public Breeder(Parameters p)
The argument contains many parameters including those necessary for breeding

Method Detail

useTournament

public boolean useTournament()

setFitnessFunction

public void setFitnessFunction(FitnessFunction f)

getFitnessFunction

public FitnessFunction getFitnessFunction()

stateRestore

public void stateRestore(TokenizeInput tokenizer)
restore from a checkpoint


stateSave

public void stateSave(TokenizeOutput tokenizer)
checkpoint


breed

public Population breed(Population parents)
execute the breeding. Return the population produced.


breed

public abstract Population breed(Population parents,
                                 int kidsPerGeneration)

newChild

public void newChild(Individual child)

newChildrenCreated

public void newChildrenCreated(int number)

generationNotComplete

public boolean generationNotComplete(int kidsPerGeneration)

generationIsComplete

public void generationIsComplete()

generationJustStarting

public boolean generationJustStarting()

setGenerationIndex

public void setGenerationIndex(int value)

getGenerationIndex

public int getGenerationIndex()

getTotalNumberOfKidsProduced

public int getTotalNumberOfKidsProduced()

setTotalNumberOfKidsProduced

public void setTotalNumberOfKidsProduced(int value)

tournament

public Individual tournament(Population p,
                             Individual alreadyChosen)
implements a two-way tournament.

Parameters:
p - population to take tournament contenders from
alreadyChosen - don't ever pick this individual. May be null.

pickOne

public Individual pickOne(Population p)

chooseBest

protected Individual chooseBest(Individual first,
                                Individual second)

antiTournamentGetIndex

public int antiTournamentGetIndex(Population p)
returns index of tournament loser

Parameters:
p - population to take tournament contenders from

chooseWorst

protected Individual chooseWorst(Individual first,
                                 Individual second)

reportOnGeneration

public void reportOnGeneration(int generation,
                               java.lang.String filename)

isProtected

protected boolean isProtected(Individual i)
can protect certain individuals from losing an antiTournament and being replaced


JavaGenes, NASA Ames. Written largely by Al Globus