Professional Documents
Culture Documents
Introduction 3
Setting 3
Where should we go ? 5
Results 6
Discussion 7
Conclusion 11
APPENDIX 13
OR class ‘15/’16 13
Routing results 16
1
Introduction
In this seminar work we are going to present a method on how to plan tours through
Prague. The chosen setting is a so called Free Tour. In our approach we first try to
consider how interesting several sights are for different visitors and choose the
interesting ones along with constraints in time. Secondly a time-optimal tour for all sights
is being chosen.
Setting
Martin is a tour guide at one of the popular Free Tours in Prague. As the tours are for
free, Martin’s income is depending on the tips his audience is willing to offer after the
tour. His idea is, that the better his audience likes what he’s telling them, the higher the
tips will be. He assumes that it’s not only depending on his abilities as a story-teller (he’s
really good), but also on his audience's preferences. Therefore he collects the
preferences and let’s a tool he programmed, calculate the best sites for this day. It also
calculates the route and therefore the time it takes to guide the people through Prague.
The Free Tour starts at the Astronomical Clock and ends there again. The Astronomical
clock is therefore a mandatory sight. Through the right choice of a starting time the
visitors can then also see the twelve apostles.
Martin creates a list of the most popular sites in Prague and categorizes them into seven
categories: art, food & beer, history, literature, music, sports and technical aspects. In
each category he evaluates the sight in this category with up to three stars. In order to
protect his voice - and therefore generate future income - he doesn’t want to talk for
more than two hours per tour. For that reason he also collects the duration of speech it
needs at every sight. Because it is a free tour, none of the sights require entrance fees.
2
time of
technical food &
No. Name history art music literature sport explantati
aspects beer
on [min]
d1 Dancing house 1 2 2 1 5
d2 Strahov stadium 1 2 2 3 15
d3 Vyšehrad Park 1 1 1 1 1 20
d4 Saint Peter and Paul Basilica 2 2 10
d5 Zizkov & Tower 3 1 2 2 2 25
d6 Prague Metronome & Letna 1 3 2 2 20
d7 Staropramen Brewery 1 2 3 15
d8 Charles Bridge 1 3 2 1 2 20
d9 Astronomical clock 3 2 1 10
d10 Jewish quarter 3 1 1 30
d11 Powder Gate 2 2 10
d12 Strahov Monastery 2 3 2 2 1 2 20
d13 Lennon Wall 1 1 3 1 1 10
d14 Troja Chateau 2 3 2 30
d15 Kafka museum 1 2 2 1 3 20
d16 Prague Castle 1 3 3 1 2 2 60
d17 Prague Botanical Garden 2 1 1 30
d18 National theatre 3 3 3 2 1 10
Monument to Victims of
d19 1 2 2 2 10
Communism
d20 National Monument in Vitkov 2 3 1 1 20
To plan the tour through Prague, Martin now has to ask his visitors, what they prefer to
see. Of course they don’t know anything about the sights in Prague, but most certainly
they know something about their personal preferences. He hands out surveys to each
visitor (later he develops a smartphone app, which does all the explained tasks
automatically) and let’s them specify their preferences. With his visitors’ preferences he
can calculate the average interest in every category. This way he can choose the most
valuable sights for his tour.
3
How much are you interested in …? food & technical
art history literature music sports
0 - not beer aspects
1 - a little
2 - responsive
3 - very much
Where should we go ?
Martin’s target is to maximize the “joy”, which is represented by the value of every sight.
The binary integer problem can be described as follows:
n 7
f unction max → ∑ ∑ dx ji vi,x
x = 1i = 1
n
∑ dx * tx ≤ 120 time constraint
x=1
n
∑ dx ≤ p constraint in number of sights (optional)
x=1
customer’s survey (table 3-5) and of the sight’s value (table 1). The starting point will be
the Astronomical clock, therefore the variable d9 = 1 will be set as an additional
constraint.
4
Choice of sights in real life applications
To show the functionality of our tool we’ve made a survey in our colleges from OR class
to see where Martin would lead our rather heterogenous class (survey results in
appendix). Further we will compare the result to an exemplary German football team
(high preferences in sport, food and beer) and an imaginary group of elderly ladies from
Denmark (preferences in literature and art).
2 0 3 2 0 0 3
0 3 0 2 3 1 0
Results
LINDO solves the tasks by Simplex algorithm to produce the optimal solution. The detail
optimal objective-function values could be found at the appendix. The table below
presents locations which are best fit to each particular group.
5
Table 6: choice of sights for every group
Discussion
The results reflect the difference between the optimal solution of our real group (OR
class) and the hypothetical groups (Germany and Denmark). It can be seen that the OR
class achieves much higher values (150.9) compared to Germany (108) and Denmark
(118). It cannot be stated whether the joy of one group is really higher than in the other
group, as the calculated value is only the result of their given preferences. A group that is
interested in many aspects automatically has higher values.
A look to the chosen sights shows that there are some preferred ones for any group,
especially when the relation between value of the sight and time to explain is relatively
high. On the other hand, the results are also different between the groups; at least the
football team would visit other sights. However, it is doubtful whether the results really
represent the preferences of the group. For instance, it is to be expected that every
group will visit Charles Bridge, which is not the case here. Further, the football team
could most certainly like to see the Brewery (and hear all the stories about it), but they
don’t. Therefore the table of values has to be adjusted by the time to deliver optimal
results. Further, maybe more sights have to become mandatory.
6
Routing with Travelling Salesman Problem (TSP)
After the sights are chosen, Martin is looking for the perfect route. He wants to minimize
the walking time to comfort the visitors. He chooses the Travelling Salesman Problem as
a suitable programming, because every sight should only be visited once and he wants to
bring his visitors back to the starting point. The imaginary graph to that problem is
undirected. [https://users-cs.au.dk/bromille/dOpt/Lec11.ppt - TSP explanation]
As mentioned in the beginning, the tour starts and ends at the obligatory Astronomical
Clock in Prague 1.
n
∑ xij = 1 arrive at every sight from only one sight
i=0, i=j
/
n
∑ xij = 1 leave every sight only to one another
j=0, j=i
/
7
Table 7: time to travel from sight i to sight j in minutes
The cij -table, where i are the rows and j the columns. Each value represents the time
that Google maps suggested for pedestrians to walk from sight i to j (in minutes).
To solve our problem we use the tool “TSP Solver and Generator” (http://tspsg.info/). It
computes the routing via Branch-and-Bound method. Side note: to see all 20 sights at
one day it takes 402 minutes - almost seven hours (optimal solution).
Following, we display the tour planning with the estimated time of walking, which we
compare to a recalculation of the final tour in Google maps again. There are differences
8
between our assumption and Google’s results to roughly 20 minutes, which could either
be explained by wrong setups in the cij -table or different routing-time assumptions by
Google, when a full route is calculated. Extracts of the branch-and-bound method can be
found in the appendix.
astronomical clock - charles bridge - kafka museum - lennon wall - dancing House -
national theatre - monument of victims - strahov stadium - strahov monastery -
astronomical clock
astronomical clock - saint peter and paul basilica - dancing house - national theatre -
monument of victims - strahov stadium - strahov monastery - lennon wall - zizkov &
tower - astronomical clock
9
Conclusion
As a conclusion we can state that our methodology is functional and that we obtained
explainable results. The results are debatable. The rating of the guide and the group
happens from a subjective perspective, therefore the result from the maximization
function is not comparable to any other group. So far it is unclear whether a linear rating
from 0 to 3 stars is sufficient. Secondly, after sights are chosen, the walking time is
calculated independently from the choice of sights and vice versa. Therefore sights, which
are totally out of reach, are chosen and result in long walking distances which also
require a lot of time. It can be assumed that the joy, we wanted to increase in the first
step, will get trapped while walking from one sight to another. Further the routing only
considers the shortest path from one sight to another, but does not consider whether
some routes are overcrowded. As our approach used Google maps, it is difficult to
implement such constraints. Lastly, sights that are absolutely important for Prague are
not being reached, because a mathematical program won’t decide for it. Another
conclusion therefore is, that some sights in tour guiding must be mandatory.
In the end Martin develops a new model that he uses to find his route. Still, the visitors
choose their preferences but time is now limited by explanation time & walking
10
preferences. To solve the problem we define a problem where a sub-problem is being
solved within. Via a branch-and-bound-method every possibility can be checked and
therefore the optimum can be found. Thus, the calculation becomes quite complex and
probably time-intensive.
n 7
f unction max → ∑ ∑ dx ji vi,x
x = 1i = 1
n
∑ dx ≤ p constraint in number of sights
x=1
m m
TSP-problem min Ѝ ∑ ∑ cgh * xgh
g=0 h=g,
/ h=0
n
m = ∑ dx
x=1
T = resulted time
n
∑ dx * tx + T ≤ 240 time constraint, e.g. 4 hours
x=1
11
APPENDIX
OR class ‘15/’16
INPUT
MAX 11.22 D1 + 15.88 D2 + 10.44 D3 + 8 D4 + 17.22 D5 + 15.66 D6 + 12.1 D7 + 18.56 D8 + 9.22 D9 + 11 D10 + 6.44 D11 + 23.66 D12
+ 13.34 D13 + 14.9 D14 + 18.9 D15 + 24.78 D16 + 7.78 D17 + 26 D18 + 14.12 D19 + 14.34 D20
SUBJECT TO
3) D1 + D2 + D3 + D4 + D5 + D6 + D7 + D8 + D9 + D10 + D11 + D12 + D13 + D14 + D15 + D16 + D17 + D18 + D19 + D20 <= 10
4) D9 = 1
END
INTE 20
SOLUTION
1) 150.9000
D1 1.000000 -11.220000
D2 1.000000 -15.880000
D8 1.000000 -18.559999
12
D9 1.000000 -9.220000
NO. ITERATIONS= 9
INPUT
SUBJECT TO
3) D1 + D2 + D3 + D4 + D5 + D6 + D7 + D8 + D9 + D10 + D11 + D12 + D13 + D14 + D15 + D16 + D17 + D18 + D19 + D20 <= 10 (LOCATION)
4) D9 = 1 (STARTING SIGHT)
END
SOLUTION
1) 108.0000
D1 1.000000 -10.000000
D2 1.000000 -15.000000
D4 1.000000 -6.000000
D5 1.000000 -18.000000
D9 1.000000 -9.000000
13
D18 1.000000 -15.000000
NO. ITERATIONS= 8
SUBJECT TO
3) D1 + D2 + D3 + D4 + D5 + D6 + D7 + D8 + D9 + D10 + D11 + D12 + D13 + D14 + D15 + D16 + D17 + D18 + D19 + D20 <= 10 (LOCATION)
4) D9 = 1 (STARTING SIGHT)
END
SOLUTION
1) 118.0000
D1 1.000000 -8.000000
D2 1.000000 -10.000000
D8 1.000000 -17.000000
D9 1.000000 -6.000000
NO. ITERATIONS= 10
14
Routing results
Preamble: The output warns that our solutions may not be optimal. As the program is
still in beta state, but with open source code, we’ve checked the source code. The
problem is that the function solver.isOptimal has not been programmed yet and always
claims to not be optimal. Although all branches have been checked, their optimality will
not be confirmed “by design”. The results are reasonable and most certainly optimal.
Task:
--- 42 18 21 41 22 24 7 17
42 --- 41 51 41 36 40 40 31
18 41 --- 9 22 5 4 10 12
21 51 9 --- 32 15 14 12 21
41 41 22 32 --- 25 28 37 29
22 36 5 15 25 --- 5 14 11
24 40 4 14 28 5 --- 16 13
7 40 10 12 37 14 16 --- 9
17 31 12 21 29 11 13 9 ---
Variant #1 Solution
Step #1
Selected route with (1;8) part.
Step #2
Selected route with (2;5) part.
Step #3
Selected route with (4;3) part.
1 alternate candidate for branching: (9;1).
Step #4
Selected route with (9;2) part.
Step #5
Selected route with (7;6) part.
Step #6
Selected route with (3;7) part.
Step #7
Selected route with (6;1) part.
15
Step #8
Selected route with (5;4) part.
1 alternate candidate for branching: (8;9).
Resulting path:
City 1 -> City 8 -> City 9 -> City 2 -> City 5 -> City 4 -> City 3 -> City 7 -> City 6 -> City 1
The price is 160 units.
WARNING!!!
This result is a record, but it may not be optimal.
Iterations need to be continued to check whether this result is optimal or get an optimal one.
Variant #1 Solution
Step #1
Selected route with (5;4) part.
Step #2
Selected route with (3;1) part.
Step #3
Selected route with (1;8) part.
Step #4
Selected route with (4;3) part.
Step #5
Selected route with (2;6) part.
2 alternate candidates for branching: (6;2), (9;7).
Step #6
Selected route with (6;7) part.
16
1 alternate candidate for branching: (9;7).
Step #7
Selected route with (9;2) part.
Step #8
Selected route with (7;5) part.
1 alternate candidate for branching: (8;9).
Resulting path:
City 1 -> City 8 -> City 9 -> City 2 -> City 6 -> City 7 -> City 5 -> City 4 -> City 3 -> City 1
The price is 242 units.
WARNING!!!
This result is a record, but it may not be optimal.
Iterations need to be continued to check whether this result is optimal or get an optimal one.
17