solving qap using tabu search

Download Solving Qap Using Tabu Search

Post on 06-Sep-2014




8 download

Embed Size (px)


Presented by, Anand A J M3 IE CET

QUADRATIC ASSIGNMENT PROBLEM (QAP) Given n objects and the flows f ij between the object i and the object j (i, j =

1. . . n), and given n sites with distance drs between the sites r and s (r, s = 1. . . n), the problem deals with placing the n objects on the n sites so as to minimize the sum of the products, flows distances.



f ij ...



objects Cost = f ij drs

drs. ...






QAP contd Mathematically, it is equivalent to find a permutation p, whose

ith component pi denotes the place of the object i, which minimizes,


assignment of offices or services in buildings (e.g. university campus, hospital, etc.), the assignment of the departure gates to airplanes in an airport, the placement of logical modules in electronic circuits, the distribution of the files in a database and the placement of the keys of keyboards of typewriters

EXAMPLE Consider the placement of 12 electronic modules (1, . . . ,

12) on 12 sites (a, b, . . . , l)

Table 1- number of connections between modules

Figure 1-Optimum solution

BASIC TABU SEARCH the problem to be solved can be formulated in the

following way:

f denotes the objective function, s a feasible solution of the problem and S the entire set of feasible solutions.

Neighborhood Tabu search is primarily centered on a non-trivial exploration

of all the solutions in a neighborhood For any solution s of S, a set N(s) S that is a set of the neighboring solutions of s For the quadratic assignment problem, s can be a permutation of n objects and the set N(s) can be the possible solutions obtained by exchanging two objects in a permutation

Figure 2- creating a neighboring solution

Moves, neighborhood A modification made to a solution is called a move The modification of a solution of the QAP can be considered as

a move, characterized by the two elements to be transposed in the permutation

Figure 3- Set of the permutations of 4 elements

Moves, neighborhood contd.. The set N(s) of the solutions in the neighborhood of the

solution s can be expressed as the set of the feasible solutions which one can obtain while applying a move m to the solution s, m pertaining to a set of moves M

Figure 4-Three possible neighborhoods on permutations (inversion, transposition, displacement)

Moves, neighborhood contd.. The capabilities of these various types of neighborhoods to

direct a search in few iterations towards good solutions are very different. For inversion the number of moves is limited to n-1 (shows

worst behavior for many problems) For transposition neighborhood it is n(n-1)/2 (used for QAP) Displacement neighborhood is of size n(n-2)+1 (used for

scheduling applications)

Evaluation of the neighborhood Evaluation of neighborhood has to be done algebraically rather

than empirically Let us define (s,m) = f(s m) f(s) The numerical evaluation of f(s m) f(s) would be the

equivalent to a numerical evaluation of the gradient. The calculation of the simplified function (s,m) would be the

equivalent of the evaluation of the gradient by means of a function implemented with the algebraic expressions of the partial derivatives.

Evaluation of the neighborhood contd.. If we apply a move m to s during current iteration, we can

evaluate (sm,m) as a function of (s,m) (which was evaluated in the preceding iteration)

Thus the entire neighborhood can be examined very

rapidly by memorizing the values of (s,m).

Algebraic example of simplification for the QAP With flows matrix F = (fij) and distances matrix D = (drs),

the value of a move m = (i, j) for a solution p is given by:

By memorizing the value of (p, (i, j)), we can calculate

the value of (q, (i, j))

CANDIDATE LIST One possible way of accelerating the evaluation of the neighborhood can be to

reduce its size; this reduction may also have the goal of directing the search. To reduce the number of eligible solutions of N(s), some authors adopt the

policy of randomly choosing a small number of solutions from N(s). When a neighborhood is given by a static set M of moves, one can also consider

partitioning M into subsets; in each iteration, only one of these subsets will be examined. During the later iterations, only those moves that were classified among the best

will be considered. This is implemented in form of a data structure called candidate list.

SHORT-TERM MEMORY To make use of memory in an iterative process, the first

idea that comes to mind is to check if a solution in the neighborhood was already visited. It requires to memorize each solution visited and to test in

each iteration for each eligible solution, if the later were already enumerated. This can possibly be done efficiently by using hashing


Hashing tables To direct an iterative search, is to prohibit the return to a

solution whose value was already obtained during t last iterations. Thus we can prevent a cycle of length t or less If f(sk), the value of solution sk in iteration k, is assumed to be an integer, one can memorize in T[f(sk) modulo L] the value k + t If a solution s of the potential neighborhood of the solution in the iteration k is such that T[f(s) modulo L)] > k, s will not be considered any more as an eligible solution

Tabu list

Duration of tabu conditions For a very small number of tabu moves, the iterative

search will tend to visit the same solutions over and over again. If this number is increased, the probability of remaining

confined to a very limited number of solutions decreases and, consequently, the probability of visiting several good solutions increases.

TABU LIST FOR THE QAP A solution for the QAP can be represented under the form of a

permutation p of n elements Type of move very frequently used for this problem is to transpose

the positions of two objects i and j The technique for directing search at short-term is to prohibit, during

t iterations, the application of the reverse of the moves If the move (i, j) is applied to the permutation p, the reverse of a

move can be defined as a move which simultaneously places the object i on the site pi and the object j on the site pj

TABU LIST FOR THE QAP contd. t, the number of iterations during which one avoids applying

the reversal of a move, is uniformly drawn at random, between [0, 9n] and [1, 1n+4] To implement this tabu mechanism in practice, a matrix T will

be used whose tir entry will give the iteration number during which the element i was moved the last time from the site r (to go to the site pi), number to which one adds the tabu duration t Thus, the move (i, j) will be prohibited if both entries tipj and tjpi

contain values higher than the current iteration number


Iteration 0 the initial solution p = (2, 4, 1, 5, 3) of cost 72, the search

can be started by initializing the matrix T = 0

TABU LIST FOR THE QAP contd. Iteration 1 the value (p, (i, j)) is calculated for each transposition (i, j):

It is assumed that the move (1,3) is retained. it is prohibited

during t = 9 iterations (i.e. until the iteration 10) to put element 2 on site 1 and element 1 on site 3 simultaneously

TABU LIST FOR THE QAP contd. Iteration 2 The move chosen during iteration 1 leads to the solution p = (1, 4, 2, 5,

3) of cost 60. Calculating the value of each transposition,

For this iteration, the reverse of the preceding move is prohibited,

authorized move (1, 4), giving minimum cost, is retained, for a profit of 8 randomly selected tabu duration of the reverse move is t = 6, the matrix T becomes,

TABU LIST FOR THE QAP contd. Iteration 3 The solution p = (5, 4, 2, 1, 3) of cost 52

the random selection of the tabu duration results in t = 8, the

following matrix is obtained,

TABU LIST FOR THE QAP contd. Iteration 4 solution p = (5, 2, 4, 1, 3) of cost 52

It is not possible any more to choose the move (2, 3) corresponding to

the minimum cost, which could bring us back to the preceding solution, because this move is prohibited. Similar situation arises for the move (1, 4). Hence we are forced to choose an unfavorable move (2, 4), that increases the cost of the solution by 8, with a selected tabu duration of t = 5,

TABU LIST FOR THE QAP contd. Iteration 5 The solution at the beginning of this iteration is: p = (5, 1, 4, 2, 3)

move degrading the quality of the solution at the preceding

iteration was beneficial, because it now facilitates to arrive at an optimal solution p = (4, 1, 5, 2, 3) of cost 50, by choosing the move (1, 3)

A C++ program for the Robust taboo search method of Taillard, 1991