lecture 3: tabu searchqf-zhao/teaching/mh/lec03.pdf · 2018. 9. 13. · tabu search • tabu search...

20
Lecture 3: Tabu Search An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/1

Upload: others

Post on 27-Jan-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

  • Lecture 3: Tabu Search

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/1

  • Neighborhood based search

    • In the algorithms studied so far, we have assumed

    – The solution space is discrete, so that each solution corresponds to a node (vertex) of a graph; and

    – Any solution is connected with a small number of nodes through the edges.

    • Starting from any node, we can expand the node one by one, and get the goal solution, if search is finished with success.

    • However, the solution space can be continuous, and the number of child nodes can be very large or even infinite.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/2

  • Neighborhood based search

    • Instead of using graph directly, we use the concept of neighborhood in search.

    • Intuitively, the neighborhood of a given solution is a set of “similar” solutions in the solution space.

    • Starting from any initial solution, we may improve the solution iteratively, and in each iteration, we can find a better solution from a neighborhood.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/3Lec03/3An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved ©

  • Definition of neighborhood

    A neighborhood is a mapping 𝑁: 𝑆 → 2𝑆 that assigns to each solution 𝑠 ∈ 𝑆 a set of solutions 𝑁(𝑠) ⊂ 𝑆, where 𝑆 is the solution set and 2𝑆 is the power set of 𝑆.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/4

    𝑁(𝑠)

    𝑠

  • Definition of neighborhood

    • The neighborhood 𝑁(𝑠) in a continuous space is a ball with center 𝑠 and radius 𝜀 > 0.

    • Euclidean distance is often used for continuous case.

    • The neighborhood 𝑁(𝑠) in a discrete space is a set of solutions in a ball with center 𝑠 and radius 𝜀 > 0.

    • The distance between two solutions 𝑠1 and 𝑠2 is usually defined as the number of moves needed to change the solution from 𝑠1 to 𝑠2.

    • Example: In a graph, the neighborhood of a node can be defined as the set of nodes (child nodes) directly connected with this node.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/5Lec03/5An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved ©

  • Neighborhood based search

    • Step 1: s=s0;

    • Step 2: Stop if terminating condition satisfied;

    • Step 3: Generate N(s);

    • Step 4: s’=FindBetterSolution(N(s));

    • Step 5: s=s’;

    • Step 6: Return to Step 2.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/6

  • Heuristics for selecting the neighbor

    • Best improvement (steepest descent): Select the best neighbor that improves the most the evaluation function.

    • First improvement: Select the first improving neighbor that is better than the current solution.

    • Random selection: Select the next neighbor at random.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/7

    In fact, the 2nd method can lead to the same quality of solutions as the 1st one using a lower computational cost.

  • Methods for evaluating a solution

    • In each iteration of search, we need to find a better solution in the neighborhood 𝑁(𝑠).

    • To evaluate the goodness or fitness of a solution, we need an objective function or cost function.

    • This function may not be in “closed-form”(e.g. given by an equation). It can be a “method” that assigns a real value fitness(s) to each solution s in S.

    • In some applications, the solution s is encoded in some form c(e.g. binary bit string) that cannot be evaluated directly.

    • In such a case, we need to de-code the solution first and then evaluate.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/8

  • Tabu Search

    • Tabu search (TS) was proposed by Fred W. Glover in 1986, and formalized in 1989.

    • The main purpose is to prevent search from cycling (i.e. visit the same region again and again).

    • TS is now a “standard” algorithm and is often used for comparison to verify the performance of new algorithms.

    • The whole process of TS is the same as the neighborhood based search.

    • The main difference is to introduce a Tabu-list (forbidden list) which functions in the similar way as the closed list, and use this list to control the search process.

    Lec03/9An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved ©

  • Heuristics and meta-heuristics

    • Using a neighborhood structure is a heuristic for reducing computational cost.

    – Instead of investigating all possible solutions in each iteration, we just look around the current solution.

    • Using Tabu list is a meta-heuristic for controlling the search process.

    – Instead of investigating all possible solutions in the neighborhood, we just look at those which have (or do not have) certain properties.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/10

  • What is Tabu list?

    • Tabu list is also called the short-term memory.

    • The main purpose is to prevent search from revisiting already visited solutions and its neighbors.

    • Different from the closed list, we do not store ALL visited solutions in the Tabu list.

    • Usually, only some forbidden solutions, moves or their attributes are stored in the Tabu list.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/11

  • Exception handling

    • Aspiration criterion: In Tabu search, we have an aspiration criterion to allow some exceptional moves.

    – A commonly used aspiration criterion is to allow a Tabu move if it generates a solution that is better than the current best one.

    • Tabu tenure: A move is forbidden when the current solution is in a certain region (neighborhood).

    – Once the search goes out of this region, we may allow this move.

    – A move is forbidden for a number of iterations. This number is called the Tabu tenure of the move.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/12

  • Procedure of Tabu Search

    • Step 1: Initialization

    s=InitialSolution();

    TabuList=Empty;

    CurrentBest=s;

    • Step 2: Tabu search

    while(StopCondition NOT satisfied)

    N(s)=FindNeighborhood(s);

    FeasibleSet=Empty;

    for each x in N(s)

    if(x does not have attributes in TabuList)

    FeasibleSet+={x};

    End

    End

    s’=FindBetterSolution(FeasibleSet);

    s=s’;

    If f(s) < f(CurrentBest)

    CurrentBest=s;

    End

    TabuList+=attributeof(s’);

    If(sizeof(TabuList)>maxSize)

    ExpireAttribute(TabuList);

    End

    End

    • Step 3: Output the result

    Output CurrentBest.

    Lec03/13An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved ©

  • Traveling salesman problem

    • Step 1: Initialize the current best solution s.

    • Step 2: Find a set of feasible solutions by swapping the order of some node pairs in s.

    • Step 3: Evaluate the solutions, and find the best solution s’ among the new solutions.

    • Step 4: s=s’.

    • Step 5: Add s’ to the Tabu list.

    • Step 6: Return to Step 2 if some terminating condition is not satisfied; Stop otherwise.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/14

    Note that s’ can be worse than s!

  • Example

    • Matlab File Exchange: Tabu search for TS

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/15

    https://jp.mathworks.com/matlabcentral/fileexchange/52902-tabu-search-ts

  • Medium-term memory

    • In a more advanced Tabu search, a medium-term memory is used to intensify search around some potentially good solutions.

    • The basic idea is to select some features of elite solutions, and put them to the medium-term memory.

    • More detailed search can be performed around solutions that possess features contained in the medium-term memory.

    • We may also restart search around the elite solutions.

    • Note that intensification may be a waste of time if the solution space contains a great number of local optimal solutions.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/16

  • Long-term Memory

    • Long-term memory is used to encourage diversification of search by storing some rules that promote diversity in the search process.

    – Restart: Restart the search from an un-explored region of the solution space.

    – Biased evaluation: Integrate the occurrence of solutions in the evaluation function to guide the search toward un-explored region and penalize frequently visited regions.

    – Strategic oscillation: Allow to consider infeasible solutions that may lead to better feasible ones later.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/17

  • Roles of different memories

    • Short-term memory=Tabu list: Similar to the closed list. Its role is to prevent search from cycling (re-visit some solutions or regions).

    – Visited solutions, used moves, or attributes

    • Medium-term memory: Similar to open list. Its role is to intensify the search by investigating some potentially good region in more detail.

    – Elite solutions, or attributes.

    • Long-term memory: Similar to open list. Its role is to diversify the search by investigating un-explored regions.

    – Frequency of attributes appear in visited solutions.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/18

  • A more complete Tabu search

    • Step 1: s=s0; s_best=s0; Reset all memories;

    • Step 2:

    – Find N(s) and FeasibleSet;

    – s’=FindBetterSolution(FeasibleSet);

    – s’’=FindBetterSolution(N(s)-FeasibleSet);

    – If(fitness(s’’)>fitness(s_best)) s=s’’ Else s=s’;

    • Step 3: Update all memories and s_best.

    • Step 4: If(SearchTerminate) continue; Else Return to Step 2.

    • Step 5: If(ProgramTerminate) stop;

    • Step 6:

    – If(intensify) s=SelectStartPoint(MediumTermMemory);

    – If(Diversify) s=SelectStartPoint(LongTermMemory);

    • Step 7: Return to Step 2.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/19

  • Homework

    • Read the pseudo code given in p. 18 once again, try to understand, and add a comment for each line.

    • Submit your answer in hard copy before the class of next week.

    An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved © Lec03/20