Heuristic Optimization Methods: Tabu Search: Slides Prepared by Nina Skorin-Kapov
Heuristic Optimization Methods: Tabu Search: Slides Prepared by Nina Skorin-Kapov
Lecture 7
Heuristic Optimization Methods:
Tabu Search
Pseudocode
TS design elements
Zavod za telekomunikacije 2
Optimization methods
Exact Approximate
A*
methods methods
Simplex- Constraint
based for LP programming Approximation
algorithms
Heuristic
Branch and Bound, Dynamic
Cut , Price (B&B, programming algorithms
B&C, B&P)
Improvement (meta)heuristics
Constructive heuristics
• Local search
• Greedy algorithms
•Nature inspired
• Tabu search, Genetic
Hybrid methods
algorithms, Simmulated
• GRASP Annealing, Ant colony
•Problem specific
heuristics
Zavod za telekomunikacije 3
Tabu search
Zavod za telekomunikacije 4
Tabu Search: Escaping local optima
initial solution
Tabu search:
Local Search Allows non
solution: the first improving
local optimum solutions
Zavod za telekomunikacije 5
Tabu List: Avoid cycling
initial solution
Optimal
solution, but the Final solution: Not
search did not best seen necessarily
find it (incumbant) optimal!
Heuristic!
Zavod za telekomunikacije 7
Memory types
Zavod za telekomunikacije 8
Example: explicit memory
max f ( x) = x3 − 60 x 2 + 900 x + 50
x = [0,31], integer
Representation: x is shown in Explicit
Explicit
binary form with 5 bits memory
memory
s 1 0 0 1 1
ITERATION 1: f(s)
0 0 0 1 1 2237
Memorize full
1 1 0 1 1 293
N(s) previous solution
1 0 1 1 1 1177
1 0 0 0 1 2923 1 0 0 1 1
1 0 0 1 0 2642
Zavod za telekomunikacije 9
Example: attributive memory
max f ( x) = x3 − 60 x 2 + 900 x + 50
x = [0,31], integer
Representation: x is shown in Attributive
binary form with 5 bits memory
s 1 0 0 1 1
ITERATION 1: f(s)
0 0 0 1 1 2237 Memorize move
1 1 0 1 1 293 from previous to
N(s)
1 0 1 1 1 1177 new solution
1 0 0 0 1 2923
1 0 0 1 0 2642 Flip 4th bit
Zavod za telekomunikacije 10
Tabu List (1/2)
Zavod za telekomunikacije 12
Tabu list: structure and length
The tabu list is a problem-specific design issue
The structure depends on whether it uses
explicit/attribute memory
Usually updated cyclically after each iteration
Tabu tenure: for how many iterations do the
solutions/attributes in the list remain forbidden
(tabu)
Ifthe structure is such that explicit solutions are stored,
the tenure is the length of tabu list
Problem-specific; often determined experimentally
(parameter tuning)
If too big→the search can become too restrictive and inefficient
If too small→the search may get stuck in a local area
Zavod za telekomunikacije 13
Example
Objective and fitness function:
3 2
max f ( x) = x − 60 x + 900 x + 50
x = [0,31], integer
Representation: x in binary form with 5 bits
Initial solution:
1 0 0 1 1 f(s)=2349
Neighborhood: “1-flip”
Termination criterion: 6 iterations
Zavod za telekomunikacije 14
Example
Zavod za telekomunikacije 15
Example
Current
1 0 0 1 1 f(s)=2349
solution s Tabu list
Incumbent 0 0 0 0 0
1 0 0 1 1 f(sbest)=2349
solution sbest
Zavod za telekomunikacije 17
Example
After ITERATION 1:
s 1 0 0 0 1 f(s)=2923
Tabu list 0 0 0 3 0
Generate
neighborhood sbest 1 0 0 0 1 f(sbest)=2923
ITERATION 2: f(s)
0 0 0 0 1 891
1 1 0 0 1 675 Best neighbor not
N(s) tabu: f(s’)=3186
1 0 1 0 1 1751
tabu - New current
1 0 0 0 0 3186 solution
Zavod za telekomunikacije 18
Example
ITERATION 2: f(s)
Best neighbor: f(s’)=2923
0 0 0 0 1 891
1 1 0 0 1 675
N(s)
1 0 1 0 1 1751
s 1 0 0 0 0 f(s)=3186
tabu -
1 0 0 0 0 3186 New current solution
Obtained from old
current solution by Update Tabu list 0 0 0 2 3
changing the 5th bit tabu list
Zavod za telekomunikacije 19
Example
After ITERATION 2:
s 1 0 0 0 0 f(s)=3186
Tabu list 0 0 0 2 3
Generate
neighborhood sbest 1 0 0 0 0 f(sbest)= 3186
ITERATION 3: f(s)
0 0 0 0 0 50
1 1 0 0 0 914 Best neighbor not
N(s) tabu: f(s’)=2050
1 0 1 0 0 2050
tabu - New current
tabu - solution
Zavod za telekomunikacije 20
Example
ITERATION 3: f(s)
Best neighbor: f(s’)=2050
0 0 0 0 0 50
N(s) 1 1 0 0 0 914
1 0 1 0 0 2050 s 1 0 1 0 0 f(s)=2050
tabu -
tabu - New current solution
Obtained from old
Update Tabu list
current solution by 0 0 3 1 2
tabu list
changing the 3rd bit
Is s better than sbest, i.e. is
f(s)>f(sbest)? Don’t update sbest 1 0 0 0 0
f(s)=2050>f(sbest)=3186 incumbent
NO! solution f(sbest)=3186
Zavod za telekomunikacije 21
Example
After ITERATION 3:
s 1 0 1 0 0 f(s)=2050
Tabu list 0 0 3 1 2
Generate
neighborhood sbest 1 0 0 0 0 f(sbest)=3186
ITERATION 4: f(s)
0 0 1 0 0 2754 Best neighbor not
N(s) 1 1 1 0 0 162 tabu: f(s’)=2754
tabu - New current
tabu - solution
tabu -
Zavod za telekomunikacije 22
Example
ITERATION 4: f(s)
0 0 1 0 0 2754 Best neighbor: f(s’)=2754
N(s) 1 1 1 0 0 162
tabu -
tabu - s 0 0 1 0 0 f(s)=2754
tabu - New current solution
Obtained from old
Update Tabu list
current solution by 3 0 2 0 1
tabu list
changing the 1st bit
Is s better than sbest, i.e. is
f(s)>f(sbest)? Don’t update sbest 1 0 0 0 0
f(s)=2754>f(sbest)=3186 incumbent
NO! solution f(sbest)=3186
Zavod za telekomunikacije 23
Example
After ITERATION 4:
s 0 0 1 0 0 f(s)=2754
Tabu list 3 0 2 0 1
Generate
neighborhood sbest 1 0 0 0 0 f(sbest)=3186
ITERATION 5: f(s)
tabu -
0 1 1 0 0 3938 Best neighbor not
N(s) tabu: f(s’)=3938
tabu -
0 0 1 1 0 3506 New current
tabu - solution
Zavod za telekomunikacije 24
Example
ITERATION 5: f(s)
Best neighbor: f(s’)=3938
tabu -
0 1 1 0 0 3938
N(s)
tabu -
s 0 1 1 0 0 f(s)=3938
0 0 1 1 0 3506
tabu - New current solution
Obtained from old
Update Tabu list
current solution by 2 3 1 0 0
tabu list
changing the 2nd bit
Is s better than sbest, i.e. is
f(s)>f(sbest)? Update sbest 0 1 1 0 0
f(s)=3938>f(sbest)=3186 incumbent
YES! solution f(sbest)=3938
Zavod za telekomunikacije 25
Example
After ITERATION 5:
s 0 1 1 0 0 f(s)=3938
Tabu list 2 3 1 0 0
Generate
neighborhood sbest 0 1 1 0 0 f(sbest)=3938
ITERATION 6: f(s)
tabu -
tabu - Best neighbor not
N(s) tabu: f(s’)=3807
tabu -
0 1 1 1 0 3634 New current
0 1 1 0 1 3807 solution
Zavod za telekomunikacije 26
Example
ITERATION 6: f(s)
Best neighbor: f(s’)=3807
tabu -
tabu -
N(s)
tabu -
s 0 1 1 0 1 f(s)=3807
0 1 1 1 0 3634
0 1 1 0 1 3807 New current solution
Obtained from old
Update Tabu list
current solution by 1 2 0 0 3
tabu list
changing the 5th bit
Is s better than sbest, i.e. is
f(s)>f(sbest)? Don’t update sbest 0 1 1 0 0
f(s)=3807>f(sbest)=3938 incumbent
NO! solution f(sbest)=3938
Zavod za telekomunikacije 27
Example
After ITERATION 6:
s 0 1 1 0 1 f(s)=3807
Tabu list 1 2 0 0 3
sbest 0 1 1 0 0 f(sbest)=3938
Zavod za telekomunikacije 28
Alternative Tabu list structure
Tabu list
ITERATION 0 (initally): - - -
After ITERATION 1: 4 - -
After ITERATION 2: 5 4 -
After ITERATION 3: 3 5 4
After ITERATION 4: 1 3 5
After ITERATION 5: 2 1 3
After ITERATION 6: 5 2 1
Zavod za telekomunikacije 29
Tabu Search dimensions
Memory structures used in TS are designed to aid 4 different
dimensions of the search
Recency Frequency
Quality Influence
Zavod za telekomunikacije 30
TS dimensions
Recency
Short-term memory
Keeps track of solutions or
attributes/moves which have recently Recency
been visited and prohibits revisiting
them
Most commonly used memory type
Tabu list
If attributes or moves are memorized:
Selected attributes/changes occurring in
recently visited solutions become tabu,
i.e., all solutions (both already-visited and
not-yet-visited) which have those
attributes are prohibited while in the tabu
list
Zavod za telekomunikacije 31
TS dimensions
Frequency
Long-term memory
Records how many times we
have returned to the same Frequency
solution or attribute
Residence measures: the number of
times an attribute/solution is
observed
Transition measures: the number of
times an attribute/solution changes
from one value to another
Complements recency-based
memory
Zavod za telekomunikacije 32
TS dimensions
Quality
During the search, it records the
quality of solutions with certain
attributes Quality
Can be used to identify
attributes/elements that are
common to all (most) ‘good’
solutions → intensification
Can enable incentive-based
learning: reinforce moves which
lead to good solutions and penalize
those which lead to bad ones
(often used in aspiration criterion)
Zavod za telekomunikacije 33
TS dimensions
Influence
Records the impact (influence)
choices made during the search
Influence
have on the quality and structure
of the solutions
Some moves can drastically change
the solutions
Record how far we have moved
from the previous solution
(distance between solutions)
(often used in aspiration criterion)
Zavod za telekomunikacije 34
Main TS-specific design issues
Basic TS
technique
Long-term • Relates mostly to the frequency dimension
• Used for 2 main different purposes: DIVERSIFICATION
memory and INTENSIFICATION
Advanced TS
techniques
Aspiration • Utilizes the quality and influence dimensions to guide the
search to good solutions
• Can override the tabu list in case of exceptional solutions
criterion (better than incumbent)
Zavod za telekomunikacije 35
Long-term memory
Zavod za telekomunikacije 36
Long-term memory purposes
often visited)
memory
Zavod za telekomunikacije 37
Aspiration criterion
Relates mostly to TS
dimensions: quality and
influence Aspiration
Allows overriding the tabu list Criterion
by choosing a tabu move if it
is better than the incumbent
solution
Can also allow a tabu move
which generated a better
solution in a set of solutions
with a given attribute
Zavod za telekomunikacije 38
Pseudocode - minimization
Start Tabu Search
Generate initial solution s ;
0
s s ; s best s ;
0 0
TL = {}; // tabu list initially empty
Initialize aspiration criterion (AC)
Initialize other memory structures (e.g. long - term) if any;
do
Generate N(s, TL , AC); // neighborho od subject to tabu list and aspiration criterion
Find s ' N ( s, TL , AC ) where f ( s ' ) f ( s ' ' ) , s' ' N(s, TS, AC)
Update s s '
Update tabu list, s best , aspiration criterion, other memory structures;
If intesifica tion or diversific ation criterion then intesify or diversify search;
while stopping criterion not met
return s best ;
End
Zavod za telekomunikacije 39
Design components