1 / 21

Object Oriented Programming

This assignment aims to implement the Ant Colony Optimization (ACO) algorithm in C# for solving the Traveling Salesman Problem (TSP). The ACO algorithm mimics the behavior of ants to find the shortest path. Various improvements to the basic algorithm will also be explored.

dbenson
Télécharger la présentation

Object Oriented Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object Oriented Programming Assignment Introduction Dr. Mike Spann m.spann@bham.ac.uk

  2. Assignment Introduction • Aims/Objectives • To produce a C# implementation of the ANT colony optimisation algorithm (ACO) and derivatives • To apply to the Travelling Salesman Problem

  3. ANT algorithms

  4. ANT algorithms • Ants are practically blind but they still manage to find their way to and from food. How do they do it? • These observations inspired a new type of algorithm called ant algorithms (or ant systems) • These algorithms are very new (Dorigo, 1996) and is still very much a research area where they are applied to the solution of hard discrete optimization problems

  5. ANT algorithms • Ant systems are a population based approach. In this respect they is similar to genetic algorithms • There is a population of ants, with each ant finding a solution and then communicating with the other ants • Communication is not peer to peer but indirect with the use of pheromone

  6. ANT algorithms • Real ants can find the shortest path to a food source by laying a pheromone trail • The ants which take the shortest path, lay the largest amount of pheromone per unit time • Positive feedback reinforces this behaviour and more ants take the shortest path resulting in more pheromone being laid

  7. Travelling Salesman Problem • Classic discrete optimisation problem • Salesman needs to visit all cities just once and return back home • Find the best route (minimum route length)

  8. Travelling Salesman Problem • The TSP is a NP-hard problem • Essentially it means there is no polynomial time solution (complexity O(Nk) ) nor can a solution be verified in polynomial time • We would need to check the solution over all possible routes to verify it • One of many NP hard problems

  9. Travelling Salesman Problem • N cities -> (N-1)!/2 routes • Small problem involving 29 cities in Western Sahara has 2x1028 routes! • Currently TSP’s involving 1000’s cities are being studied • You should restrict your algorithm to problems with <1000 cities! • The ACO algorithm has proved to be an effective approach with performances close to optimal

  10. Applying the ACO algorithm to the TSP • ACO is an iterative algorithm • During each iteration a number of ants are released to search the ‘solution space’ • Typically the number of ants ~ number of cities • Each ant makes a probabilistic choice about its route • The higher the pheromone on an edge in the TSP graph, the higher the chance of selecting that edge

  11. Applying the ACO algorithm to the TSP • dijdistance between cities iand j • τijthe amount of pheremone between cities iand j • βdetermines influence of arc length over accumulated pheromone j i

  12. Applying the ACO algorithm to the TSP • After each ant has completed it’s route, the route length for each ant is computed • Assumes each ant has a local memory of where it’s been unlike biological ants! • The pheromone on the edges of each route are updated according to the route length • Also, it is assumed that a certain amount of pheromone ‘evaporation’ takes place so that old routes are forgotten

  13. Applying the ACO algorithm to the TSP

  14. Improvements to the basic ACO algorithm • The performance of the basic ACO is not great • But definitely better than the Greedy algorithm! • A number of improvements are possible which produce closer to optimal solutions • These include: • Min-Max algorithm • Rank order algorithm • Elitist algorithm • Non-probabilistic transition • Also ‘local search’ algorithms can refine the solution

  15. Improvements to the basic ACO algorithm • ‘Elitist’ algorithm • Only update the pheromone on the currently optimum route • The pheromone on all edges still undergoes evaporation • Makes a big difference in performance over the basic ACO

  16. Improvements to the basic ACO algorithm • Non probablistic transition • Choose a non-probabilistic transition rule according to some ‘annealing’ schedule • Choose a random number 0<q<1and some threshold parameter q0(t) • q< q0(t) probabilistic transition rule applied as before • Otherwise, a deterministic transition rule is applied :

  17. Improvements to the basic ACO algorithm • q0(t) defines an annealing schedule • q0(t) small for small t, the normal probabilistic transition rule is favoured • Exploration • q0(t) approaches 1 for increasing t, the deterministic transition rule is favoured • Exploitation

  18. Improvements to the basic ACO algorithm • Local search • Exchanges edges to reduce the edge length • ‘k-opt’ algorithms • Can impose a huge computational burden for k>3 • I implemented a simple approach which requires a single comparison at each node

  19. Improvements to the basic ACO algorithm a e c d b f

  20. Assessment • Programming report (deadlines are on the handout) • Follow closely the marking pro-forma • The report should contain discussions about object orientation, code re-useability, object interaction, algorithm performance and comparisons (close to ‘optimal’?) • A formal design discussion is not expected but informal class/object diagrams and pseudo-code should be used

  21. Demo

More Related