|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
org.vizzini.game.boardgame.AbstractGameGeneticAlgorithm
public abstract class AbstractGameGeneticAlgorithm
Provides base functionality for game genetic algorithms in the game framework.
Field Summary |
---|
Fields inherited from class org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm |
---|
_crossoverFraction, _crossoverType, _elapsedTime, _generation |
Constructor Summary | |
---|---|
AbstractGameGeneticAlgorithm()
Construct this object using the given parameters. |
Method Summary | |
---|---|
protected void |
configureAgent(IComputerAgent agent,
IChromosome chromosome)
Configure the given agent for play. |
protected abstract IComputerAgent |
createAgent0()
Create agent 0. |
protected abstract IComputerAgent |
createAgent1()
Create agent 0. |
protected IGame |
createGame()
Create the game. |
protected void |
evaluateFitness()
Evaluate the fitness of all chromosomes in the population. |
int |
getFitnessLoss()
Return the fitness loss value. |
int |
getFitnessTie()
Return the fitness tie value. |
int |
getFitnessWin()
Return the fitness win value. |
protected IGame |
getGame()
Return the game. |
protected abstract String |
getGamePropertiesPath()
Return the game properties path. |
protected int |
getMaxOpponentCount()
Return the maximum opponent count. |
protected boolean |
isVerbose()
Return true if the verbose flag is set. |
protected void |
rewardAndPunish(int i,
int j)
Reward and punish the given chromosomes. |
protected void |
setAgent0(IComputerAgent agent)
Set the first agent. |
protected void |
setAgent1(IComputerAgent agent)
Set the second agent. |
void |
setFitnessLoss(int fitness)
Set the fitness loss value. |
void |
setFitnessTie(int fitness)
Set the fitness tie value. |
void |
setFitnessWin(int fitness)
Set the fitness win value. |
protected void |
setGame(IGame game)
Set the game. |
void |
setTurnNumberConsidered(boolean isTurnNumberConsidered)
Set the flag which indicates whether the turn number is used in reward and punishment. |
void |
setVerbose(boolean isVerbose)
Set the flag which indicates whether to provide text output. |
String |
toString()
Return a string representation of this object. |
protected void |
zeroCounts()
Zero the counts. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.vizzini.ai.geneticalgorithm.IGeneticAlgorithm |
---|
getCrossoverFraction, getCrossoverType, getElapsedTime, getGeneration, getMostFit, getMutationFraction, getMutationMagnitude, getMutationRate, getPopulationSize, getProcessingRate, reset, runGenerations, setAverageCrossoverFraction, setCrossoverFraction, setCrossoverType, setDuplicateAllowed, setMutationFraction, setMutationMagnitude, setMutationRate, setPopulationSize, writeReport |
Constructor Detail |
---|
public AbstractGameGeneticAlgorithm() throws InstantiationException, IllegalAccessException
InstantiationException
IllegalAccessException
Method Detail |
---|
public int getFitnessLoss()
getFitnessLoss
in interface IGameGeneticAlgorithm
public int getFitnessTie()
getFitnessTie
in interface IGameGeneticAlgorithm
public int getFitnessWin()
getFitnessWin
in interface IGameGeneticAlgorithm
public void setFitnessLoss(int fitness)
setFitnessLoss
in interface IGameGeneticAlgorithm
public void setFitnessTie(int fitness)
setFitnessTie
in interface IGameGeneticAlgorithm
public void setFitnessWin(int fitness)
setFitnessWin
in interface IGameGeneticAlgorithm
public void setTurnNumberConsidered(boolean isTurnNumberConsidered)
public void setVerbose(boolean isVerbose)
setVerbose
in interface IGameGeneticAlgorithm
public String toString()
toString
in class AbstractGeneticAlgorithm
protected abstract IComputerAgent createAgent0()
protected abstract IComputerAgent createAgent1()
protected abstract String getGamePropertiesPath()
protected void configureAgent(IComputerAgent agent, IChromosome chromosome)
protected IGame createGame() throws InstantiationException, IllegalAccessException
InstantiationException
IllegalAccessException
protected void evaluateFitness()
evaluateFitness
in class AbstractGeneticAlgorithm
protected IGame getGame()
protected int getMaxOpponentCount()
protected boolean isVerbose()
protected void rewardAndPunish(int i, int j)
protected void setAgent0(IComputerAgent agent)
protected void setAgent1(IComputerAgent agent)
protected void setGame(IGame game)
protected void zeroCounts()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |