org.primordion.ealontro.app
Class XhAntForaging

java.lang.Object
  extended byorg.primordion.xholon.base.Xholon
      extended byorg.primordion.xholon.base.XholonWithPorts
          extended byorg.primordion.xholon.base.AbstractGrid
              extended byorg.primordion.ealontro.app.XhAntForaging
All Implemented Interfaces:
CeAntForaging, IActivity, IGrid, IXholon
Direct Known Subclasses:
XhEcjAntForaging

public class XhAntForaging
extends AbstractGrid
implements IActivity, CeAntForaging

Ant Foraging System WITHOUT Genetic Programming.

source: Koza, J. (1992). Genetic Programming. p.329-344

Since:
0.3 (Created on June 15, 2006)
Author:
Ken Webb

Field Summary
 double dropSize
           
 int food
           
 boolean hasNest
           
 double pheromoneLevel
           
 java.lang.String roleName
           
 
Fields inherited from class org.primordion.xholon.base.AbstractGrid
P_BEHAVIOR, P_NEXT, P_PREVIOUS
 
Fields inherited from class org.primordion.xholon.base.XholonWithPorts
port
 
Fields inherited from class org.primordion.xholon.base.Xholon
DEFAULT_LEVEL, interaction, interactionsEnabled
 
Fields inherited from interface org.primordion.ealontro.app.CeAntForaging
AntCE, AntForagingGPCE, AntForagingSystemCE, BehaviorCE, FoodCE, GeneticProgramCE, GridCE, GridCellCE, GridReferenceCE, NestCE, NonTerminalCE, PfDropPheromoneCE, PfIfCarryingFoodCE, PfIfFoodHereCE, PfMoveRandomCE, PfMoveToAdjacentFoodElseCE, PfMoveToAdjacentPheromoneElseCE, PfMoveToNestCE, PfPickUpCE, PfWrapperCE, PopulationCE, PrimitiveCE, RowCE, StructureCE, TerminalCE, XholonClassCE
 
Fields inherited from interface org.primordion.xholon.base.IGrid
BOUNDARY_GRID, BOUNDARY_TORUS, NEIGHBORHOOD_1DCA, NEIGHBORHOOD_HEXAGONAL, NEIGHBORHOOD_MOORE, NEIGHBORHOOD_SIBLING, NEIGHBORHOOD_VON_NEUMANN, P_CAFUTURESELF, P_CALEFTNEIGHBOR, P_CARIGHTNEIGHBOR, P_EAST, P_HEX0, P_HEX1, P_HEX2, P_HEX3, P_HEX4, P_HEX5, P_NORTH, P_NORTHEAST, P_NORTHWEST, P_SOUTH, P_SOUTHEAST, P_SOUTHWEST, P_STAYHERE, P_WEST, REGULAR_COMPLETE, REGULAR_COMPLETE_SELF, REGULAR_CYCLE, REGULAR_WHEEL
 
Fields inherited from interface org.primordion.xholon.base.IXholon
DEFAULT_SIZE_MSG_Q, NINCLUDE_PSC, NINCLUDE_PSx, NINCLUDE_PxC, NINCLUDE_Pxx, NINCLUDE_xSC, NINCLUDE_xSx, NINCLUDE_xxC, NINCLUDE_xxx
 
Constructor Summary
XhAntForaging()
          Constructor.
 
Method Summary
 void act()
          Do some action during this time step.
 void adjustRawFitness()
          Adjust the fitness.
 int getFoodQuantity()
          Get food quantity.
static double getPheromoneDiffusionRate()
          Get the current pheromone diffusion rate.
static double getPheromoneEvaporationRate()
          Get the current pheromone evaporation rate.
 int getRawFitness()
          Get current fitness score for this GeneticProgram.
 java.lang.String getRoleName()
          Get name of the role played by this Xholon within a specific context.
static boolean getUsePheromone()
          Get whether or not pheromone is being used in the simulationa.
