ECJ Ant Trail - Xholon App (no GP)
What is it
This model is a Xholon version of the Ant Trail application included with ECJ, an evolutionary computation system written in Java. This version does NOT include genetic programming, but simply uses an already-known optimal behavior. This optimal behavior, shown below, is hard-coded into a Xholon tree structure, inside the CompositeStructureHierarchy.xml configuration file.
A 32 by 32 grid contains a trail that is partially covered with food. An ant starts at one end of the trail. It must eat as many of the 89 bits of food as it can locate in 400 moves. There are usually multiple moves during one time step.
<PfIfFoodAhead> <PfMove/> <PfProgn3> <PfLeft/> <PfProgn2> <PfIfFoodAhead> <PfMove/> <PfRight/> </PfIfFoodAhead> <PfProgn2> <PfRight/> <PfProgn2> <PfLeft/> <PfRight/> </PfProgn2> </PfProgn2> </PfProgn2> <PfProgn2> <PfIfFoodAhead> <PfMove/> <PfLeft/> </PfIfFoodAhead> <PfMove/> </PfProgn2> </PfProgn3> </PfIfFoodAhead>
How to use it
- Run the Java application through the XhnEalontro GUI (org.primordion.xholon.app.Xhn.java), and select File --> Open --> ealontro --> EcjAntTrail --> AntTrail_1_xhn.xml.
- Expand the Controller node in the tree.
- Press the Start node.
- If you have JFreeChart installed, and if you have selected "JFreeChart" as the value of the UseDataPlotter parameter in Tutorial4_1_xhn.xml, you should see a chart that looks like the one below. If you don't have JFreeChart installed, then change the value of UseDataPlotter to "gnuplot", and look at the results that are saved to a .csv file in the statistics folder. If you have gnuplot installed, it can read the .plt script in the statistics folder to produce a displayable .png file from the .csv file.
Things to notice
Take a look at the XML configuration files in the config/ealontro/EcjTutorial4 folder. AntTrail_1_xhn.xml includes a TrailFile parameter. XhAntTrail reads this file to determine where the trail and food are within the grid. There are also MaxFood and MaxMoves parameters.
InheritanceHierarchy.xml is shared by both the GP and the NoGP versions of this application. The primitive functions (Pf) out of which the behavior is created, are divided into two types. A non-terminal primitive function has other functions as children (ex: PfIfFoodAhead), while a terminal function just performs some action (ex: PfLeft). Note that GeneticProgram is identified as a type of Behavior.
Look at XhAntTrail.java to learn how the result is obtained by traversing the tree.
Things to try
Use a different trail file by changing three parameters in Ant_Trail_1_xhn.xml. Change TrailFile to "./config/ealontro/EcjAntTrail/losaltos.trl". Change MaxFood to 156. Change MaxMoves to 2000. Change CompositeStructureHierarchyFile to "./config/ealontro/EcjAntTrail/CompositeStructureHierarchy_LosAltos_Koza.xml"
Extending the model
This is a simple application that can be used as a starting point for any Xholon model whose behavior is specified in a tree structure.
Xholon and Ealontro features
Specifying behavior as a tree of functions.
Displaying results in a chart.
Setting application-specific parameters through the _xhn.xml file.
Credits and references
This application was described in: Koza, J. (1992). Genetic Programming. p.147-162
Visit the ECJ website.