Package libai.ants.algorithms
Class MMAS
- java.lang.Object
-
- libai.ants.algorithms.Metaheuristic
-
- libai.ants.algorithms.MMAS
-
- All Implemented Interfaces:
java.util.Comparator<Ant>
public abstract class MMAS extends Metaheuristic
This class belong to the core classes of the Ant Framework.First introduced by Stutzle and Hoos, this class implements the Min-Max Ant System algorithm. This algorithm was conceived as a fix of the prematurely stagnation behavior of AS for complex problem. Stagnation means that all ants follow exactly the same path, and premature stagnation occurs when ants explore little and too rapidly exploit the highest pheromone concentrations. The main differences between MMAS and AS is that pheromone intensities are restricted within given intervals and initial pheromoes are set to a max allowed value.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
debug
If true, print debug information over System.out.printlnprotected static int
pheromonesEvaporationRate
Holds the rate at which pheromones will evaporate in thepheromonesEvaporation()
methodprotected static int
tau_max
Maximun value for the pheromone trailprotected static int
tau_min
Minimun value for the pheromone trail-
Fields inherited from class libai.ants.algorithms.Metaheuristic
alpha, Ants, bestSolution, beta, candidates, currentIterationNumber, destinationNode, E, Graph, initialNode, maxNumIterations, numberOfAnts, numberOfNodes, Parameters, Pheromones
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MMAS()
Constructor.protected
MMAS(Enviroment E)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
candidateList(int i)
Generate, per node in the graph, a list of candidates nodes according to some problem specific heuristic.void
checkParameters()
Checks whether or not all of the algorithm's parameters exists.void
daemonActions()
This function is called on each iteration and it provides a way to implement centralized actionsint
decisionRule(int i, java.util.List<java.lang.Integer> currentSolution)
Used by ants to decided the next node to visit.void
pheromonesEvaporation()
Evaporates the pheromone trail contained in the enviroment E according to some ACO algorithm specific logicvoid
pheromonesUpdate()
Updates the pheromone trail contained in the enviroment E according to some ACO algorithm specific logicvoid
solve()
This is the body of the algorithm.boolean
stagnationPoint()
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from class libai.ants.algorithms.Metaheuristic
compare, constrains, f, getBestSolution, getCurrentIterationNumber, getE, getNumberOfNodes, getParam, heuristicInfo, setE, setNumberOfNodes, setParam
-
-
-
-
Field Detail
-
debug
public static final boolean debug
If true, print debug information over System.out.println- See Also:
- Constant Field Values
-
pheromonesEvaporationRate
protected static final int pheromonesEvaporationRate
Holds the rate at which pheromones will evaporate in thepheromonesEvaporation()
method- See Also:
- Constant Field Values
-
tau_min
protected static final int tau_min
Minimun value for the pheromone trail- See Also:
- Constant Field Values
-
tau_max
protected static final int tau_max
Maximun value for the pheromone trail- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MMAS
protected MMAS(Enviroment E)
Constructor. Allocates the enviroment.- Parameters:
E
- enviroment
-
MMAS
protected MMAS()
Constructor. Empty constructor.
-
-
Method Detail
-
checkParameters
public void checkParameters() throws AntFrameworkException
Description copied from class:Metaheuristic
Checks whether or not all of the algorithm's parameters exists. If some obligatory parameter do not exist, the function throws an exception. If some other parameter do not exists but it is possible to set a default value, here is the place to do it.- Specified by:
checkParameters
in classMetaheuristic
- Throws:
AntFrameworkException
-
stagnationPoint
public boolean stagnationPoint()
-
decisionRule
public int decisionRule(int i, java.util.List<java.lang.Integer> currentSolution)
Description copied from class:Metaheuristic
Used by ants to decided the next node to visit.- Specified by:
decisionRule
in classMetaheuristic
- Parameters:
i
- source nodecurrentSolution
-currentSolution
- Returns:
- destination node
-
pheromonesUpdate
public void pheromonesUpdate()
Description copied from class:Metaheuristic
Updates the pheromone trail contained in the enviroment E according to some ACO algorithm specific logic- Specified by:
pheromonesUpdate
in classMetaheuristic
-
pheromonesEvaporation
public final void pheromonesEvaporation()
Description copied from class:Metaheuristic
Evaporates the pheromone trail contained in the enviroment E according to some ACO algorithm specific logic- Specified by:
pheromonesEvaporation
in classMetaheuristic
-
solve
public void solve() throws AntFrameworkException
Description copied from class:Metaheuristic
This is the body of the algorithm. Implements the fundamental logic and calls to other functions: pheromonesUpdate,pheromonesEvaporation.. according to some ACO algorithm specific logic- Specified by:
solve
in classMetaheuristic
- Throws:
AntFrameworkException
- AntFrameworkException
-
daemonActions
public void daemonActions()
Description copied from class:Metaheuristic
This function is called on each iteration and it provides a way to implement centralized actions- Specified by:
daemonActions
in classMetaheuristic
-
candidateList
public final void candidateList(int i)
Description copied from class:Metaheuristic
Generate, per node in the graph, a list of candidates nodes according to some problem specific heuristic. The candidates are stored in this class's candidates hashtable- Specified by:
candidateList
in classMetaheuristic
- Parameters:
i
- maximum number of candidates allowed
-
-