static boolean getUsePheromoneDiffusion()
          Get whether or not pheromone diffusion is being used in the simulation.
 double getVal()
          Get the value of a "double" maintained by this xholon instance.
 boolean hasFood()
          Determine whether GridCell or Ant have any food.
 void incRawFitness(int amount)
          Increase the raw fitness of this GeneticProgram.
 void initialize()
          Initialize the tree node.
 boolean performBooleanActivity(IXholon activity)
          Perform an activity including the entire activity subtree.
 void postAct()
          Do any required work after doing the main action during a time step.
 void preAct()
          Do any setup required before doing the main action during a time step.
 void setFoodQuantity(int fq)
          Set food quantity.
static void setPheromoneDiffusionRate(double pdr)
          Set pheromone diffusion rate.
static void setPheromoneEvaporationRate(double per)
          Set pheromone evaporation rate.
 void setRawFitness(int rawFitness)
          Set current fitness score for this GeneticProgram (typically used to reset to zero).
 void setRoleName(java.lang.String roleName)
          Set name of the role played by this Xholon within a specific context.
static void setUsePheromone(boolean usePher)
          Set whether or not to use pheromone in the simulation.
static void setUsePheromoneDiffusion(boolean upd)
          Set whether or not to use pheromone diffusion in the simulation.
 java.lang.String toString()
           
 
Methods inherited from class org.primordion.xholon.base.AbstractGrid
configure, getNeighType, getNumNeighbors, moveXholonsToGrid, postConfigure, postReconfigure, preReconfigure, reconfigure, setCaFuture, setCaLeft, setCaRight, setEast, setHex0, setHex1, setHex2, setHex3, setHex4, setHex5, setNorth, setNorthEast, setNorthWest, setSiblingsComplete, setSiblingsCompleteSelf, setSiblingsCycle, setSiblingsWheel, setSouth, setSouthEast, setSouthWest, setWest
 
Methods inherited from class org.primordion.xholon.base.XholonWithPorts
configure, getMaxPorts, getPort, isActiveObject, isBound, isContainer, isPassiveObject, setMaxPorts, setPorts, terminate
 
Methods inherited from class org.primordion.xholon.base.Xholon
appendChild, appendChild, appendChild, cleanup, createStructure, decVal, decVal, depth, draw, getChildNodes, getFirstChild, getFirstSibling, getId, getLastChild, getLastSibling, getName, getNeighbors, getNextId, getNextSibling, getNthChild, getNthSibling, getNumChildren, getNumSiblings, getParentNode, getPreviousSibling, getRootNode, getSiblings, getSizeMessageQ, getUid, getVal_boolean, getVal_byte, getVal_char, getVal_double, getVal_float, getVal_int, getVal_long, getVal_Object, getVal_short, getVal_String, getXhc, getXhcId, getXhcName, getXhType, handleNodeSelection, hasAncestor, hasChildNodes, hasChildOrSiblingNodes, hasNextSibling, hasParentNode, height, incVal, incVal, initStatics, inOrderPrint, insertAfter, insertBefore, insertFirstChild, isExternal, isInternal, isLeaf, isRootNode, performActivity, performActivity, performBooleanActivity, performDoubleActivity, performGuard, performVoidActivity, postOrderPrint, preConfigure, preOrderPrint, print, println, processMessageQ, processReceivedMessage, remove, removeChild, resetNextId, sendMessage, sendMessage, sendMessage, setAttributeVal, setFactory, setFirstChild, setId, setNextSibling, setParentChildLinks, setParentNode, setParentSiblingLinks, setSizeMessageQ, setUid, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVariableValue, setXhc, swapNode, treeSize, writeXml
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hasNest

public boolean hasNest

pheromoneLevel

public double pheromoneLevel

dropSize

public double dropSize

food

public int food

roleName

public java.lang.String roleName
Constructor Detail

XhAntForaging

public XhAntForaging()
Constructor.

Method Detail

initialize

public void initialize()
Description copied from interface: IXholon
Initialize the tree node. Typically this is only used to re-initialize a node, such as when it is reused through the TreeNodeFactoryStatic.

Specified by:
initialize in interface IXholon
Overrides:
initialize in class AbstractGrid

getVal

