|
ABLE, Version 1.1b | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.rmi.server.RemoteObject | +--java.rmi.server.RemoteServer | +--java.rmi.server.UnicastRemoteObject | +--com.ibm.able.AbleObject | +--com.ibm.able.agents.AbleDefaultAgent | +--com.ibm.able.agents.AbleGeneticSearchAgent
This class implements an AbleAgent for conducting genetic search over a population of AbleBeans. An intermediate class, derived from AbleGeneticObject is used as an interface between this agent and the original AbleBeans.
Field Summary | |
protected boolean |
autoEvolve
|
protected double |
avgFitness
|
protected int |
chromosomeLength
|
protected java.util.Hashtable |
chromosomeList
|
protected double |
crossoverRate
|
protected boolean |
evolving
|
protected double |
fitnessThreshold
|
protected java.lang.Class |
geneticObjectClass
|
protected java.lang.String |
geneticObjectClassName
|
protected double[] |
inNum
|
protected java.lang.String[] |
inSym
|
protected double |
maxFitness
|
protected int |
maxNumPasses
|
protected double |
minFitness
|
protected double |
mutationRate
|
protected boolean |
noDuplicatesAllowed
|
protected int |
numPasses
|
protected java.util.Hashtable |
operatorFitness
|
protected double[] |
outNum
|
protected java.lang.String[] |
outSym
|
protected java.util.Vector |
population
|
protected int |
populationSize
|
static int |
REPLACE_ALL
|
static int |
REPLACE_SOME
|
protected int |
replacementSize
|
protected int |
reproductionTechnique
|
protected java.lang.String |
sourceFileName
The genetic search algorithm is as follows: 1. |
protected double[] |
summedFitness
|
protected double |
totalFitness
|
protected double |
totalNormalizedFitness
|
protected boolean |
useNormalizedFitness
|
protected java.lang.String |
vocabulary
|
Fields inherited from class com.ibm.able.agents.AbleDefaultAgent |
activeDataSource,
agentAddr,
agentHost,
agentName,
beans,
effectors,
eventConnections,
numEpochs,
processList,
processListOK,
sensors |
Fields inherited from class com.ibm.able.AbleObject |
changed,
chgSupport,
comment,
dataFlowEnabled,
destBufferConnections,
eventQueue,
fileName,
inputBuffer,
listeners,
logger,
name,
outputBuffer,
parent,
propertyConnectionMgr,
sourceBufferConnections,
state,
stateChgSupport |
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Constructor Summary | |
AbleGeneticSearchAgent()
construct a genetic search agent |
|
AbleGeneticSearchAgent(java.lang.String aName)
construct a genetic search agent with specified name |
Method Summary | |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
AbleGeneticObject |
createChild(java.lang.Object chromosome)
Given a prospective chromosome a) see if dups are allowed and if it is unique b) if ok, create a child genetic object from the chromsome and initialize the associated bean (if any) |
AbleGeneticObject[] |
createChildren(java.lang.Object[] chromosome)
given a newly derived chromosome(s), create a new population member(s) and initialize it/them Note: could be zero, one or two (depending on operators and if no dups allowed) |
protected java.util.Vector |
createNewMembers()
Generate replacementSize population members through application of genetic operators Note: if replacementSize = populationSize we use elitism, the best member (highest fitness) is always carried over |
protected void |
evaluatePopulation()
evaluate each population member based on fitness first process the AbleBeans contained in this SearchAgent if an evaluationAgent bean exists, process() it compute min, max, avg, and total fitness if normalization is specified, then normalize the raw fitness values |
void |
evolve()
automatically evolve the population by turning the evolving boolean on create and start the async thread if it is not already running |
boolean |
getAutoEvolve()
|
double |
getAvgFitness()
Get the average raw fitness value for the current population |
int |
getChromosomeLength()
Get the length of the chromsome used by the current genetic objects |
double |
getCrossoverRate()
Get the crossover rate |
double |
getFitnessThreshold()
Get the raw fitness threshold value |
java.lang.String |
getGeneticObjectClassName()
Return the name of the genetic object class |
double |
getMaxFitness()
Get the maximum raw fitness value for the current population |
int |
getMaxNumPasses()
Get the maximum number of passes to search |
double |
getMinFitness()
Get the minimum raw fitness value for the current population |
double |
getMutationRate()
Get the current mutation rate |
int |
getNumPasses()
Get the number of generations we have searched |
java.util.Hashtable |
getOperatorFitness()
Get the supported operators and their fitness (selection probability) values |
java.util.Vector |
getPopulation()
|
int |
getPopulationSize()
Get the population size |
int |
getReplacementSize()
Get the replacement size |
java.lang.String |
getSourceFileName()
not sure if we need this |
java.lang.String |
getVocabulary()
Get the chromosome vocabulary (default is "01") |
void |
init()
generate a complete genetic search agent |
protected void |
insertIntoPopulation(AbleGeneticObject newMember,
java.util.Vector list)
Insert a member into the population vector sorted by raw fitness update the min and max fitness values |
protected void |
integratePopulation(java.util.Vector newPopulation)
add the new members to the population reduce the population by removing lowest fitness members of current population |
boolean |
isEvolving()
Check to see if the agent is in the process of evolving. |
boolean |
isNoDuplicatesAllowed()
Get the boolean flag indicating whether duplicate members are allowed or not |
boolean |
isUseNormalizedFitness()
Get the boolean flag indicating whether raw or normalized fitness is used. |
protected void |
normalizeFitness()
perform linear normalization of the raw fitness values also pre-compute the summed fitness values for roulette wheel selection where the normalizedFitness of the best population member is equal to 2 times the average fitness |
void |
process()
This method performs the following steps: 1. |
void |
processTimerEvent()
This method is called from the asynch thread It is only used for automated evolution the population |
protected void |
removeLastNFromPopulation(int n)
remove the last N members (with lowest fitness) from the population |
void |
reset()
Reset each bean in the agent. |
AbleGeneticObject |
rouletteWheelSelection()
Select a member of the population using the roulette wheel algorithm |
java.lang.String |
selectOperator()
randomly select an operator to be applied to the parents using a roulette wheel selection technique Note: total operator fitness must be equal to 100 |
AbleGeneticObject[] |
selectParents()
choose two population members to reproduce using rouletteWheel selection technique |
void |
setAutoEvolve(boolean state)
|
void |
setCrossoverRate(double rate)
Set the crossoverRate , used when a crossover operator is selected to determine whether a crossover will actually be performed |
void |
setFitnessThreshold(double thresh)
Set the raw fitness threshold This is used to halt the search if the raw fitness value exceeds this threshold |
void |
setGeneticObjectClassName(java.lang.String aClassName)
Set the name of the class of genetic objects we are searching |
void |
setMaxNumPasses(int num)
Set the maximum number of generations to search |
void |
setMode(int mode)
set the internal config for either 0 = training from an external file or 1 = running (with network locked) from data placed in the input buffer |
void |
setMutationRate(double rate)
Set the mutationRate, used when a mutate operator is selected this value is used to determine whether each bit is mutated or not mutation can be to any other value in the vocabulary |
void |
setNoDuplicatesAllowed(boolean state)
Set a boolean flag indicating whether members with duplicate chromosomes are allowed in the population or not. |
void |
setOperatorFitness(java.util.Hashtable opFitness)
Set a hashtable of operators and their fitness values These values are used to select operators for application during reproduction Fitness values should sum to 100 |
void |
setPopulationSize(int size)
Set the population size |
void |
setReplacementSize(int size)
Set the number of population members to replace each generation |
void |
setSourceFileName(java.lang.String aFileName)
not sure if we need this |
void |
setUseNormalizedFitness(boolean state)
Set the boolean flag indicating whether raw or normalized fitness values should be used for selecting members for reproduction. |
void |
startEvolving()
start automatically evolving from the external data |
void |
stopEvolving()
stop automatically training the model from the external data |
Methods inherited from class com.ibm.able.agents.AbleDefaultAgent |
addBean,
addEffector,
addEventConnection,
addSensor,
buildProcessList,
clsNm,
containsBean,
containsBean,
debugTrace,
getAgentAddr,
getAgentHost,
getAgentName,
getBean,
getBeans,
getDataSource,
getEffectors,
getNumEpochs,
getProcessList,
getSensors,
handleAbleEvent,
init,
invokeEffector,
invokeSensor,
isActiveDataSource,
main,
propertyChange,
quitAll,
quitEnabledEventProcessing,
removeAllBeans,
removeBean,
removeEffector,
removeEventConnection,
removeSensor,
resumeAll,
rmiRebind,
rmiUnbind,
setActiveDataSource,
setEffectors,
setProcessList,
setSensors,
suspendAll,
toString |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone,
exportObject,
exportObject,
exportObject,
unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost,
getLog,
setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals,
getRef,
hashCode,
toStub |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int REPLACE_ALL
public static final int REPLACE_SOME
protected java.lang.String sourceFileName
protected int reproductionTechnique
protected java.lang.Class geneticObjectClass
protected java.util.Vector population
protected java.util.Hashtable chromosomeList
protected java.util.Hashtable operatorFitness
protected int chromosomeLength
protected java.lang.String vocabulary
protected java.lang.String geneticObjectClassName
protected int maxNumPasses
protected double fitnessThreshold
protected int populationSize
protected int replacementSize
protected double crossoverRate
protected double mutationRate
protected boolean noDuplicatesAllowed
protected boolean useNormalizedFitness
protected boolean autoEvolve
protected double maxFitness
protected double minFitness
protected double avgFitness
protected double totalFitness
protected double totalNormalizedFitness
protected double[] summedFitness
protected int numPasses
protected boolean evolving
protected double[] inNum
protected double[] outNum
protected java.lang.String[] inSym
protected java.lang.String[] outSym
Constructor Detail |
public AbleGeneticSearchAgent() throws java.rmi.RemoteException
public AbleGeneticSearchAgent(java.lang.String aName) throws java.rmi.RemoteException
Method Detail |
public void init() throws java.rmi.RemoteException
public void process() throws java.rmi.RemoteException
public void processTimerEvent() throws java.rmi.RemoteException
public void setSourceFileName(java.lang.String aFileName)
public java.lang.String getSourceFileName()
public void setGeneticObjectClassName(java.lang.String aClassName)
aClassName
- fully specified (package prefixed) class namepublic java.lang.String getGeneticObjectClassName()
public void setPopulationSize(int size)
size
- the population sizepublic int getPopulationSize()
public java.util.Vector getPopulation()
public void setReplacementSize(int size)
size
- the number of members to be replacedpublic int getReplacementSize()
public java.lang.String getVocabulary()
public int getNumPasses()
public void setMaxNumPasses(int num)
num
- the maximum number of generations to createpublic int getMaxNumPasses()
public void setFitnessThreshold(double thresh)
thresh
- the fitness thresholdpublic double getFitnessThreshold()
public void setCrossoverRate(double rate)
public double getCrossoverRate()
public void setMutationRate(double rate)
public double getMutationRate()
public double getAvgFitness()
public double getMinFitness()
public double getMaxFitness()
public int getChromosomeLength()
public void setAutoEvolve(boolean state)
public boolean getAutoEvolve()
public void setNoDuplicatesAllowed(boolean state)
state
- whether duplicates should be allowed (false) or not (true)public boolean isNoDuplicatesAllowed()
public void setUseNormalizedFitness(boolean state)
public boolean isUseNormalizedFitness()
public void setOperatorFitness(java.util.Hashtable opFitness)
public java.util.Hashtable getOperatorFitness()
public void setMode(int mode)
public AbleGeneticObject[] createChildren(java.lang.Object[] chromosome)
one
- or two chromosome objectspublic AbleGeneticObject createChild(java.lang.Object chromosome)
chromosome
- - the chromosome defining the childprotected void evaluatePopulation()
protected void normalizeFitness()
protected java.util.Vector createNewMembers()
protected void integratePopulation(java.util.Vector newPopulation)
a
- vector of new genetic objects to add to the populationprotected void insertIntoPopulation(AbleGeneticObject newMember, java.util.Vector list)
newMember
- -- the genetic object to insert into the populationlist
- -- the population vectorprotected void removeLastNFromPopulation(int n)
n
- the number of population members to removepublic AbleGeneticObject[] selectParents()
public java.lang.String selectOperator()
public AbleGeneticObject rouletteWheelSelection()
public boolean isEvolving() throws java.rmi.RemoteException
public void evolve()
public void startEvolving() throws java.rmi.RemoteException
public void stopEvolving() throws java.rmi.RemoteException
public void reset() throws java.rmi.RemoteException
public static java.lang.String Copyright()
|
ABLE, Version 1.1b | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |