Class Agent

java.lang.Object
  extended by Agent

public class Agent
extends java.lang.Object

Agent class is the representation of an individual ant in an ACO algorithm. Agents keep track of their own routes, constructing and updating them as necessary.


Field Summary
 HashRoute current
           
private  double DISTANCEIMPORTANCE
           
private  double GREEDY
           
private  double PHERIMPORTANCE
           
private  PherMatrix pherMatrix
           
 Route tabu
           
 
Constructor Summary
Agent(PherMatrix tempPher, int startingNode)
          Constructs Agent.
 
Method Summary
 double evalImportance(int x, int y)
          Helper method for move that determines the attractiveness of an arc.
 void generateRoute()
          Constructs a finished route for the Agent.
 Route getFinished()
          Returns the finished Route of the Agent.
 int move()
          Decides which node to move to next based on pheromone and distance information
 void reset()
          Clears the Route of the Agent and obtains a new HashRoute of valid nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tabu

public Route tabu

current

public HashRoute current

pherMatrix

private PherMatrix pherMatrix

PHERIMPORTANCE

private double PHERIMPORTANCE

DISTANCEIMPORTANCE

private double DISTANCEIMPORTANCE

GREEDY

private double GREEDY
Constructor Detail

Agent

public Agent(PherMatrix tempPher,
             int startingNode)
Constructs Agent.

Parameters:
tempPher - PherMatrix of the problem
startingNode - Node number that the ant starts on
Method Detail

move

public int move()
Decides which node to move to next based on pheromone and distance information

Returns:
Node to move to, -2 if no moves avaliable, -1 if error

generateRoute

public void generateRoute()
Constructs a finished route for the Agent. A finished route visits each node once.

See Also:
move()

getFinished

public Route getFinished()
Returns the finished Route of the Agent. Adds the beginning node to the end of the Route for use later in the program. return Constructed Route


reset

public void reset()
Clears the Route of the Agent and obtains a new HashRoute of valid nodes.


evalImportance

public double evalImportance(int x,
                             int y)
Helper method for move that determines the attractiveness of an arc.

Parameters:
x - First node
y - Second node
Returns:
The attractiveness of the arc based on pheromone and an inverse of the distance