|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--net.openai.ai.ga.GeneticAlgorithm
GeneticAlgorithm is the top-level class for the Genetic Algorithm Java implementation of the OpenAI Toolkit. It provides the handling of multiple worlds (isolated genetic algorithm implementations) and making the algorithms run.
| Constructor Summary | |
GeneticAlgorithm()
Initializes the GeneticAlgorithm with an ArrayList |
|
GeneticAlgorithm(java.util.Collection initialCollection)
Initializes the GeneticAlgorithm with the specified
Collection |
|
| Method Summary | |
void |
addWorld(World toAdd)
Adds a given World onto the end of all the worlds in this Genetic Algorithm. |
void |
cleanse()
Removes non- World objects from the Collection
|
static boolean |
getDebug()
|
int |
getNumberOfWorlds()
Returns the number of Worlds stored in this
GeneticAlgorithm. |
World |
getWorld(java.lang.String name)
Retrieves a World from the list with a given name. |
World[] |
getWorldArray()
Retrieves a World[] copy of all the World's in this GeneticAlgorithm. |
java.util.Iterator |
getWorldIterator()
Return an Iterator to use to go through all the
Worlds in this GeneticAlgorithm. |
java.lang.String[] |
getWorldNames()
Retrieves a World from the list with a given name. |
java.util.Collection |
getWorlds()
Retrieves the Collection that holds this collection's
World objects |
void |
iterateAllWorlds()
Tells all World's in this GeneticAlgorithm to iterate through one generation. |
void |
iterateAllWorlds(int reps,
boolean iterateParallel)
Tells all World's in this GeneticAlgorithm to iterate through multiple generations. |
void |
iterateWorld(java.lang.String name)
Tells a World with a given name to iterate through one generation. |
void |
iterateWorld(java.lang.String name,
int reps)
Tells a World to iterate through multiple generations. |
void |
iterateWorld(World toIterate)
Tells a World to iterate through one generation. |
void |
iterateWorld(World toIterate,
int reps)
Tells a World to iterate through multiple generations. |
void |
removeAllWorlds(java.lang.String name)
Removes all World's with the given name out of this GeneticAlgorithm. |
boolean |
removeWorld(java.lang.String name)
Removes a World with the given name out of this GeneticAlgorithm. |
boolean |
removeWorld(World toRemove)
Removes a given World out of this GeneticAlgorithm. |
java.lang.String |
toString()
Calls every World |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public GeneticAlgorithm()
ArrayList
public GeneticAlgorithm(java.util.Collection initialCollection)
Collection
| Method Detail |
public void addWorld(World toAdd)
toAdd - a World to be added into this GeneticAlgorithmpublic boolean removeWorld(World toRemove)
toRemove - a World to be deleted from this GeneticAlgorithm
true if the World has been found and
deletedfalse otherwisepublic boolean removeWorld(java.lang.String name)
name - a String specifying the name of the world to be deleted
true if the World has been found and
deletedfalse otherwisepublic void removeAllWorlds(java.lang.String name)
name - a String specifying the name of the world to be deletedpublic World getWorld(java.lang.String name)
name - a String specifying the name of the world to be returned
Object when a match is foundnull when no match can be foundpublic java.lang.String[] getWorldNames()
Object when a match is foundnull when no match can be foundpublic World[] getWorldArray()
World[] of all the World objectspublic java.util.Collection getWorlds()
Collection that holds this collection's
World objects
Collection of all the World objectspublic void iterateWorld(java.lang.String name)
name - a String specifying the name of the world to iterate()public void iterateWorld(World toIterate)
toIterate - a World to iterate
java.util.NoSuchElementException - thrown if the specified World
does not belong to this GeneticAlgorithm
public void iterateWorld(java.lang.String name,
int reps)
name - a String specifying a world to iteratereps - the number of times to iterate
public void iterateWorld(World toIterate,
int reps)
toIterate - the World to iteratereps - the number of times to iterate
java.util.NoSuchElementException - thrown if the specified World
does not belong to this GeneticAlgorithmpublic void iterateAllWorlds()
public void iterateAllWorlds(int reps,
boolean iterateParallel)
reps - the number of times to iterate each worlditerateParallel - false specifies serial iteration
(all iterations on each world)true specifies parallel iteration
(each iteration simultaneously on all worlds)public int getNumberOfWorlds()
Worlds stored in this
GeneticAlgorithm.
Worldspublic java.lang.String toString()
World's toString() method and
returns a concatenation of all the Strings returned.
- Overrides:
toString in class java.lang.Object
- Returns:
- a concatenated
String of all the Worlds'
toString() methods
public void cleanse()
World objects from the Collection
public java.util.Iterator getWorldIterator()
Iterator to use to go through all the
Worlds in this GeneticAlgorithm.
Iterator for the collection of Worldspublic static boolean getDebug()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||