|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectes.ants.felixgm.trmsim_wsn.trm.lftm.LFTM_Ant
public class LFTM_Ant
This class models an ant in the ant colony system. It includes the path being built by the ant, the service it is searching and the current average pheromone of the path.
| Field Summary | |
|---|---|
protected double |
averagePheromone
Average pheromone of the current built path |
protected LFTM_Sensor |
client
Client in the network requesting a certain service |
protected Service |
searchingService
Service being searched by this ant |
protected java.util.Vector<LFTM_Sensor> |
solution
Current built path of nodes leading to a server offering the desired service |
protected boolean |
solutionFound
Boolean indicating if a solution has been found or not |
protected java.util.Vector<LFTM_Sensor> |
visitedSensors
Collection of visited servers by this ant |
| Constructor Summary | |
|---|---|
LFTM_Ant(Service searchingService,
LFTM_Sensor client)
Class LFTM_Ant constructor |
|
| Method Summary | |
|---|---|
void |
addSensor(LFTM_Sensor sensor)
Adds a sensor to the solution of this ant and computes the average pheromone, and the average weighted pheromone |
double |
get_averagePheromone()
Returns the average pheromone of the current built path |
java.util.Vector<LFTM_Sensor> |
get_solution()
Returns the current built path of nodes leading to a server offering the desired service |
double |
getLastNodePheromone()
Gets the pheromone of the last edge of the built path |
LFTM_Sensor |
getNextSensor(double alpha,
double beta,
double q0)
Returns the next node to be visited by the ant |
boolean |
isSolutionFound()
Indicates if a solution has been found or not |
LFTM_Sensor |
moveBack()
The ant moves back until it finds a server offering the desired service or a server with more paths to explore or until it reaches the client it departed from |
void |
pheromoneGlobalUpdating(double phi,
double rho,
double maxGlobal)
This method carries out the pheromone global updating of the best current path |
void |
pheromoneLocalUpdating(double phi,
Sensor nextSensor)
This method carries out the pheromone local updating of the edge connecting the current last server in the path and the next server passed as an argument |
void |
reset()
Resets the ant to its initial state, with no path and no average pheromone |
void |
setSolutionFound()
Sets the current path as a final solution. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Service searchingService
protected LFTM_Sensor client
protected java.util.Vector<LFTM_Sensor> solution
protected java.util.Vector<LFTM_Sensor> visitedSensors
protected double averagePheromone
protected boolean solutionFound
| Constructor Detail |
|---|
public LFTM_Ant(Service searchingService,
LFTM_Sensor client)
searchingService - The service desired by the client and searched by the LFTM_Antclient - The client asking for the service| Method Detail |
|---|
public void addSensor(LFTM_Sensor sensor)
sensor - Sensor to add to the current pathpublic LFTM_Sensor moveBack()
public void reset()
public boolean isSolutionFound()
public void setSolutionFound()
isSolutionFound returns true
public double getLastNodePheromone()
public LFTM_Sensor getNextSensor(double alpha,
double beta,
double q0)
alpha - Weight of the pheromone in the transition rule of the ant colony systembeta - Weight of the heuristic in the transition rule of the ant colony systemq0 - Probability of using a pseudo random proportional transition rule or a
leading exploration transition rule
public void pheromoneLocalUpdating(double phi,
Sensor nextSensor)
phi - Parameter phi, a constant within the interval [0,1]nextSensor - Next server to visit by the ant
public void pheromoneGlobalUpdating(double phi,
double rho,
double maxGlobal)
phi - Parameter phi, a constant within the interval [0,1]rho - Parameter rho, a constant within the interval [0,1]maxGlobal - Quality of the best current pathpublic java.util.Vector<LFTM_Sensor> get_solution()
public double get_averagePheromone()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||