8 Ant Colony Optimization and Coursework Details


Ant Colony Optimization (ACO) - Details and Applications

Traveling Salesperson Problem (TSP) Reminder

  • Given a set of cities, find the shortest tour that visits each city exactly once and returns to the starting city.

  • NP-complete problem, commonly used as a testbed for various algorithms.

ACO Algorithm Overview

  1. Construction Graph:

    • Nodes represent cities.

    • Edges connect all nodes (fully connected graph).

    • Pheromone is placed on edges.

  2. Ant Traversal:

    • Multiple ants traverse the graph.

    • Ants are attracted to edges with more pheromone.

    • Ants have memory and avoid revisiting cities.

    • After nn steps, each ant completes a tour.

  3. Tour Quality Measurement:

    • The quality (fitness) of each tour is evaluated.

  4. Pheromone Update:

    • Edges in good tours receive more pheromone.

    • Edges in bad tours receive less pheromone.

    • Pheromone evaporation occurs on all edges (pheromone levels decrease over time).

  5. Repeat:

    • Steps 2-4 are repeated iteratively.

    • Positive feedback mechanism: Shortest paths gradually accumulate more pheromone.

ACO Pseudo Code Details

  • Step 0: Initialize the graph with random pheromone on edges.

  • Three nested loops:

    • Outer loop: Iterations or generations (discrete time units).

    • Middle loop: For each generation, consider a certain number of ants (num_ant parameter).

    • Inner loop: Each ant performs a number of steps equal to the number of cities (num_city).

  • Ant Placement:

    • Ants are randomly placed on the nodes (cities) of the graph.

  • Parallel Computation:

    • Ants operate independently and in parallel. No interaction

  • State Transition Rule:

    • Each ant chooses the next city to visit based on a probabilistic rule.

  • Solution Evaluation:

    • After all ants complete their tours, each tour represents a solution.

    • The fitness of each solution is measured.

  • Pheromone Update:

    • Pheromone levels are updated based on the quality of the solutions.

  • Evaporation:

    • Pheromone evaporation is applied to all edges.

  • Termination Condition:

    • The algorithm terminates after a certain number of generations or when a solution of sufficient quality is found.

State Transition Rule

  • Probability of an ant kk moving from city ii to city jj at iteration tt depends on:

    • Whether the city jj has been visited (tabu list).

Components influencing the probability:
  1. Static Local Heuristic (ηij\eta_{ij}):

    • Represents the desirability of visiting city jj from city ii.

    • For TSP: η<em>ij=.frac1d</em>ij\eta<em>{ij} = .frac{1}{d</em>{ij}}, where dijd_{ij} is the distance between cities ii and jj.

    • Static: Can be pre-computed and doesn't change during the algorithm's execution.

    • Local: Only considers the direct neighborhood of the current node.

  2. Learned Global Pheromone Trail (τij(t)\tau_{ij}(t)) :

    • Represents the amount of virtual pheromone on edge (i,j)(i, j) at time tt.

    • Learned: Changes over time based on the algorithm's progress.

    • Global: Considers the complete solution and information from all ants.

Probability Formula

The probability pijk(t)p_{ij}^k(t) of ant kk moving from city ii to city jj at time tt is given by:

p<em>ijk(t)=[τ</em>ij(t)]α[η<em>ij]β∑</em>l∈allowed<em>k[τ</em>il(t)]α[ηil]βp<em>{ij}^k(t) = \frac{[\tau</em>{ij}(t)]^\alpha [\eta<em>{ij}]^\beta}{\sum</em>{l \in \text{allowed}<em>k} [\tau</em>{il}(t)]^\alpha [\eta_{il}]^\beta}

Where:

  • τij(t)\tau_{ij}(t) is the amount of pheromone on edge (i,j)(i, j) at time tt.

  • ηij\eta_{ij} is the heuristic desirability of moving from ii to jj.

  • α\alpha and β\beta are parameters that control the relative importance of pheromone and heuristic information. Always Positive.

  • allowedk\text{allowed}_k is the set of cities that ant kk is allowed to visit (not in its tabu list).

Effects of alpha and beta:

  • If α=0\alpha = 0, ants make decisions greedily based on desirability alone.

  • If β=0\beta = 0, ants only consider pheromone, leading to rapid convergence and potentially suboptimal solutions.

  • Good values for α\alpha and β\beta are typically between zero and five, but depend on the problem.

Pheromone Update Rule

  • After each ant kk completes its tour, it deposits pheromone on the edges it used.

  • The amount of pheromone deposited is proportional to the quality (fitness) of the tour.

Formula

The pheromone update rule is given by:

τ<em>ij(t+1)=(1−ρ)τ</em>ij(t)+∑<em>k=1mΔτ</em>ijk\tau<em>{ij}(t+1) = (1 - \rho) \tau</em>{ij}(t) + \sum<em>{k=1}^{m} \Delta \tau</em>{ij}^k

Where:

  • τij(t+1)\tau_{ij}(t+1) is the amount of pheromone on edge (i,j)(i, j) at time t+1t+1.

  • ρ\rho is the evaporation rate (between 0 and 1).

  • mm is the number of ants.

  • Δτijk\Delta \tau_{ij}^k is the amount of pheromone deposited by ant kk on edge (i,j)(i, j), which is typically:

    • QLk\frac{Q}{L_k} if ant kk used edge (i,j)(i, j) in its tour.

    • 0 otherwise.

  • QQ is a constant.

  • LkL_k is the length of the tour of ant kk.

Results and Extensions

  • Early ACO algorithms were competitive but not the best for static TSP problems.

  • ACO is adaptive and can track changes in dynamic environments. Hybridizing ACO with hill climbing led to significant improvements.

  • Hybrid algorithms combine the constructive heuristic of ACO with local search (hill climbing) to find nearby optimal solutions.

  • Extensions to ACO include:

    • Max-Min Ant System: Limits the minimum and maximum amount of pheromone on edges to encourage exploration.

    • Elitist Rank-Based System: Uses ranking instead of fitness-proportional selection to address issues related to fitness scaling.

Applications Beyond TSP

Machine Scheduling Problem
  • Goal: Schedule jobs on a single machine to minimize lateness.

  • Construction Graph:

    • Nodes: Tasks to be scheduled (a,b,c,d,ea, b, c, d, e).

    • Edges: Connections between tasks, representing the order of scheduling.

    • Start node: Needed because the first job scheduled needs to be considered.

  • Heuristic:

    • Desirability is proportional to the inverse of the lateness of each job.

Bin Packing Problem
  • Goal: Pack items into bins to balance/minimize the difference in the level of each bin

  • Construction Graph:

    • Each item must be assigned to a Bin.

    • Nodes: start node, end node, representation of each bin, K columns for the items themselves

    • Interpretation: The algorithm traverses the graph in layers, starting with "item one", followed by "item two" etc. Each layer has K nodes, one for each item. Each path of a layer goes to one of the Bins (ie. one of the rows). The item is then assigned to this bin if that path is taken by the ACO.

Upcoming

  • Bring calculator, paper, and pen for in-class exercise next week.

  • Read the paper for a group discussion in the following session.