public double getVal()
Description copied from interface: IXholon
Get the value of a "double" maintained by this xholon instance. If a class that implements this interface does not maintain such a value, it should return 0.0 This method can be used in place of getVal_double()

Specified by:
getVal in interface IXholon
Overrides:
getVal in class Xholon

setRoleName

public void setRoleName(java.lang.String roleName)
Description copied from interface: IXholon
Set name of the role played by this Xholon within a specific context.

Specified by:
setRoleName in interface IXholon
Overrides:
setRoleName in class Xholon

getRoleName

public java.lang.String getRoleName()
Description copied from interface: IXholon
Get name of the role played by this Xholon within a specific context.

Specified by:
getRoleName in interface IXholon
Overrides:
getRoleName in class Xholon

setFoodQuantity

public void setFoodQuantity(int fq)
Set food quantity.

Parameters:
fq - The food quantity.

getFoodQuantity

public int getFoodQuantity()
Get food quantity.

Returns:
The food quantity.

setRawFitness

public void setRawFitness(int rawFitness)
Set current fitness score for this GeneticProgram (typically used to reset to zero).

Parameters:
rawFitness - The new raw fitness value.

getRawFitness

public int getRawFitness()
Get current fitness score for this GeneticProgram.

Returns:
The current raw fitness value.

adjustRawFitness

public void adjustRawFitness()
Adjust the fitness. Called by Ant. Accumulated within the Behavior instance referenced by Ant.


incRawFitness

public void incRawFitness(int amount)
Increase the raw fitness of this GeneticProgram.

Parameters:
amount - Amount by which to increase the fitness.

hasFood

public boolean hasFood()
Determine whether GridCell or Ant have any food.

Returns:
true or false

preAct

public void preAct()
Description copied from interface: IXholon
Do any setup required before doing the main action during a time step.

Specified by:
preAct in interface IXholon
Overrides:
preAct in class Xholon

act

public void act()
Description copied from interface: IXholon
Do some action during this time step. Typically all nodes in the tree will do their pre-actions (optional), then all will do their actions, and then all will do their post-actions (optional).

Specified by:
act in interface IXholon
Overrides:
act in class Xholon

postAct

public void postAct()
Description copied from interface: IXholon
Do any required work after doing the main action during a time step.

Specified by:
postAct in interface IXholon
Overrides:
postAct in class Xholon

performBooleanActivity

public boolean performBooleanActivity(IXholon activity)
Description copied from interface: IXholon
Perform an activity including the entire activity subtree. This is intended to be used in Behavior encoded as an Activity subtree, and in GP and other evolutionary computation such as ECJ integration with Xholon.

Specified by:
performBooleanActivity in interface IXholon
Overrides:
performBooleanActivity in class Xholon

setUsePheromone

public static void setUsePheromone(boolean usePher)
Set whether or not to use pheromone in the simulation.

Parameters:
usePher - true or false

getUsePheromone

public static boolean getUsePheromone()
Get whether or not pheromone is being used in the simulationa.

Returns:
true or false

setPheromoneEvaporationRate

public static void setPheromoneEvaporationRate(double per)
Set pheromone evaporation rate.

Parameters:
per - The new pheromone evaporation rate.

getPheromoneEvaporationRate

public static double getPheromoneEvaporationRate()
Get the current pheromone evaporation rate.

Returns:
The pheromone evaporation rate.

setPheromoneDiffusionRate

public static void setPheromoneDiffusionRate(double pdr)
Set pheromone diffusion rate.

Parameters:
pdr - The new pheromone diffusion rate.

getPheromoneDiffusionRate

public static double getPheromoneDiffusionRate()
Get the current pheromone diffusion rate.

Returns:
The pheromone diffusion rate.

setUsePheromoneDiffusion

public static void setUsePheromoneDiffusion(boolean upd)
Set whether or not to use pheromone diffusion in the simulation.

Parameters:
upd - true or false

getUsePheromoneDiffusion

public static boolean getUsePheromoneDiffusion()
Get whether or not pheromone diffusion is being used in the simulation.

Returns:
true or false

toString

public java.lang.String toString()
Overrides:
toString in class Xholon