Object Oriented Programming - PowerPoint PPT Presentation

About This Presentation
Title:

Object Oriented Programming

Description:

Currently TSP s involving 1000 s cities are being studied You should restrict your algorithm to problems ... JAVA Programming Author: spannm Last modified by: – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 22
Provided by: span74
Category:

less

Transcript and Presenter's Notes

Title: Object Oriented Programming


1
Object Oriented Programming
  • Assignment Introduction

Dr. Mike Spann m.spann_at_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 -gt (N-1)!/2 routes
  • Small problem involving 29 cities in Western
    Sahara has 2x1028 routes!
  • Currently TSPs involving 1000s cities are being
    studied
  • You should restrict your algorithm to problems
    with lt1000 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
  • dij distance between cities i and j
  • tij the amount of pheremone between cities i and
    j
  • ß determines influence of arc length over
    accumulated pheromone

12
Applying the ACO algorithm to the TSP
  • After each ant has completed its route, the
    route length for each ant is computed
  • Assumes each ant has a local memory of where its
    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 0ltqlt1 and some threshold
    parameter q0(t)
  • qlt 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 kgt3
  • 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
Write a Comment
User Comments (0)
About PowerShow.com