Applying Simulated Annealing and Tabu Search to the Intermittent

Transcription

Applying Simulated Annealing and Tabu Search to the Intermittent
Applying Simulated Annealing and Tabu Search to the
Intermittent Travelling Salesman Problem
Frederic Huysentruyt
KU Leuven afdeling Kortrijk
Patrick De Causmaecker
April 27, 2015
Abstract
visited nodes in a solution are both equal to the
depot node. [1]
Considering TSP instances are a subset of
ITSP instances, they can be used to check the
quality of the solutions given by the implemented
algorithms. TSP instances with known optima
are used to check the quality of the implemented
algorithms.
This paper also describes an ITSP instance
generator. Instances obtained from this ITSP
generator are used to compare simulated annealing with Tabu Search.
In this paper the Intermittent Travelling Salesman Problem (ITSP) is studied. ITSP is a variant of the Travelling Salesman Problem with an
added temporal aspect. A problem instance generator for ITSP is described and two optimization algorithms: simulated annealing(SA) and
tabu search are applied to ITSP. These two algorithms are compared with each other on a range
of ITSP instance sizes.
1
Introduction
2
The Intermittent Travelling Salesman Problem
(ITSP) can be described by a graph G(V, E) in
which each node n ∈ V has a number of visits
visits(n) and a cool-down time cooldown(n).
visits(n) stands for the number of times node
n has to be visited while cooldown(n) is the minimum amount of time between visits to n. Associated with each edge (n1 , n2 ) ∈ E is a symmetric travelling time traveltime(n1 , n2 ) which
stands for the time it takes to get from n1 to n2
or from n2 to n1 . There also exists a depot node
n0 for which visits(n0 ) = 2. The first and last
ITSP Model
The model that will be used in this paper is
based on a slightly simplified version of ITSP
and on the model described in [1]. In this simplified version, there is only one cool-down time:
cooldown. ∀n ∈ V : cooldown(n) = cooldown
A node ni with visits(ni ) > 1, is expanded
visits(ni )
into nodes n1i , n2i , ..., ni
. The set of all ex0
panded nodes is V .
The model used in this paper is described in
Figure 1.
A description of the rules of this model is given
1
min s(n20 )
(1)
s.t.
X
j∈V
∀i ∈ V 0
(2)
x(i, j) = 1
∀j ∈ V 0
(3)
0
X
i∈V
x(i, j) = 1
0
s(n10 ) = 0
(4)
x(n20 , n10 ) = 1
M ∗ (1 − x(i, j)) + s(j) ≥ s(i) + c(i, j) ∀i ∈ V
s(nji )
−
s(nki )
≥ bound
(5)
0, j
0
∈ V \ {i}
∀j > k
(6)
(7)
Figure 1: ITSP (Mixed Integer Linear Programming) model
s(nji ) with ni ∈ V , stands for the time at which
ni is visited for the j th time.
(1) The goal is to minimize the time at which the
n0 is the depot node and has to be the first
depot node is visited for the second time. and last visited node.
(which is equal to the time it takes to trax(i, j) = 1 ⇐⇒ i and j are connected
verse the solution)
below.
(2) There is only one edge leaving any node i ∈
V0
3
ITSP instance generator
Because ITSP isn’t that well-known, there aren’t
(3) There is only one edge entering any node many existing problem instances which we can
j ∈V0
use to compare algorithms on. This brings need
for an instance generator. The instance genera(4) The first visited node is the depot node.
tor used in this paper generates ITSP instances
(5) There is an edge from n20 to n10 to complete from TSPLIB instances. The positions of the
the tour (this also forces the depot node to nodes in the TSPLIB instances are used to generate the ITSP instances. [3]
be the last visited node).
(6) If there is an edge from node i to node j then 3.1 Generating
instances
from
the visit time s(j) has to be at least s(i) plus
TSPLIB instances
the travel time c(i, j). (M is a large number)
When generating instances from TSPLIB in(7) Visits to the same node need to be at least stances, the first node is used as the depot node
bound time apart.
n0 and has visits(n0 ) = 2.
2
4.3
To ensure that the total number of visits is
equal to T otalN rV isits, every other node nj
will at first have visits(nj ) = M inV isits. After
which a node ni ∈ V \ {n0 } with visits(ni ) <
M axV isits is chosen. The number of visits
visits(ni ) is increased by 1 and this process of
increasing the visits of a randomly chosen node
is repeated until the sum of the number of visits
is equal to T otalN rN odes.
The bound is generated by generating a uniformly random number in
[bound − boundDelta, bound + boundDelta].
Exact ITSP solver
Knowing the global optimum for ITSP instances
is very useful in judging the quality of nonoptimal solutions. For this purpose we chose to
create an exact solver using SCIP [7]. SCIP is a
framework for Constraint Integer Programming
but can simply be used as a mixed integer linear programming (MILP) solver. To let SCIP
run on ITSP instances, the instances first have
to be described in a format which SCIP understands. For this, the ZIMPL [6] format is used
which is created by the same people who created
SCIP. This ZIMPL format is used to describe the
mathematical model of the ITSP instance.
4 Description of algorithms
Although this solver can find the optimal solution,
it can only practically be used on smaller
4.1 Simulated annealing
ITSP instances. This is due to the exponential
The simulated annealing algorithm used in this growth in possible solutions as the number of
paper, is based on SA applied to TSP described nodes is increased.
in [4]. The cooling strategy is the commonly
used exponential cooling scheme.
5
temperaturen+1 = temperaturen ∗ α
(8)
With α = 0.8
4.2
Comparing simulated annealing with Tabu Search on TSP
The algorithms used in this comparison are Tabu
Search and simulated annealing as described
above. The exact MILP solver for ITSP is used
as well. Due to the rapid increase of solutions as
the number of nodes increases, this exact solver
is only fit for ITSP instances with a small number of nodes (< 12). Even though this limitation
exists, it can still be used to check the quality of
the solutions produced by simulated annealing
and Tabu Search on ITSP instances with fewer
nodes.
Because TSP instances can be considered
ITSP instances with {bound = 0, M axV isits =
1}, they can be used to check the quality of solutions found by SA and Tabu. The TSP instances
Tabu Search
The Tabu Search algorithm used, is based on an
application of Tabu Search on TSP [5].
The initial tour is a randomly generated tour
and neighboring solutions are found by applying
2-edge exchanges. When a candidate solution is
chosen (by being the best tabu admissable candidate), the tabu list is updated with the edges
that were deleted when making the 2-edge exchange which lead to this solution.
A 2-edge exchange is considered tabu when the
added edges are on the tabu list.
3
6.1
that will be used are from TSPLIB [3] (the shortest tour for these TSP instances is known).
An experiment is run in which simulated annealing is compared with Tabu Search on TSP
instances. In this experiment the stop criterium
for both algorithms is to have found a tour with
a cost lower than 1.05 ∗ (the known optimum).
The average of 100 runs is taken. During each
run, every time a better tour is found, the current iteration, runtime and cost of the tour is
noted. This lead to α = 0.8 for SA and a tabu
list length of 100 for Tabu Search. Some of the
results of this experiment can be found in Figure 2.
5.1
Conclusion
The results are very similar to those found in
the experiment on TSP instances. Remarkable
is that once again there is a significant difference in convergence speed between SA and Tabu
Search when the problem size is small such as in
Figure 3a.
For larger problem sizes, it is simulated annealing who converges the fastest. On top of
converging faster it’s also able to find a better
global optimum.
Eventhough in Figure 3a, Tabu Search converges faster than SA, it is SA who is able to
find better solutions in the end.
Conclusion
Simulated annealing converges faster than Tabu References
Search for TSP instances with a larger amount
of nodes such as those in Figure 2b, Figure 2c [1] P. De Causmaecker, S. Pham, and N. Thi
Thanh Dang, “The intermittent traveling
and Figure 2d.
sales person problem.” 2014.
For smaller instances (such bays29 in Figure 2a), it is Tabu Search who converges faster.
[2] P. De Causmaecker, “Intermittent tsp,”
This same dramatic difference in convergence
2014.
speed was found on other TSPLIB instances with
less than 22 nodes.
[3] G. Reinelt, “Tsplib.” http://www.iwr.
uni-heidelberg.de/groups/comopt/
software/TSPLIB95/.
6 Comparing simulated anneal-
ing with Tabu Search on
ITSP
[4] M. Malek, M. Guruswamy, M. Pandya, and
H. Owens, “Serial and parallel simulated annealing and tabu search algorithms for the
In this comparison we chose to generate ITSP
traveling salesman problem,” Annals of Opinstances from TSPLIB instances. To cover a
erations Research, vol. 21, no. 1, pp. 59–84,
wide range of problem sizes, problem sizes of 30,
1989.
50, 70 and 90 are chosen. The cool down for each
ITSP instance is equal to the average distance [5] J. Knox, “Tabu search performance on
the symmetric traveling salesman problem,”
between the nodes. The minimum number of
Comput. Oper. Res., vol. 21, pp. 867–876,
visits is set to 1 and the maximum number of
Oct. 1994.
visits to 3. The results can be found in Figure 3.
4
SA vs Tabu: TSP 22 nodes (ulysses22.tsp)
SA vs Tabu: TSP 52 nodes (berlin52.tsp)
Tour cost
20000
25000
tabu search
simulated annealing
80
10000
15000
120
100
Tour cost
140
160
tabu search
simulated annealing
0
10000
20000
30000
40000
0
5000
Iteration
(a) ulysses22
15000
(b) berlin52
SA vs Tabu: TSP 96 nodes (gr96.tsp)
tabu search
simulated annealing
500
500
1000
1500
Tour cost
2000
tabu search
simulated annealing
1000 1500 2000 2500 3000
SA vs Tabu: TSP 76 nodes (eil76.tsp)
Tour cost
10000
Iteration
0
10000
20000
30000
40000
50000
0
10000
20000
Iteration
Iteration
(c) eil76
(d) gr96
30000
40000
Figure 2: plots of convergence of simulated annealing and tabu search on TSPLIB instances
5
SA vs Tabu: ITSP 30 nodes (burma14.tsp)
SA vs Tabu: ITSP 50 nodes (bayg29.tsp)
40000
30000
Tour cost
25000
160
140
80
15000
100
20000
120
Tour cost
tabu search
simulated annealing
35000
180
200
tabu search
simulated annealing
0e+00
2e+04
4e+04
6e+04
8e+04
1e+05
0
2000
4000
Iteration
6000
8000
10000
12000
Iteration
(a) burma14 with 30 visits
(b) bayg29 with 50 visits
SA vs Tabu: ITSP 70 nodes (att48.tsp)
SA vs Tabu: ITSP 90 nodes (att48.tsp)
tabu search
simulated annealing
Tour cost
150000
50000
50000
100000
100000
Tour cost
150000
200000
250000
200000
tabu search
simulated annealing
0
10000
20000
30000
40000
0
10000
Iteration
30000
40000
50000
(c) att47 with 70 visits
(d) att48 with 90 visits
SA vs Tabu: ITSP 70 nodes (eil51.tsp)
SA vs Tabu: ITSP 90 nodes (eil51.tsp)
tabu search
simulated annealing
tabu search
simulated annealing
2000
2500
2000
60000
Iteration
1000
1000
1500
Tour cost
1500
Tour cost
20000
6
0
10000
20000
30000
40000
Iteration
(e) eil51 with 70 visits
50000
0e+00
2e+04
4e+04
6e+04
8e+04
1e+05
Iteration
(f) eil51 with 90 visits
Figure 3: plots of convergence of simulated annealing and tabu search on TSPLIB instances
[6] T. Koch, Rapid Mathematical Prototyping.
PhD thesis, Technische Universit¨
at Berlin,
2004.
[7] T. Achterberg, “Scip: Solving constraint
integer programs,” Mathematical Programming Computation, vol. 1, no. 1, pp. 1–41,
2009. http://mpc.zib.de/index.php/MPC/
article/view/4.
7