Class AntSystem

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public abstract class AntSystem
    extends Metaheuristic
    This class belong to the core classes of the Ant Framework.

    Implements the Ant System algorithm. First developed by Dorigo, this algorithm introduces a transition probability rule (implemented here in desicionRule()) to include heuristic information. However, this is still basic algorithm which will probably won't work very well for large problems. Other algorithm, such as AntConolySystem introduce several upgrades which greatly improve performance.

    • 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 the pheromonesEvaporation() method
        See Also:
        Constant Field Values
    • Constructor Detail

      • AntSystem

        protected AntSystem​(Enviroment E)
        Constructor. Allocates the enviroment.
        E - enviroment
      • AntSystem

        protected AntSystem()
        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 class Metaheuristic
      • 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 class Metaheuristic
        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 class Metaheuristic
      • 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 class Metaheuristic
      • pheromonesEvaporation

        public 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 class Metaheuristic
      • 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 class Metaheuristic
        i - source node
        currentSolution - currentSolution
        destination node
      • candidateList

        public final void candidateList​(int max)
        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 class Metaheuristic
        max - maximum number of candidates allowed
      • linkOccursInPath

        public boolean linkOccursInPath​(int i,
                                        int j,
                                        java.util.List<java.lang.Integer> solution)
        Determine whether a link i,j exists in a Vector
        i - component i of the link
        j - component j of the link
        solution - a Vector
        true if link i,j exists in vector otherwise false
      • antCycle

        public double antCycle​(java.util.List<java.lang.Integer> Solution)
      • antDensity

        public double antDensity()
      • antQuantity

        public double antQuantity()