**1. Introduction**

The planning of touristic itineraries is a typical decision making process for tourists visiting a city in a limited time period. The selection of the most valuable Points of Interests (PoIs) is not simple.

In the last years mobile applications are offering a variety of services from vacation planning to mobile tourist guides and tourism recommender systems [1,2]. The design of flexible, efficient, and user-friendly applications for mobile devices has a grea<sup>t</sup> interest from both a commercial and a research point of view. The authors in [3] propose a mobile application based on a hybrid multiobjective genetic algorithm to smartly generate feasible itineraries. The algorithm incorporates an advanced heuristic to build a route, with a start and an arrival time passing from a set of locations each characterized by a score measuring its attractiveness, an opening and a closing time, and visit duration. Vansteenwegen et al. [4,5] present an advanced mobile tourist guide, capable of suggesting a near-optimal and feasible selection of attractions and a route passing among them. The related optimization problem is solved by using a combination of guided local search metaheuristics. Booth et al. [6] develop a data model for trip planning in multimodal transportation systems and Navabpour [7] plans a trip with multimodal transportation based on Service Oriented Architecture (SOA). In addition, Andre et al. [8] design a journey planning system based on safety, weather and specific travel time for individual user. Gonzalez et al. [9] propose a fastest-path computation system on a road network using a traffic mining approach. However, while the above papers mainly focus on the mobile application architecture, the following two subsections analyze existing contributions focusing on methodology and parameters.

**Citation:** Mangini, A.M.; Roccotelli, M.; Rinaldi, A. A Novel Application Based on a Heuristic Approach for Planning Itineraries of One-Day Tourist. *Appl. Sci.* **2021**, *11*, 8989. https://doi.org/10.3390/app11198989

Academic Editor: Paola Pellegrini

Received: 9 August 2021 Accepted: 17 September 2021 Published: 27 September 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

#### *1.1. Related Works: Methodology-Based Classification*

This section groups and analyses research works that provide rigorous description of heuristic and metaheuristic approaches to solve the Tourist Trip Design Problem (TTDP). These approaches result the only viable methods to efficiently optimize the travel itinerary, by analyzing the problem from different perspectives, with different problem variables and constraints. The objective in TTDP modeling is to identify a set of near-optimal itineraries to maximize tourist satisfaction. The baseline combinatorial optimization problem for TTDP is the orienteering problem (OP). The OP can be used to model the TTDP where the PoIs are associated with a profit and the goal is to find a single tour that maximizes the profit collected within a given time budget. In the OP, given a starting node *s*, a terminal node *t* and a positive time limit (budget), the goal is to find a path from *s* to *t* such that the total profit of the visited nodes is maximized. In the related literature, Garcia et al. [10] propose an intelligent routing system that defines an optimization problem including multiple paths to move from one location to another. Such a system, by exploiting an iterated local search metaheuristic method, suggests a personalized tour combining information about the local attractions, weather forecasting and public transportation. Gavalas analyzes the models, algorithmic approaches and methodologies about tourist trip design problems [11]. Recent approaches are reported aiming at taking into account a multitude of realistic PoIs attributes and user constraints. In this context, Gunawan et al. focus on the most recent works about the Orienteering Problem (OP) and its variants [12]. The authors focus on a comprehensive and thorough survey of recent variants of the OP, including the proposed solution approaches. The work reports the new variants of the OP, such as the Stochastic OP, the Generalized OP, the Arc OP, the Multi-agent OP, the Clustered OP and others. The authors summarize several interesting applications which are related to the mobile crowdsourcing problem, the Tourist Trip Design Problem, the theme park navigation problem and others. The authors in [13] provide a detailed explanation about operation on tour routes only qualitatively. An optimizer is proposed in [14], where a multiobjective evolutionary algorithm is used to identify the near-optimal solutions to the planning of multiple-day routes in a reasonable computational time. In the contribution [15], the authors present a heuristic procedure for the generalization of a optimization problem to plan personalized recommendations for daily sightseeing itineraries for mobile tourist guides.

Extensions of the OP have been applied to model more complex versions of TTDP: the OP with time windows (OPTW) considers visits to locations within a predefined time window; this allows modeling opening days/hours of PoIs. The time-dependent OP (TDOP) considers time dependency in the estimation of time required to move from one location to another; therefore, it is suitable for modeling multimodal transports among PoIs. In particular, Cotfas considers a more complex variant of the tourist trip design problem i.e., the time-dependent in the estimation of the time required to move from one location to another for planning daily tours according to tourist's preferences [16].

The team orienteering problem (TOP) is the extension of the OP to multiple tours. The TOP with time windows (TOPTW) has been mostly commonly studied among the aforementioned OP variants since it is useful for modeling several real-life optimization problems. Vansteenwegen et al. propose a metaheuristic algorithm to tackle a more effective extension of the optimization problem [17]. The proposed algorithm performs a planning of a multipleday tour by considering a set of PoIs, a visiting duration, and a set of multiple opening and closing times per day combined with the trip constraints of the tourist.

Other studies propose approaches based on Graph Theory [18–21], applied in tourism. The authors in [19] deal with typical tourist attractions in urban destinations, as pedestrian zones, market areas or urban areas of architectural, cultural and scenic value rather than only visiting sites of restricted access or taking the fastest route to move among city landmarks. Herein, the authors introduce Scenic Athens, a context- aware mobile city guide for Athens (Greece) which provides personalized tour planning services to tourists. Scenic Athens derives near-optimal sequencing of PoIs along recommended tours, taking into account a multitude of travel restrictions and PoI properties, so as to best utilize time available for sightseeing. The authors in [20] define tourist routes by means of graph theory. The authors also calculate some relative indexes (e.g., the circle number, circle ratio, line-point ratio etc.) to make quantitative evaluation of tourist routes. Chen et al. apply the Graph theory to optimize tour path and tour flows to provide practical solutions to tourist guides [21].

#### *1.2. Related Works: Parameter-Based Classification*

Another classification that can be proposed is based on the works that emphasizes the study of the effect of key parameters of the TTDP on the final solution, such as: (i) the selection of transport modes to reach the different PoIs; (ii) the choice of PoIs; (iii) the number of tours to be generated, on the basis of visiting duration; (iv) the visit duration of a PoI; (v) the travel times among PoIs; (vi) the daily time budget that a tourist wishes to spend on visiting a PoI; (vii) the weather conditions.

Transport is a critical and dynamic process of tourism, which facilitates physical movement to points of interest [22–24]. Transportation affects the accessibility to the tourist destination, the distance travelled, and the comfort of the trip [25,26]. The authors in [27] develop a genetic algorithm (GA) to solve the TTDP that included multimodal transport and real traffic parameters and time constraints.

In [14] the influencing factors of the tour route choices of tourists are analyzed by means of a questionnaire survey. Moreover, tour routes multiobjective optimization functions are prompted for the tour route design with the aim of maximise the user satisfaction with the minimum tour distance. The authors in [17] analyze the planning of a multipleday tour by considering a set of PoIs, a visiting duration, and a set of multiple opening and closing times per day combined with the trip constraints of the tourist. The authors in [28] apply an evolutionary algorithm to solve the tour planning problem in time-dependent urban areas. Gavalas et al. [29] develop a tool for tourist itineraries that considered the departure time and the mode of transport on the tourist route. Wu et al. [30] develop a mathematical model to consider the selection of transport modes, the travel budget, and the maximum travel times. Zheng et al. [31] design a multi-objective model of one-day urban tourist routes, taking into account the transport modes and the complexity of urban tourism transport systems, as congestion, and the transport needs of tourists. Zhang et al. [32] develop a model for the construction of itineraries in scenic routes considering the modes of transport. The authors in [33] analyze the environmental implications of tourist itineraries by creating groups of tourists that use a single mode of transportation (i.e., taxis). Some works study the use of electric vehicles (EV) for the generation of more environmentally friendly tourist itineraries, such as [34–36].

Other works focus on planning trips for tourist group [33,37], that consider the individual preferences of each tourist. The authors in [38] develop a model for the route design problem for various cycle-tourists. The model consider the preferences of each tourist who incorporates different benefits on the same route. Finally, the authors in [33] develop a route planning model that considers multiple days, urban tourism, PoI categories, and heterogeneous preferences for a group of tourists that maximise profit and minimises travel time, distance, and cost.

#### *1.3. Contribution of the Paper*

From the analysis of the above reported studies, the OP is not suitable in case the PoIs need to be selected and exchanged among different itineraries, like outward and return paths of a one day trip, because of time constraint. In this case, it is necessary to implement a multi-level algorithm to be able to consult the tourist on any relocation of PoIs in the tour. To these aims, we applied the Travel Salesman Problem (TSP) [39–41] method that involves finding the shortest route through n nodes that begins and ends at the same city and visits

every node. The TSP is among the best-known combinatorial optimization problems and has been intensely studied by researchers in various research fields.

In this paper, we aim to determine the optimal itinerary for the one-day tourist, maximizing the number of PoIs to be visited in the outward and return parth, and at the same time minimizing the travel times taking into account the tourist preferences and hard time constraints. The idea is to allow the tourist to select the preferred PoIs to be visited on the first part of the day, i.e., in the outward trip, and on the second part of the day, i.e., in the return trip, respectively. We formulate our optimization problem on the basis of Graph theory, TSP and multi-level algorithms. We model the city PoIs network on the basis of the graph theory, where the nodes represent the various attractions (PoI) of the city and two separate graphs are derived. The tourist can select the PoIs of the starting graph to be visited with high priority in the outward and return journeys, respectively. In our application the tourist is part of the multi-algorithms approach interacting with it and taking decisions for one-day tourist. The proposed approach plans the tourist itinerary, minizing travel times based on the TSP algorithm, taking into account the priority list of PoIs and the decisions of the user. The TSP is used in this paper since it allows to consider a first itinerary solution including all the PoIs of the city that is refined by the multi-level algorithms interacting with the tourists. In detail, compared with the analyzed works, this paper presents the following novelties:


The rest of the paper is organized as follows: Section 2 describes the one-day tourist itinerary planning problem; Section 3 presents the Multi-level algorithm approach for the itinerary planning while Section 4 provides the analysis of the algorithms performance and complexity; Section 5 demonstrates the effectiveness of the proposed approach by a case study focusing on the cruise tourist in the city of Bari and Section 6 provides the conclusions and future works perspectives.

#### **2. The One-Day Tourist Itinerary Planning Problem**

The one-day tourist, having reached a stage of his journey through the airplane, train, car or cruise ship etc., wonders how to spend at best his/her time in the city in a short time period (e.g., one day).

Due to the limited time, it is therefore necessary to pay attention to the organization of the visits and excursions. The tourist can opt for a tour pre-organized by the operator or he/she can plan it on his/her own. In the first case, one of the advantages concerns the mere observation of the predefined roadmap to visit the city, without any worries. This case, on the other hand, does not always satisfy the personal interests of the individual tourist who must follow the visiting group and, in addition, can not personally manage the route and the stops. In the second case, however, the tourist has more freedom of choice but he/she must plan independently the trip in a city and respect the departure times that are mandatory. Instead of relying on the tours organized by the company, sometimes with unsatisfactory results, the tourist by use only a smartphone can select the preferred attractions.

Today, there are numerous online travel planning systems that allow to automatically generate a selection and routing plan to visit PoIs that suit the tourist's personal interests [42]. These systems implement various functionalities that aim to satisfy different

profiles of tourist interest [43,44]. Therefore, considering a tourist discovering the city, in addition to walking through its most famous streets, he/she wants to head, for example, to a restaurant near an attraction to have lunch and taste the typical dishes of the place, and then resume the tour and return back. For instance, by simply accessing an app from the smartphone, he/she can set the time available to carry out the tour from a starting point to a restaurant and the time to return back. The visiting times must also include the stop times for activities such as take photos in front of a monument, go shopping, visit a museum and so on. The tourist can also select the preferred PoIs to be visited on the first part of the day, i.e., in the outward trip, and on the second part of the day, i.e., in the return trip, respectively. In addition, the tourist can also indicate the PoIs that are less important and that can be deleted by the roundtrip in case of time unavailability.

Then, let us describe an example in order to present the addressed problem. Firstly, the following assumptions are made:


Let us consider the case of a cruise tourist who wants to visit the city in one day, without loss of generality. When arriving at the port, the tourist needs to have a plan for the daily tour. In particular, he/she needs to decide which PoIs to visit based on the available time and in which order, also making a priority list to be sure to visit the most important ones. There can be also the necessity to specify which PoIs to be visited in the first part of the day, that is usually lightful and more appropriate to visit outdoor spaces like parks, before to have a lunch, usually in a typical restaurant. The tour for the second part of the day, starts after lunch allowing to complete the city visit going towards the final destination point, i.e., the port. Of course, an application is needed to help the tourist at planning the less time consuming roundtrip, respecting the preferences. In our scenario, the application initializes the PoIs network and shows to the user the map of the city PoIs with related information, including traveling times among each PoI couple based on transport means. Different trip solutions can be provided by the application based on the user choice regarding the stop time at each PoI and preferred way of transport: (1) fastest, (2) by foot, (3) by metro/bus. The tourist is also asked to indicate the starting and destination points of the roundtrip, that are different from the origin/final point (i.e., the port), as well as the time deadline for the roundtrip. In addition, the tourist is asked to decide which PoIs to be visited in the first and second part of the day, indicating the priority and the desired time to dedicate to the visit. On this basis, the application try to generate the customized outward and return tours of the day by applying the heuristic procedure presented in Section 3. If the deadline time both for the outward and return trips are respected, the heuristic procedure investigates the addition of secondary importance PoIs and generates the final roundtrip itineraries. On the contrary, if the deadline time of the outward and/or the return tours is violated, the heuristic procedure can exchange PoIs between the first and the second tour. In case some feasible solutions are determined, i.e., the deadlines of the outward and return trips are satisfied, the procedure delegates to the user the choice of a solution from a list created by the application. Afterwards, the heuristic procedure determines the final customized outward and return tours of the day including possible addition of secondary PoIs. Finally, if the deadline time of the outward and/or the return tours is violated and no feasible solution is achievable, a PoI deletion procedure must be implemented in order to respect the deadline travel time. Let us summarize the necessary input and output information and data of the proposed itinerary planning application:

Initial inputs from the user:


Moreover, other inputs are required to the user from the application while running in order to refine the roundtrip customization as described in detail in Section 3.

Real time inputs from the user:

• preferred itinerary from a list of feasible solutions determined by the proposed automatic procedure.

Outputs by the application:


#### **3. The Multi-Level Algorithm Approach for Tourist Itinerary Planning**

In this Section, we want to present an adequate solution to the problem of the one-day tourist, whose goal is to visit the greatest number of attractions and carry out activities of his own liking, respecting the times available for visiting. First of all the city PoI network needs to be modeled in order to connect all the PoIs and decide the best itinerary. We apply the Graph theory [21,45] to model and study the PoIs network which in this paper is modeled as a weighted connected graph [46]. From each graph a path is determined ensuring that the tourist will visit only once those nodes representing the essential PoI: (i) the first path, called outward path, is from the source to the destination; (ii) the second path, called return path, is from the destination to the source.

In particular, the nodes of the graph represent the city attractions. In addition, the weight of an arc connecting two nodes represents the travel time between two attractions. More in detail, the proposed approach uses two graphs *Go* and *Gr* that are built considering the following tourist inputs: the starting and ending PoIs of the outward path (they correspond to the ending and starting PoIs of the return path), the other preferred PoIs to visit during the outward and return path, the preferred transport mode. The starting PoI (ending PoI) of the outward path is represented by the source node (destination node) *vs* (*vd*) as shown in Figure 1. Moreover, the starting PoI is the place that the tourist firstly reaches after leaving the airport, port or station that are respresented in Figure 1 with the origin node *Vorigin*. The origin node is not included in the set of nodes of *Go* and *Gr*. Finally, each arc of graphs is weighted by the travel time between two PoIs and the time depends by the preferred transport mode chosen by the tourist.

The proposed approach to solve the tourist problem is based on a multi-level algorithm approach [39]. The proposed Algorithms are modeled by means of UML diagrams. UML is a standard highly recognized language widely used to visually describe software programs and algorithms [47]. More specifically, there is the main algorithm, so called Algorithm 1, that is responsible for the data initialization and for the determination of the initial paths. Moreover, Algorithm 1 makes use of two sub-algorithms to find an optimal planning of the itinerary based on the tourist needs in term of time and places of interest, by applying the TSP algorithm. The TSP is about a traveling man who wants to visit only once each PoI of the list returning to the initial PoI through the least cost route. The TSP is suitable to be modeled through a graph in which the nodes are the PoI and each arc connects a couple of PoI (*i*, *j*) including a travel cost from *i* to *j*. The total lenght of a journey is given by the

sum of the arc weights included in the round-trip of the traveler. In order to formulate the generic version of the asymmetric TSP, the following binary variables are needed:

$$x\_{ij} = \begin{cases} 1 & \text{if arc (i,j) is in the tour} \\ 0 & \text{otherwise} \end{cases} \tag{1}$$

with *m* total number of PoIs. Now, according to the Dantzig–Fulkerson–Johnson formulation the TSP can be formalized as the following integer linear programming problem:

*m*

*m*

*min* ∑ *i*=1 ∑ *j*=1,*j*=*i cijxij s*.*t*. *m*∑*i*=1,*i*=*j xij* = 1 *j* = 1, . . . , *m* (2a)

$$\sum\_{\substack{j=1, j\neq i}}^m x\_{ij} = 1 \qquad i = 1, \dots, m \tag{2b}$$

$$\begin{cases} \sum\_{\substack{i=1, i \neq j}}^m x\_{ij} = 1 & j = 1, \dots, m \\ \sum\_{\substack{j=1, j \neq i}}^m x\_{ij} = 1 & i = 1, \dots, m \\ \sum\_{\substack{i \in K}} \sum\_{j \in K, j \neq i} x\_{ij} \le |K| - 1 & \forall K \subset \{1, \dots, m\}, |K| \ge 2 \end{cases} \tag{2b}$$

with *cij* > 0 ∀*i*, *j* ∈ {1, . . . , *<sup>m</sup>*}, *i* = *j* time cost to travel from *i* to *j*, *K* nonempty subset of the set of *m* PoIs and *m*(*m* − 1) number of binary variables. In particular, constraints (2c) ensures that no subset *K* can generate sub-tours, i.e., only a single tour will be generated. In order to obtain the symmetric version of the TSP it is necessary to have *cij* = *cji* ∀*i*, *j* ∈ {1, . . . , *<sup>m</sup>*}, *i* = *j*. It holds that the number of variables in the symmetric TSP is halves with respect to the asymmetric TSP. In this paper, we consider the symmetric TSP inside the proposed heuristic approach modeled with an undirect graph to find the optimal travel times and paths associated to the outward and return tours.

**Figure 1.** *Go* and *Gr* graph examples.

#### *3.1. The Proposed Heuristic Approach*

The proposed approach starts by Algorithm 1 described by the UML diagram in Figure 2 that is the upper level Algorithm that executes two phases: (1) initialization phase; (2) itinerary planning phase.

**Figure 2.** The UML diagram of Algorithm 1: data initialization and itinerary planning.
