92
CHAPTER – V
VARIANT CONSTRAINT TRAVELLING SALESMAN
PROBLEM
5.1. Introduction:
There are many algorithms for usual one man TSP developed by
researchers from time to time. But the problem has not received
much attention in its restricted context. However, literatures which
are available in regard to the TSP with variations are discussed (Das -
1976, 78, Jaillet P - 1985, Kubo & Kasugai - 1991, Pandit - 1961, 63,
64, 65, Ramesh - 1981, Raviganesh G.S. Murthy & Das - 1998 and
Srivastava Kumar, R.C. Garg and P. Sen - 1969).
The earliest papers on the Generalized Travelling Salesman
Problem discuss the problem in the context of particular applications
by Henry-Labordere (1969), Saskena (1970), and Srivasatava et al
(1970). Laporte et al. (1985&1987) and Laporte and Nobert (1983)
began to study exact algorithm and some theoretical aspects of the
problem in the 1980s. Fischetti et al (1995) discuss facet-defining
inequalities for the GTSP polytope, and in a later paper Fischetti et al
(1997) use the polyhedral results to develop a branch and cut
algorithm. Other exact algorithms are presented by Noon (1991) (A
lagrangian-based branch and bound algorithm] and Chenstov (1997)
(A dynamic programming algorithm).
A variety of descriptions of the GTSP are presented in the
literature. Some papers assume symmetry or the triangle inequality;
other do not some require the subsets to form a strict partition of the
node set, others allow them to overlap. Some require that exactly one
node per cluster be visited. (The two formulations are equivalent if the
distance matrix satisfies the triangle inequality). Only a few authors
93
Laporte et al (1983), Saskena et al (1970) handle fixed costs for
including a node on the tour, possibly because such fixed costs can be
incorporated into the distance costs via a simple transformation.
Applications of the GTSP are discussed by Ben-Arieh et al
(2003), Dimitrijevic et al(1997) and Noon(1988). Dror et al(1997)
transforms the clustered rural postman problem into the GTSP. Ben-
Arieh et al (2003), Laporte et al(1999),Lien et al (1993) and Noon(1993)
present transformations of the GTSP into standard TSP instances that
can then be solved using TSP algorithms and heuristics. Some of the
resulting TSP instances have nearly the same number of nodes as the
original GTSP instances and have nice properties like symmetry and
the triangle inequality; others have many more nodes and are more
irregular. Some transformations of the GTSP into the TSP by Noon
(1993) have the property that an optimal solution to the related TSP
can be converted to an optimal solution to the GTSP, but a (sub-
optimal) feasible solution for the TSP may not perform well for the
GTSP; for example, “generalized” versions of Christofides‟s heuristic
have worst-case bounds that are strictly greater than its worst-case
bound of 3/2 for the TSP by Dror et al (1997) and Slavik(1997).
Two approximation algorithms have been published for the
GTSP. Slavik (1997) develops a 3 /2-approximation algorithm for the
GTSP, where is the number of nodes in the largest cluster, that is,
=max {1vi1},i=1,2,….,m. As may be quite large, the worst-case
bound may be relatively weak. Garg et al (2000) present an
approximation algorithm for the group Steiner problem, which
provides as a byproduct an O (log21v1loglog1v1logm)-approximation
algorithm for GTSP. Both papers assume that the distance matrix
satisfies the triangle inequality.
94
Noon (1988) proposed several heuristics for the GTSP, the most
promising of which is an adaptation of the well-known nearest-
neighbor heuristic of the TSP. Fischetti et al (1997) propose similar
adaptations of the farthest-insertion, nearest-insertion, and cheapest-
insertion heuristics.
Renaud and Boctor (1998) develop the most sophisticated
heuristic published to date, which they call GI3 [Generalized
Initialization, Insertion, and Improvement]. GI3 is a generalization of
the I3 heuristic proposed by Renuaud (1996). It consists of three
phases. The first, Initialization, constructs an initial tour by choosing
one node from each cluster that is “close” to other clusters, then
greedily building a tour that passes through some, but necessarily all,
of the chosen nodes. The second phase, Insertion, completes the tour
by successively inserting nodes from unvisited clusters in the
cheapest possible manner between two consecutive clusters on the
tour, allowing the visited node to change for the adjacent clusters;
after each insertion, the heuristic performs a modification of the 3-opt
improvement method. The third phase, Improvement, uses
modifications of 2-opt and 3-opt to improve the tour. The
modifications, called G2-opt, G3-opt and G-opt, allow the visited
nodes from each cluster to change as the tour is being re-ordered by
the 2-opt or 3-opt procedure. But in all the above attempts the simple
combinatorial structure of the GTSP is not at all taken into
consideration.
The standard TSP is called „Two Dimensional TSP‟. The standard
TSP has been generalized in many directions In the present problem
we have considered the third dimension time (availing facility) which
influences the cost, implementing the Lexicographic Search Approach,
and make use of Pattern Recognition Technique which take care of the
simple combinatorial structure of the problem.
95
In this chapter we study a problem called “Variant Constraint
Travelling Salesman Problem” (VCTSP).
“There are n cities and N= {1, 2, 3,... ,n}. The cost array C (i, j, k)
is the cost of a salesman visiting from city i to city j at time (availing
facility) k is known (i, j=1, 2, 3,…, n; k=1, 2, 3,…..m)”.Here the third
dimension need not be the usual time which is continuous, but a
factor which influences the cost C and can be a facility.
A variant of well – known Traveling Salesman Problem where a
tour does not necessarily visit all cities is called the Generalized
Traveling Salesman Problem. More specifically, the set of „n‟ cities are
divided into r sets such that the N = 𝑁1, 𝑁2, 𝑁3, … 𝑁𝑟 and 𝑁𝑖 ∩ 𝑁𝑗 = ∅.
A subset with m < n cities has to be traveled by the salesman. The
number of cities travelled by as salesman is m. The Travelling
Salesman has to visit 𝑛𝑝 cities in the 𝑁𝑝 sets. The problem is to find a
minimum cost tour by visiting „m‟ cities with given number of 𝑛𝑝 cities,
where 𝑛𝑝𝑟𝑝=1 ≤ 𝑚.
In the sequel we will develop a lexi-search algorithm based on
the “Pattern Recognition Technique” to solve this problem which takes
care of the simple combinatorial structure of the problem.
Lawrence V. Snyder and Mark S. Daskin (2006), have also
attempted the above problem with two dimensional problem and the
travelling salesman has to visit only one city in each cluster, which
was published in European Journal of Operational Research.
5.2. Mathematical Formulation:
𝑀𝑖𝑛𝑖𝑚𝑖𝑧𝑒 𝑍 = 𝐶 𝑖, 𝑗, 𝑘 𝑋(𝑖, 𝑗, 𝑘)𝑚𝑘=1
𝑛𝑗=1
𝑛𝑖=1 ----------- (5.1)
Subject to
𝑋 𝑖, 𝑗, 𝑘 = 1,𝑛𝑗=1
𝑛𝑖=1 k = 1,2, …, m ---------(5.2)
96
𝑋 𝑖, 𝑗, 𝑘 = 𝑚,𝑚𝑘=1
𝑛𝑗=1
𝑛𝑖=1 -------- (5.3)
𝑋 𝑖, 𝑗, 𝑘 = 0 𝑜𝑟 1 ------- (5.4)
Constraints (5.2) and (5.3) and the restrictions
are 𝑋 𝑖, 𝑗, 𝑘 = 𝜉𝑖𝑚𝑘=1
𝑛𝑗=1 , 𝜉𝑖 = 1, 𝑖 𝜖 𝑁𝑝 & 𝜉𝑖 = 0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 and 𝜉𝑖 =𝑖𝜖 𝑁𝑝
𝑛𝑝 , 𝑋 𝑖, 𝑗, 𝑘 = 𝜉𝑗𝑚𝑘=1
𝑛𝑖=1 , 𝜉𝑗 = 1, 𝑗 𝜖 𝑁𝑝 & 𝜉𝑗 = 0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 and
𝜉𝑗 = 𝑛𝑝𝑗𝜖 𝑁𝑝 define the constraint set of the generalized TSP, whose
objective function (5.1) is minimum. Constraint (5.4.) represents that
the Salesman visits the city j from city i at time or facility k is 1
otherwise 0. X is a feasible tour is it satisfies all the constraints and
restrictions.
5.3. Numerical Illustration:
The concepts and the algorithm developed will be illustrated by
a numerical example for which n = 6, m = 4 and let N = [1, 2, 3, 4, 5,
6]. The costs of the numerical example are given below the table – 5.1.
Table – 5.1
𝐶 𝑖, 𝑗, 1 =
999 40 7 45 1 960 999 30 51 39 74 7 999 7 21 20
36 6 15 999 46 391 29 3 21 999 405 29 2 40 7 999
𝐶 𝑖, 𝑗, 2 =
999 14 30 2 10 2617 999 15 29 4 822 19 999 16 39 501 7 17 999 5 29
47 30 36 5 999 2041 39 14 1 7 999
97
𝐶 𝑖, 𝑗, 3 =
999 3 1 40 20 3042 999 30 40 17 75 35 999 29 1 42 16 29 999 45 38
41 30 35 16 999 117 21 38 4 2 999
𝐶 𝑖, 𝑗, 4 =
999 7 41 1 17 2139 999 4 5 17 289 21 999 35 39 15
34 2 1 999 16 401 54 14 32 999 6
26 6 34 7 1 999
In the numerical example given in Table-1, C (i, j, k), i=j, i,
j=1,2,3,4,5,6, k=1,2,3,4 are taken to be very high number 9999
because they are irrelevant for finding tours of the salesman. Though
the entire C (i, j, k) are taken as non – negative integers it can be
easily seen that this is not a necessary condition and the cost as well
be negative quantities. Similarly n1, n2, n3 need not be 1 and can take
any integer values where in m n . In this example we consider the
first two cities i.e. 1 and 2 are considered as a first group and the
salesman has compulsory visited one city from this group, 3 and 4 are
considered as second group and the salesman has compulsory visited
one city from this group, the remaining cities 5 and 6 are considered
as third group and the salesman has compulsory visited one city from
this group. A tour is a feasible trip-schedule for the salesman. Trip-
schedule of the Salesman can be represented by an appropriate n*n*m
indicator array X=[X (i, j, k), X (i, j, k) = 0 or 1 in which X (i, j, k) =1
indicates that the salesman visits city j from city i at time (availing
facility) k and if there is no such trip it is indicated by X (i, j, k) =0]. X
is called a „solution‟. In this problem, the sum of cities in the tours
must be equal to number of truncated cities m. The indicator X given
in Table-5.2 is represented as four matrices for different values of k
i.e., 1,2,3,4 is a solution to the numerical example and is represented
as follows:
98
Table – 5.2
𝑋 𝑖, 𝑗, 1 =
0 0 0 0 0 00 0 0 0 0 00 0 0 0 1 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 0
𝑋 𝑖, 𝑗, 2 =
0 0 1 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 0
𝑋 𝑖, 𝑗, 3 =
0 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 1 0 0 0 00 0 0 0 0 0
𝑋 𝑖, 𝑗, 4 =
0 0 0 0 0 01 0 0 0 1 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 0
The representation of the solution X to the problem is that the
salesman visits city 3 from city 1 that is from group 1 to group 2 at
time 2, salesman visits city 5 from city 3 that is from group 2 to group
3 at time 1, salesman visits city 2 from city 5 that is from group 3 to
group 1 at time 3 and visits city 1 from city 2 that is group 1 to group
1 at time 4. This solution is a feasible solution.
5.4. Concepts and Definitions:
5.4.1. Definition of a Pattern:
An indicator three-dimensional array which is associated with a
tour is called a pattern. A pattern is said to be feasible if X is a feasible
solution. The pattern represented in the table-5.2 is a feasible pattern.
Now V(x) the value of the pattern X is defined as
𝑉 𝑋 = 𝐶 𝑖, 𝑗, 𝑘 𝑋(𝑖, 𝑗, 𝑘)𝑚𝑘=1
𝑛𝑗=1
𝑛𝑖=1
The value V(X) gives the total cost of the tour for the solution
represented by X. Thus the value of the feasible pattern gives the total
cost represented by it. In the algorithm, which is developed in the
sequel, a search is made for a feasible pattern with the least value.
99
Each pattern of the solution X is represented by the set of ordered
triples [(i, j, k)] for which X (i, j, k) =1, with the understanding that the
other X (i, j, k)‟s zeros.
There are M= n n m ordered triples in the three-dimensional
array X. For convenience these are arranged in ascending order of
their corresponding costs and are indexed from 1 to M (Sundara
Murthy-1979). Let SN= [1, 2, 3…M] be the set of M indicies. Let V be
the corresponding array of costs. If a, bSN and a < b then D(a) D
(b). Also let the arrays R, C, T be the array of row, column and time
indicies of the ordered triples represented by SN and DC be the array
of cumulative sums of the elements of D. The arrays SN, D, DC, R, C,
T for the numerical example are given in the table-5.3. If P SN then
(R(P), C(P),T(P)) is the ordered triple and D(a)= C(R(a),C(a),T(a)) is the
value of the ordered triple and DC(a)= 𝐷(𝑖)𝑎𝑖=1 .
TABLE-5.3
ALPHABET - TABLE
S.NO. D DC R C T
1 1 1 1 5 1
2 1 2 5 1 1
3 1 3 4 1 2
4 1 4 6 4 2
5 1 5 1 3 3
6 1 6 3 5 3
7 1 7 1 4 4
8 1 8 4 3 4
9 1 9 5 1 4
10 1 10 6 5 4
100
11 2 12 6 3 1
12 2 14 1 4 2
13 2 16 4 1 3
14 2 18 6 5 3
15 2 20 4 2 4
16 3 23 5 3 1
17 3 26 1 2 3
18 4 30 3 1 1
19 4 34 2 5 2
20 4 38 3 6 3
21 4 42 6 4 3
22 4 46 2 3 4
23 5 51 6 1 1
24 5 56 4 5 2
25 5 61 5 4 2
26 5 66 3 1 3
27 5 71 2 4 4
28 6 77 4 2 1
29 6 83 5 6 4
30 6 89 6 2 4
31 7 96 1 3 1
32 7 103 2 6 1
33 7 110 3 2 1
34 7 117 3 4 1
35 7 124 6 5 1
36 7 131 4 2 2
101
37 7 138 6 5 2
38 7 145 2 6 3
39 7 152 6 1 3
40 7 159 1 2 4
41 7 166 6 4 4
42 8 174 2 6 2
43 9 183 1 6 1
44 9 192 3 1 4
45 10 202 1 5 2
-- -- -- -- -- --
-- -- -- -- -- --
-- -- -- -- -- --
Let us consider 12 SN. It represents the ordered triple
(R(12),C(12),T(12))=(1, 4, 2). Then D (12) =C (1, 4, 2) = 2 and DC
(12) = 14
5.4.2. Definition of an Alphabet-Table and a word:
Let LK= {a1, a2,……,aK}, ai SN be an ordered sequence of k
indicies from SN. The pattern represented by the ordered triples
whose indicies are given by Lk is independent of the order of ai in the
sequence. Hence for uniqueness the indicies are arranged in the
increasing order such that ai < ai+1, i=1, 2… n-1. The set SN is defined
as the “Alphabet-Table” with alphabetic order as (1, 2, 3,…, M) and
the ordered sequence LK is defined as a “word” of length k. A word Lk
is called a “Sensible word” if ai<ai+1, for i=1, 2, 3…k-1 and if this
condition is not met it is called a “insensible word”. A word LK is said
to be feasible if the corresponding pattern X is feasible and same is
with the case of infeasible and partial feasible. Therefore a partial
102
feasible word is said to be feasible word if k=m. A partial word Lk is
said to be feasible if the block of words represented by LK has at least
one feasible word or, equivalently the partial pattern represented by Lk
should not have any inconsistency. Any of the letters in SN can
occupy the first place in the partial word L k . Consider LK-1 =
(a1,a2,……,ak-1). The alphabet table for the kth position is SNak-1=(ak-
1+1,ak-1+2…M), where SNP is defined as SNP =(p+1,p+2,…….,M). Thus
for example consider a word with two letters as (a1, a2) = (1, 3). Then
SNa2=SN3= (4, 5, 6…120) is the alphabet for the third position. We
concentrate on the set of words of length at most m (for the numerical
example it is 4). A leader Lk (k<m) is said to be feasible, if the block of
words defined by it contains at least one feasible word or equivalently
there should not be inconsistency in the partial pattern defined by the
partial word.
The value of the LK , V (LK) is defined recursively as V (LK)=V (LK-1)+ D
(aK) with V (L0)=0 obviously this V(LK) and V(X) the values of the
pattern X represented by L k will be same (Sundara Murthy-1979).
5.4.3. Lower Bound of a partial word LB (LK):
A lower bound LB (L k ) for the values of the block of words
represented by L k can be defined as follows:
LB (LK) = V (LK) + j)D(akm
1j
k
= V (LK) +DC (ak + m-K)-DC (ak)
5.4.4. Feasibility Criterion of a Partial word:
A recursive algorithm is developed for checking the feasibility of
a partial word LK+1= (a1, a2,…..,ak, ak+1) given that LK is a feasible
partial word. We will introduce some more notations which will be
useful in the sequel.
103
IR be an array where IR (i) =1, i N represents that the salesman
is visiting some city from city i, otherwise zero.
IC be an array where IC (i) =1, i N represents that the salesman
is coming to city i from Some city; otherwise zero.
IT be an array where IT (i) =1, i N represents that the salesman
at time (facility) „i‟ travels one pair of cities.
SW be an array where SW (i) is the city that the salesman is visiting
from city i,Sw(i) = 0 indicates that the salesman is not visiting any
city from city i.
L be an array where L (i) is the letter in the ith position of a
word.
NL be an array where NL (i) =q indicates that q cities are covered up
to ith Position of a Word.
GS be an array where GS (i) represents ith group number of cities.
Then for a given partial word LK = (a1,a2,…..,aK) the values of the
arrays RI, CI, TI, SW, L ,NL and GS as follows.
IR(R (ai)) =1, i=1, 2, 3……..K
IC(C (ai)) =1, i=1, 2, 3……..K
IT (T (ai)) =1, i=1, 2, 3……. K
SW(R (ai)) =C (ai), i=1, 2, 3……..K
L (i) =ai, i=1, 2, 3……..K
NL(i)=NL(i-1)+1, if IC(R(ai))=0 and NL(i)=NL(i-1)+1, if IR(C(ai))=0
i=1,2,3….K
GS (GN(R (ai)) =GS (GN(R (ai)) +1 if IC(R (ai)) =0 and
GS (GN(C (ai)) =GS (GN(C (ai)) +1 if IR(C (ai)) =0 i=1,2,3….K
The recursive algorithm for checking the feasibility of a partial
word LP is given as follows: In the algorithm first we equate IX=0. At
the end if IX=1 then the partial word is feasible, otherwise it is
104
infeasible. For this algorithm we have TR=R (ap+1), TC=C (aP+1) and
TT=T (aP+1).
Algorithm – 1:
STEP1: IX=0
NXA=NL [I-1]
TCX=TC
GOTO 2
STEP 2: IS (IR (TR) = 1) IF YES GOTO 10
IF NO GOTO 2A
STEP2A: IS (IC (TC) = 1) IF YES GOTO 10
IF NO GOTO 2B
STEP2B: IS (IT (TT) = 1) IF YES GOTO 10
IF NO GOTO 3
STEP3: IS IC (TR) =0 IF YES NXA=NXA+1 GOTO 3A
IF NO GOTO 3A
STEP3A: IS IR (TC) =0 IF YES NXA=NXA+1 GOTO 3B
IF NO GOTO 3B
STEP3B: IS (NXA>M) IF YES GOTO 10
IF NO GOTO 4
105
STEP4: IS IC (TR) =0 IF YES GS (GN (TR)) = GS (GN
(TR)) +1
GOTO 4A
IF NO GOTO 4A
STEP4A: IS IR (TC) =0 IF YES GS (GN (TC)) = GS (GN
(TC)) +1
GOTO 4B
IF NO GOTO 4B
STEP4B : IS GS (GN (TR)) <= GP (TR) IF YES GNZ1=0
GOTO 4C
IF NO GNZ1=1 GOTO
4C
STEP4C : IS GS (GN (TC)) <= GP (TC) IF YES GNZ2=0
GOTO 4D
IF NO GNZ2=1 GOTO
4D
STEP4D: NPA=NP-(GNZ1+GNZ2) GOTO 5
STEP5: IS M – NXA <= NPA IF YES GOTO 6
IF NO GOTO 7
STEP6: IS (SW (TCX) = 0) IF YES IX=1 GOTO 10
IF NO IK=SW (TCX) GOTO 6A
STEP6A: IS (IK=TR) IF YES GOTO 6B
106
IF NO TCX=IK GOTO 6
STEP6B: IS (I=M) IF YES IX=1 GOTO 10
IF NO GOTO 10
STEP7: IS IC (TR) =0 IF YES GS (GN (TR)) = GS (GN
(TR)) – 1
GOTO 7A
IF NO GOTO 7A
STEP7A: IF IR (TC) =0 IF YES GS (GN (TC)) = GS (GN
(TC)) – 1
GOTO 10
IF NO GOTO 10
STEP10: STOP.
This recursive algorithm will be used as a subroutine in the lexi-
search algorithm. We start the algorithm with a very large value, say,
9999 as a trial value of VT. If the value of a feasible word is known, we
can as well start with that value as VT. During the search the value of
VT is improved. At the end of the search the current value of VT gives
the optimal feasible word. We start with the partial word L1= (a1) = (1).
A partial word Lp=Lp-1 (ap) where indicates chain form or
concatenation. We will calculate the values of V (Lp) and LB (Lp)
simultaneously. Then two cases arises (one for branching and other
for continuing the search).
107
1. LB (Lp) < VT. Then we check whether Lp is feasible or not. If it is
feasible we proceed to consider a partial word of order (p+1),
which represents a sub block of the block of words represented
by Lp. If Lp is not feasible then consider the next partial word of
order p by taking another letter which succeeds ap in the pth
position. If all the words of order p are exhausted then we
consider the next partial word of order (p-1).
2. LB (LP) VT. In this case we reject the partial word meaning that
the block of words with Lp as leader is rejected for not having an
optimal word and we also reject all partial words of order p that
succeeds Lp.
Now we are in a position to develop lexi search algorithm to
find an optimal feasible word.
ALGORITHM 2: (LEXI-SEARCH ALGORITHM)
The following algorithm gives an optimal feasible word.
STEP 1 : (Initialization)
The arrays SN, D, DC, R, C, T and values of
N, M, GN, GP are made available IR, IC, IT, SW,
L, NL, GS, V, LB are initialized to zero. The values
I=1, J=0, VT=9999, NZ=NNM –N, MAX=NZ-1
STEP 2 : J=J+1
IS (J>MAX) IF YES GOTO 11
IF NO GOTO 3
STEP 3 : L (I) = J
JA = J + M - I
IS (I = 1) IF YES NXA = 0, V (I) = D (J) GOTO
3B
108
IF NO NXA=NL (I-1) GOTO 3A
STEP 3A : V (I) = V (I -1) + D (J)
GOTO 3B
STEP 3B : LB (I) = V (I) + DC (JA) – DC (J)
GOTO 4
STEP 4 : IS (LB (I) VT) IF YES GOTO 11
IF NO GOTO 5
STEP 5 : TR=R (J)
TC=C (J)
TT=T (J)
GOTO 6
STEP 6 : CHECK THE FEASIBILITY OF L (USING
ALGORITHM-1)
IS (IX=0) IF YES GOTO 2
IF NO GOTO 7
STEP 7 : IS (I=M) IF YES GOTO 10
IF NO GOTO 8
STEP 8 : L (I) = J
IR (TR) = 1
IC (TC) = 1
109
IT (TT) = 1
SW (TR) = TC
NL (I) = NXA
GOTO 9
STEP 9 : I=I+1
MAX=MAX+1
GOTO 2
STEP10 : L (I) =J
L (I) IS FULL LENGTH WORD AND IS FEASIBLE.
VT=V (I), record L (I), VT,
GOTO 13
STEP11 : IS (I=1) IF YES GOTO 14
IF NO GOTO 12
STEP12 : I=I-1
MAX=MAX+1
GO TO 13
STEP13 : J=L (I)
NL (I) = 0
TR = R (J)
TC = C (J)
TT = T (J)
IR (TR) = 0
IC (TC) = 0
110
IT (TT) = 0
SW (TR) = 0
GS (GN (TR)) = GS (GN (TR)) -1
GS (GN (TC)) = GS (GN (TC)) -1
GOTO 2
STEP14 : STOP
END
The current value of VT at the end of the search is the value of
the optimal feasible word. At the end if VT = 9999 it indicates that
there is no feasible solution.
5.5. Search Table:
The working details of getting an optimal word, using the above
algorithm for the illustrative numerical example are given in the
Table-5. The columns (1), (2), (3) and (4) gives the letters in the first,
second, third and fourth places respectively. The corresponding V (I)
and L B (I) are indicated in the next two columns. The rows R, C and T
give the row, column and time indices of the letter. The last column
gives the remarks regarding the acceptability of the partial words. In
the following table A indicates ACCEPT and R indicates REJECT.
TABLE- 5.4
SEARCH TABLE
S.N
O 1 2 3 4 V LB R C T REM
1 1 1 4 1 5 1 A
2 2 1 4 5 1 1 R
3 3 1 4 4 1 2 A
4 4 1 4 6 4 2 R
5 5 1 4 1 3 3 R
111
6 6 1 4 3 5 3 R
7 7 1 4 1 4 4 R
8 8 1 4 4 3 4 R
9 9 1 4 5 1 4 R
10 10 1 5 6 5 4 R
11 11 2 6 6 3 1 R
12 12 2 6 1 4 2 R
13 13 2 6 4 1 3 R
14 14 2 6 6 5 3 R
15 15 2 7 4 2 4 R
16 16 3 8 5 3 1 R
17 17 3 9 1 2 3 R
18 18 4 10 3 1 1 R
19 19 4 10 2 5 2 R
20 20 4 10 3 6 3 R
21 21 4 10 6 4 3 A
22 22 4 10 2 3 4 R
23 23 5 11 6 1 1 R
24 24 5 11 4 5 2 R
25 25 5 11 5 4 2 R
26 26 5 11 3 1 3 R
27 27 5 11 2 4 4 R
28 28 6 12 4 2 1 R
29 29 6 12 = VT 5 6 4 A
30 22 4 11 2 3 4 R
31 23 5 12 = VT 6 1 1 R
32 4 1 4 6 4 2 A
33 5 1 4 1 3 3 R
34 6 1 4 3 5 3 R
35 7 1 4 1 4 4 R
36 8 1 4 4 3 4 R
37 9 1 4 5 1 4 R
112
38 10 1 5 6 5 4 R
39 11 2 6 6 3 1 R
40 12 2 6 1 4 2 R
41 13 2 6 4 1 3 A
42 14 2 6 6 5 3 R
43 15 2 6 4 2 4 R
44 16 3 7 5 3 1 R
45 17 3 7 1 2 3 R
46 18 4 8 3 1 1 R
47 19 4 8 2 5 2 R
48 20 4 8 3 6 3 R
49 21 4 8 6 4 3 R
50 22 4 8 2 3 4 R
51 23 5 9 6 1 1 R
52 24 5 9 4 5 2 R
53 25 5 9 5 4 2 R
54 26 5 9 3 1 3 R
55 27 5 9 2 4 4 R
56 28 6 10 4 2 1 R
57 29 6 10 = VT 5 6 4 A
58 14 2 6 6 5 3 R
59 15 2 7 4 2 4 R
60 16 3 8 5 3 1 R
61 17 3 9 1 2 3 R
62 18 4 10 = VT 3 1 1 R
63 5 1 4 1 3 3 R
64 6 1 4 3 5 3 R
65 7 1 4 1 4 4 R
66 8 1 4 4 3 4 A
67 9 1 4 5 1 4 R
68 10 1 5 6 5 4 R
69 11 2 6 6 3 1 R
113
70 12 2 6 1 4 2 R
71 13 2 6 4 1 3 R
72 14 2 6 6 5 3 R
73 15 2 7 4 2 4 R
74 16 3 8 5 3 1 R
75 17 3 9 1 2 3 R
76 18 4 10 = VT 3 1 1 R
77 9 1 5 5 1 4 R
78 10 1 6 6 5 4 R
79 11 2 7 6 3 1 R
80 12 2 7 1 4 2 R
81 13 2 7 4 1 3 A
82 14 2 7 6 5 3 R
83 15 2 8 4 2 4 R
84 16 3 9 5 3 1 R
85 17 3 10 = VT 1 2 3 R
86 14 2 8 6 5 3 R
87 15 2 9 4 2 4 A
88 16 3 9 5 3 1 R
89 17 3 10 = VT 1 2 3 R
90 16 3 11 > VT 5 3 1 R
91 2 1 4 5 1 1 A
92 3 1 4 4 1 2 R
93 4 1 4 6 4 2 A
94 5 1 4 1 3 3 R
95 6 1 4 3 5 3 R
96 7 1 4 1 4 4 R
97 8 1 4 4 3 4 R
98 9 1 4 5 1 4 R
99 10 1 5 6 5 4 R
100 11 2 6 6 3 1 R
101 12 2 6 1 4 2 R
114
102 13 2 6 4 1 3 R
103 14 2 6 6 5 3 R
104 15 2 7 4 2 4 R
105 16 3 8 5 3 1 R
106 17 3 9 1 2 3 R
107 18 4 10 = VT 3 1 1 R
108 5 1 4 1 3 3 A
109 6 1 4 3 5 3 R
110 7 1 4 1 4 4 R
111 8 1 4 4 3 4 R
112 9 1 4 5 1 4 R
113 10 1 5 6 5 4 A
114 11 2 5 6 3 1 R
115 12 2 5 1 4 2 R
116 13 2 5 4 1 3 R
117 14 2 5 6 5 3 R
118 15 2 5 4 2 4 R
119 16 3 6 5 3 1 R
120 17 3 6 1 2 3 R
121 18 4 7 3 1 1 R
122 19 4 7 2 5 2 R
123 20 4 7 3 6 3 R
124 21 4 7 6 4 3 R
125 22 4 7 2 3 4 R
126 23 5 8 6 1 1 R
127 24 5 8 4 5 2 R
128 25 5 8 5 4 2 R
129 26 5 8 3 1 3 R
130 27 5 8 2 4 4 R
131 28 6 9 4 2 1 R
132 29 6 9 5 6 4 R
133 30 6 9 6 2 4 R
115
134 31 7 10 = VT 1 3 1 R
135 11 2 6 6 3 1 R
136 12 2 6 1 4 2 R
137 13 2 6 4 1 3 R
138 14 2 6 6 5 3 R
139 15 2 7 4 2 4 R
140 16 3 8 5 3 1 R
141 17 3 9 1 2 3 R
142 18 4 10 = VT 3 1 1 R
143 6 1 4 3 5 3 A
144 7 1 4 1 4 4 R
145 8 1 4 4 3 4 A
146 9 1 4 5 1 4 R
147 10 1 4 6 5 4 R
148 11 2 5 6 3 1 R
149 12 2 5 = VT 1 4 2 A
150 9 1 4 5 1 4 R
151 10 1 5 = VT 6 5 4 R
152 7 1 4 1 4 4 A
153 8 1 4 4 3 4 R
154 9 1 4 5 1 4 R
155 10 1 5 = VT 6 5 4 R
156 8 1 4 4 3 4 A
157 9 1 4 5 1 4 R
158 10 1 5 = VT 6 5 4 R
159 9 1 5 = VT 5 1 4 R
160 3 1 4 4 1 2 A
161 4 1 4 6 4 2 R
162 5 1 4 1 3 3 A
163 6 1 4 3 5 3 R
164 7 1 4 1 4 4 R
165 8 1 4 4 3 4 R
116
166 9 1 4 5 1 4 R
167 10 1 5 = VT 6 5 4 R
168 6 1 4 3 5 3 A
169 7 1 4 1 4 4 R
170 8 1 4 4 3 4 R
171 9 1 4 5 1 4 R
172 10 1 5 = VT 6 5 4 R
173 7 1 4 1 4 4 R
174 8 1 5 = VT 4 3 4 R
175 4 1 4 6 4 2 A
176 5 1 4 1 3 3 A
177 6 1 4 3 5 3 R
178 7 1 4 1 4 4 R
179 8 1 4 4 3 4 R
180 9 1 4 5 1 4 R
181 10 1 5 = VT 6 5 4 R
182 6 1 4 3 5 3 A
183 7 1 4 1 4 4 R
184 8 1 4 4 3 4 A
185 9 1 4 5 1 4 R
186 10 1 4 6 5 4 R
187 11 2 5 = VT 6 3 1 R
188 9 1 4 5 1 4 R
189 10 1 5 = VT 6 5 4 R
190 7 1 4 1 4 4 A
191 8 1 4 4 3 4 R
192 9 1 4 5 1 4 R
193 10 1 5 = VT 6 5 4 R
194 8 1 4 4 3 4 A
195 9 1 4 5 1 4 R
196 10 1 5 =VT 6 5 4 R
197 9 1 5 = VT 5 1 4 R
117
198 5 1 4 1 3 3 A
199 6 1 4 3 5 3 R
200 7 1 4 1 4 4 R
201 8 1 4 4 3 4 R
202 9 1 5 = VT 5 1 4 R
203 6 1 4 3 5 3 A
204 7 1 4 1 4 4 A
205 8 1 4 4 3 4 R
206 9 1 4 5 1 4 R
207 10 1 5 = VT 6 5 4 R
208 8 1 4 4 3 4 A
209 9 1 4 5 1 4 R
210 10 1 5 = VT 6 5 4 R
211 9 1 5 = VT 5 1 4 R
212 7 1 4 1 4 4 A
213 8 1 4 4 3 4 R
214 9 1 5 = VT 5 1 4 R
215 8 1 5 = VT 4 3 4 R
At the end of the search the current value of VT is 5 and it is the
value of the optimal feasible word L4 = (2, 6, 8, 12). It is given in the
149th row of the search table. The array IR, IC, IT, SW takes the values
represented in the Table-5.5 given below. The Pattern represented by
the above optimal feasible word is represented in the following table-
5.6
Table – 5.5
1 2 3 4 5 6
IR 1 -- 1 1 1 --
IC 1 -- 1 1 1 --
IT 1 1 1 1 -- --
SW 4 -- 5 3 1 --
118
Table – 5.6
𝑋 𝑖, 𝑗, 1 =
0 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 01 0 0 0 0 00 0 0 0 0 0
𝑋 𝑖, 𝑗, 2 =
0 0 0 1 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 0
𝑋 𝑖, 𝑗, 3 =
0 0 0 0 0 00 0 0 0 0 00 0 0 0 1 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0 0
𝑋 𝑖, 𝑗, 4 =
0 0 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 1 0 0 00 0 0 0 0 00 0 0 0 0 0
From the table -5.6, the representation of the solution X to the
problem is that the salesman visits city 1 from city 5 at time 1,
salesman visits city 5 from city 3 at time 3, salesman visits city 3 from
city 4 at time 4 and visits city 4 from city 1 at time 2. This solution is
a feasible solution.
5.6. Computational Experience:
A Computer program for the above algorithm is written in C
language and is tested on the system COMPAQ. Random numbers are
used to construct the cost matrix. The following table- 5.7 gives the
list of the problems tried along with the average CPU time in seconds
required for solving them.
119
TABLE-5.7
5.7. Conclusion
The problems are solved by using the Lexi-Search algorithm
based on the Pattern Recognition Technique. In table-5.7, „m‟
represents that the salesmen has visited the number of cities. The
cost matrix was generated randomly in the interval [0,100]. For each
type of instance we considered six trials. Our algorithms have been
implemented in C. The computational experiments were performed on
a personal computer with AMD Sempron™ Processor LE-1200, 2.10
GHz, 896 RAM and OS Windows XP Professional. In table-5.7 we have
presented the computational results for solving the problem using the
Lexi-Search algorithm based on the Pattern Recognition Technique.
Problem
Dimensions
No. of
prob‟
s
Alpha
bet
Table
Total time taken(ET)
TYPE 1 TYPE 2 TYPE 3
n M MIN MAX AVG MIN MAX AVG MIN MAX AVG
10 5 6 .0010 .021 .040 .035 .026 .04 .003 .002 .004 .003
20 12 6 .0027 .002 .005 .0035 .004 .006 .0050 .002 .005 .0035
25 16 6 .0037 .002 .004 .003 .002 .004 .003 .002 .004 .003
30 19 6 .003 .002 .005 .0035 .004 .006 .0050 .002 .005 .0035
35 24 6 .0036 .002 .004 .003 .002 .004 .003 .002 .004 .003
40 28 6 .0038 .002 .005 .0035 .004 .006 .0050 .002 .005 .0035