Download presentation
1
Algorithms and their Applications CS2004 (2012-2013)
Dr Stephen Swift 10.1 Tabu Search and ILS
2
Previously On CS2004 – Part 1 So far we have looked at:
Concepts of Computation and Algorithms Comparing algorithms Some mathematical foundation The Big-Oh notation Computational Complexity Data Structures Sorting Algorithms Graphs and Graph Algorithms Tabu Search and ILS
3
Previously On CS2004 – Part 2 We then moved focus to Heuristic Search Algorithms: Concepts Fitness Representation Search Space Methods Hill Climbing Stochastic Hill Climbing Random Restart Hill Climbing Simulated Annealing Tabu Search and ILS
4
Introduction In this lecture we are going to look into two Heuristic Search methods: Tabu Search (TS) Iterated Local Search (ILS) We are then going to look into some of the implementation details involved in applying ILS to the Scales problem Representation improvements An Updatable Fitness Function Performance Tabu Search and ILS
5
Heuristics A “rule of thumb” No guarantees on quality of solution
Usually fast and are widely used Sometimes we run them multiple times and analyse the results Studied experimentally on benchmark datasets Tabu Search and ILS
6
Popular Heuristics Hill Climbing Simulated Annealing
Always go up hill (accept only better quality solutions) Simulated Annealing The concepts of annealing and temperature Iterated Local Search See later slide Tabu Search Genetic Algorithms Simulated evolution See later lecture Ant Colony Optimisation Pheromones and cooperation …… Tabu Search and ILS
7
Local View of Search Tabu Search and ILS
8
Tabu (Taboo) Search Tabu search tries to model human memory processes
Key idea: Use aspects of search history (memory) to escape from local minima A tabu-list is maintained throughout the search Associate tabu attributes with candidate solutions or solution components Moves according to the items on the list are forbidden Tabu Search and ILS
9
Flow Chart of a Standard Tabu Search Algorithm
START Initialise solution Create a candidate list of solutions Evaluate solutions Stopping conditions satisfied? Update Tabu & Aspiration Conditions Choose the best admissible solution No END Yes Final solution Tabu Search and ILS Slide 9
10
Tabu Search – Key Concepts
A search (similar to Hill Climbing) that remembers sets of points in the search space These are called the Tabu list and are to be avoided The idea is that this helps in avoiding local optima However if a point is evaluated to be better than any points discovered so far, then the Tabu list may be updated Aspiration Criteria Tabu Search and ILS
11
Tabu Search Stopping Conditions
Some immediate stopping conditions: No feasible solution in the neighborhood of solution The maximum amount of iterations or CPU time has been exceeded The number of iterations since the last improvement is larger than a specified number Evidence can be given than an optimum solution has been obtained Tabu Search and ILS Slide 11
12
Parameters of Tabu Search
Local search procedure Neighborhood structure Tabu attributes Aspiration conditions Form of tabu moves Maximum size of tabu list Stopping rule Tabu Search and ILS Slide 12
13
Pros and Cons for Tabu Search
The use of a Tabu list Can be applied to both discrete and continuous solution spaces A meta-heuristic that guides a local search procedure to explore the solution space beyond local optimality For larger and more difficult problems (scheduling, quadratic assignment and vehicle routing), tabu search obtains solutions that rival and often surpass the best solutions previously found by other approaches Cons: Too many parameters to be determined Number of iterations could be very large Global optimum may not be found, depends on parameter settings Tabu list can grow out of control Tabu Search and ILS Slide 13
14
Iterated Local Search (ILS) Key Concepts
ILS uses another local search algorithm as part of the algorithm E.g. Hill Climbing It uses information regarding previously discovered local optima (and/or starting points) to locate new (and hopefully better) local optima The key algorithmic steps are as follows: s0 = Generate initial solution s* = LocalSearch(s0) history = Repeat history = history s* [Remember previous optima and maybe start] scurrent = Perturb(s*,history) [Try to avoid similar starting points] scurrent* = LocalSearch(scurrent) s* = Accept(s*, scurrent*, history) [Often just accept best] Until termination condition met Care must be taken to assure that the perturbation step is not just mimicking the local search algorithm Note: Random Restart Hill Climbing is NOT ILS – Why? Tabu Search and ILS
15
Iterated Local Search – Part 1
ILS can be interpreted as walks in the space of local optima Perturbation is key Needs to be chosen so that it cannot be undone easily by subsequent local search It may consist of many perturbation steps Strong perturbation: more effective escape from local optima but similar drawbacks as random restart Weak perturbation: short subsequent local search phase but risk of revisiting previous optima Acceptance criteria: usually either the more recent or the best Tabu Search and ILS
16
Iterated Local Search – Part 2
Often leads to very good performance Only requires few lines of additional code to existing local search algorithm State-of-the-art results with further optimisations Tabu Search and ILS
17
ILS and The Scales – Part 1
We are going to look at some performance considerations that can be applied to all Heuristic Search Methods applied to the Scales Problem We will then look at how we implement ILS to tackle the Scales Problem Tabu Search and ILS
18
ILS and The Scales – Part 2
Representation At the moment we are representing a solution as a Binary String or Array of Integers Is this a good idea? How much redundancy is there in the representation? Each digit or part is either 0 or 1 This just needs one bit, but we are using 32 bits!!! Tabu Search and ILS
19
ILS and The Scales – Part 3
Representation We can save space and thus efficiency (speed) by just using the number of bits we need For n weights and b bits (32) we would need the following number of integers (m) to represent our weight/scales allocation We would need 32 integers for 1000 weights... Tabu Search and ILS
20
ILS and The Scales – Part 4
Luckily the latest version of Java comes with a built in class! import java.util.BitSet; public class BitSetTest { public static void main(String args[]) int n = 25; BitSet bs = new BitSet(n); bs.set(0,n,true); ShowBits(bs,n); bs.flip(0,n); bs.set(17,true); } private static void ShowBits(BitSet bs,int n) for(int i=0;i<n;++i) System.out.print((bs.get(i))?"1":"0"); System.out.println(); Output: Tabu Search and ILS
21
ILS and The Scales – Part 5
Fitness Our fitness function for the Scales problem is an O(n) algorithm However note the following: If we record and remember the LHS and RHS totals and the position (index) of the last small change If we changed a ‘1’ to a ‘0’ (moved from right to left) NewLHS = LHS + weight(index) NewRHS = RHS – weight(index) If we changed a ‘0’ to a ‘1’ (moved from left to right) NewLHS = LHS – weight(index) NewRHS = RHS + weight(index) Tabu Search and ILS
22
ILS and The Scales – Part 6
Fitness Thus we have created an updatable fitness function New Fitness = Old Fitness + Value based on small change We have reduced our time complexity from O(n) to O(1) I.e. For 1000 weights our program could be up to 1000 times faster!!! Combining this with the more compact representation discussed previously we now have a much more efficient algorithm Tabu Search and ILS
23
ILS and The Scales – Part 7
Implementation We will base our algorithms on the Random Restart Hill Climbing method We will reuse any code we might have We need a way of generating starting positions that are not entirely random These starting positions should be generated such that they are different to any previous starting points and local optima There are many ways of doing this, the version we are going to look at is a very simple version Tabu Search and ILS
24
ILS and The Scales – Part 8
Implementation We generate the first starting point randomly We also remember the local optima We bias the way that each bit is generated based on the recorded starting points and local optima Given m recorded points we generate a biased probability Let bij be the ith bit of starting point j (0 or 1) Tabu Search and ILS
25
ILS and The Scales – Part 9
Implementation Let p1i be the biased probability that position i was a one previously We set the starting point at position i to one with probability 1.0-p1i and to zero otherwise Tabu Search and ILS
26
ILS and The Scales – Part 10
Results Experiments were conducted on 10,000 weights generated randomly (UR) between 100 and 1000 100 Repeats All methods were allowed 10,000 fitness function calls Worst Fitness = RMHC = RRHC = 8.248 ILSHC = 8.192 Tabu Search and ILS
27
ILS and The Scales – Part 11
Results ILS is less than 1% better than RRHC! Better ways of combining the starting positions and previously discovered local optima might results in a better performance… Tabu Search and ILS
28
This Weeks Laboratory The next laboratory session has no new worksheets Use this time to make sure that you have caught up with any worksheets that are outstanding Tabu Search and ILS
29
Next Lecture There are no more lectures until the start of next term!
The next topic we will study is: Applications Parameter optimisation Tabu Search and ILS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.