|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgap.gp.GPProblem
examples.gp.anttrail.AntTrailProblem
public class AntTrailProblem
The ant trail problem. It demonstrates Genetic Programming (GP) capabilities of JGAP.
The ant trail problem searches for a solution to let an ant pick up as many food as possible on a given parcours with as few steps as possible. The ant can move, take food and see food in adjacent fields.
Whenever a new best solution has been found, the ant trail is printed to the console. Additionally, the tree represented by the GP program is output in graphical representation.
Field Summary | |
---|---|
protected int[][] |
m_map
|
static int |
m_maxMoves
Maximum number of moves allowed. |
protected static int |
totalFood
|
Constructor Summary | |
---|---|
AntTrailProblem(GPConfiguration config,
java.lang.String a_filename)
|
Method Summary | |
---|---|
GPGenotype |
create()
Sets up the functions to use and other parameters. |
protected void |
displaySolution(int[][] a_antmap)
Display ant trail as found by GP. |
static void |
main(java.lang.String[] args)
Starts the example. |
Methods inherited from class org.jgap.gp.GPProblem |
---|
createTree, getGPConfiguration, setGPConfiguration, showTree, showTree |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int[][] m_map
protected static int totalFood
public static int m_maxMoves
Constructor Detail |
---|
public AntTrailProblem(GPConfiguration config, java.lang.String a_filename) throws InvalidConfigurationException, java.lang.Exception
InvalidConfigurationException
java.lang.Exception
Method Detail |
---|
public GPGenotype create() throws InvalidConfigurationException
create
in class GPProblem
InvalidConfigurationException
public static void main(java.lang.String[] args)
args
- ignored
java.lang.Exception
protected void displaySolution(int[][] a_antmap)
a_antmap
- the map containing the trail
|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |