# Personalized Tour Itinerary Recommendation Algorithm Based on Tourist Comprehensive Satisfaction
## 4 Method
### Time Planning Algorithm Based on Tour Itinerary Planning Satisfaction
Step 2: Determine whether the current node is a restaurant or hotel designated by the user. If not, proceed to the next step. If it is, handle it according to the selected restaurant or hotel, and move on to Step 6. Step 3: Determine whether the current food and lodging arrangements need to occur within the current node's time period. If so, proceed to the next step; otherwise, exit. Step 4: Determine if the next node in the itinerary is a designated a restaurant or hotel and supports the current dining and accommodation arrangement. The suitability of the selected node for the current dining and accommodation arrangement is based on two criteria: whether the node type supports the type of dining and accommodation, and whether postponing the dining and accommodation arrangement is acceptable. If both criteria are met, abandon the process; the dining and accommodation arrangement will move to the next node to avoid waiting or missing the time window of the next node. Otherwise, proceed to the next step. Step 5: Make the dining or accommodation arrangement within the time period of this node; proceed to the next step. Step 6: Determine whether the next dining and accommodation arrangement falls within the time period of the current node. If it does, proceed with recursion and return to Step 4. If not, exit the process. When a designated restaurant or hotel node triggers a self-call, it is because the expected time for the next dining or accommodation falls within the time interval \((N.EndT,N.NextNArT]\). At this point, the node is no longer treated as a designated restaurant or hotel. For selected restaurants or hotels, the handling method in step 2 is as follows:

1. If waiting is required, schedule other dining and accommodation arrangements normally during the waiting time;
2. If delayed but still accessible, adjust the schedule backward without affecting the next dining and accommodation arrangement, ensuring that the duration remains unchanged;
3. If on time or inaccessible, no action is needed. In step 5, the accommodation and dining arrangement method are based on the following assumptions: dining and accommodation can conveniently take place near scenic spots or along the route between nodes as needed. This aligns with people's habits and objective facts. The main process is as follows: if the expected timing does not conflict with the time allocated for visiting the scenic spots, then the arrangement proceeds according to the expectation. Otherwise, by calculating the penalty increment for each alternative, the arrangement selects the one with the smallest penalty increment for scheduling. Taking the dining time arrangement as an example, Figure A2 depicts the scenario in which the expected arrangement start time falls within different stages of the node time period. Figure A2a depicts the expected start time for dining within the time interval \((N.ArrT,\)\(N.StartT]\). The dining time will be arranged sequentially, with priority given to duration1, followed by duration2, and then duration3, as depicted in Figure A2a. In other words, we will rationalize the use of time by advancing the dining time and postponing the sightseeing time without causing lateness. If the expected dining duration cannot still be met, conflicts will arise. In such cases, we will attempt alternative solutions. Figure A2b depicts the expected start time for dining within the time interval \((N.StartT,\)\(N.EndT]\). If the node supports internal dining and the expected dining duration is not greater than duration3 as depicted in Figure A2b, there is no conflict. Otherwise, alternative arrangements will be considered. Figure A2c depicts the expected start time for dining within the time interval \((N.EndT,\)\(N.NextNArrT]\). In this case, there will be no conflict. There are three alternative options for the mealtime:

Option 1: Dining is arranged within the original time interval, aiming to meet the mealtime as closely as possible without sacrificing tour time, and any remaining missing mealtime is cancelled.