1. Trang chủ
  2. » Ngoại Ngữ

14531-spreadsheet-based-modeling-and-optimization-of-a-bi-modal-traveling-salesman-problem-model-solution-and-case

40 3 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Spreadhseet-Based Modeling and Optimization of a Bi-Modal Traveling Salesman Problem: Model, Solution, and Case
Tác giả Roger Grinde
Trường học University of New Hampshire
Chuyên ngành Decision Sciences
Thể loại article
Năm xuất bản 2020
Thành phố Durham
Định dạng
Số trang 40
Dung lượng 2,89 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

The problem is to a identify the set of hikes in order to minimize a hiking time objective while ascending all peaks, followed by b sequencing the chosen hikes in order to minimize a dri

Trang 1

Bond University Volume 12| Issue 2 | 2020

Spreadsheet-Based Modeling and Optimization

of a Bi-Modal Traveling Salesman Problem:

Model, Solution, and Case

Follow this and additional works at: https://sie.scholasticahq.com

This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 4.0 Licence

Trang 2

Spreadsheet-Based Modeling and Optimization of a Modal Traveling Salesman Problem: Model, Solution, and Case

Bi-Roger Grinde

Decision Sciences, University of New Hampshire

roger.grinde@unh.edu

Abstract

This paper presents a bi-modal routing problem and two-phase spreadsheet-based model and solution approach The problem is the Bi-Modal Covering Salesman Problem, and the context for the problem in this paper is a recreational hiking problem Two hikers seek to traverse a set of peaks, where they have defined a number of hikes from which to choose The problem is to a) identify the set of hikes in order to minimize a hiking time objective while ascending all peaks, followed by b) sequencing the chosen hikes in order

to minimize a driving distance objective The problem essentially combines two known problems in Operations Research: the Set Covering Problem and the Traveling Salesman Problem A mathematical programming formulation is presented, followed by

well-a detwell-ailed explwell-anwell-ation of the Excel™ model well-and solution well-approwell-ach with Solver™, using linear and evolutionary engines The model is enhanced using Visual Basic for Applications In instruction, it can be utilized in many ways, from a classroom discussion example all the way up to a semester long project done in several phases A case, split into two parts, is provided in the appendix The full workbook and a template file is available upon request from the author

Keywords: routing, optimization, Operations Research, traveling salesman, spreadsheet,

Excel, Solver, VBA, Simplex Method, evolutionary algorithm

1.0 Introduction

This paper presents a model and solution of a bi-modal routing problem related to the well-known Traveling Salesman Problem (TSP) It is bi-modal due to vehicular and walking travel and is termed the Bi-Modal Covering Salesman Problem (BCSP) A model formulation, spreadsheet-based solution approach (Excel™ with VBA), and case study are provided It is suited for courses related to Optimization, Operations Research, Management Science, Business Analytics, and programming at various levels and

Trang 3

various programs (e.g., business, engineering, applied mathematics) depending on what aspects of the problem-solving process the instructor wishes to emphasize From an educational standpoint, the problem has some key differences compared to the TSP, which present questions of how to model it, and then how to find a solution approach The problem can be used to emphasize the modeling aspect, the spreadsheet implementation, VBA enhancements, or some combination of these It could also be used

as a guided semester-long project where these aspects are emphasized during different phases The author has used the problem as a case in an MBA course in Management Science with good results

The specific problem arises in hiking, but it is related to some other variations of the TSP and is applicable to some other bi-modal routing situations There are a number of mountain peaks to climb For this paper, the specific problem of the 48 mountain peaks above 4000 feet in altitude, in the State of New Hampshire, USA, are used (Smith & Dickerman, 2012) The hikers seek to a) identify the set of hikes to perform which will ascend each peak in the shortest hiking time; and b) sequence the hikes to minimize the driving distance between and within hikes Appendices C and D contain case studies for classroom use The method is generalizable to other situations Briefly, the peaks are reached by one or more trails, each with trailheads A specific trail may traverse more than one peak and may be a round-trip trail or a one-way trail Trailheads are connected

by a network of roads Two hikers utilize two vehicles to reach the trailheads, and then hike one or more hikes from that trailhead In the case of one-way hikes, the hikers must stage a vehicle at each end of the trailhead

In this section, related work is discussed Section 2 presents the problem formulation and outlines the solution approach The spreadsheet implementation (in Excel™ and VBA) is explained in Section 3, and Section 4 explores educational value and possible uses Concluding remarks are provided in Section 5 Appendices contain VBA code and the case study presented, in two parts The spreadsheet implementation and a template file

is available from the author upon request

The TSP and related Vehicle Routing Problem (VRP) have a rich literature due to their many practical applications as well as solution challenges Examples include Gutin (2007), Applegate et al (2007), Golden et al (2008), and Braekers et al (2016) Review of multi-objective problems is done by Jozefowiez et al (2008) The Covering Tour Problem (CTP) has similarity to the BCSP discussed in this paper, in that there are two node sets However, in the CTP there is only one mode of transportation The goal is to find a minimum-cost tour through a subset of the nodes in one set, so that every node in the other set is within some critical distance of a visited nodes (e.g., rural health clinics might

be one node set, and towns/villages might be the other node set) Current & Schilling

Trang 4

(1989) introduced this problem, and it has been studied by others The problem most directly related to the BCSP presented in this paper is termed the Walking Line of Travel Problem (WLT) It was studied by Levy & Bodin (1988) The example provided was to schedule postal carriers who drive to a parking area, complete a walking tour delivering mail, and return to the vehicle It differs from the BCSP in that one-way trips are not allowed, so the BCSP is a more general version of the WLT problem Grinde (2017) presents a formulation of the BCSP, an heuristic solution approach using traditional optimization software, and computational results

2.0 Problem Formulation and Solution Approach

The BCSP uses two networks, one for each mode of transportation In the hiking case

problem, one network is a set of parking areas (P1, P2, …, P m) connected by roads The

other network is a set of peaks (“cities” in the traditional TSP language), denoted by (C1,

C2, …, C n) and connected by trails Some trails have connection points to parking areas Each of the peaks must be visited at least once Figure 1 shows an example The overall objective is to minimize total weighted travel time or distance (driving plus hiking) while visiting each peak at least once This involves driving from a home base to one of the parking areas, making one or more hikes (either cyclical or chain hikes, to be discussed shortly), driving to another parking area and hiking from there, and returning to the home base after all peaks have been visited

Figure 1 Road and Trail Networks

Trang 5

The concept of a single trip visiting one or more peaks (hike in this problem context) is as

follows The car is driven to a parking area P i A hike is performed, which visits one or more peaks Two possibilities exist for the end of the hike A loop or cyclical hike is when

the hikers return to P i, and then drive to another parking location (or perform another

hike from P i) Figure 2 shows a cyclical hike; Figure 3 a chain hike A one-way, or chain,

hike ends at a different parking area, say P j To perform a chain hike, both hikers drive to

P j , the endpoint of the hike, and leave one car Then they drive to P i, and depart on the

hike Finishing the hike at P j , they drive back to P i to retrieve the other car

Figure 2 Cyclical Hike

Figure 3 Chain Hike

Cyclical Trip Illustration

Step 3: Drive 2 Cars

P C3

Chain Trip Illustration

Step 5: Drive 2 Cars

to next hike

P1 (begin of hike) C3

Trang 6

Chain hike feasibility depends on the application In the hiking setting, it is common not only to have two hikers, but also that some hikes are more naturally done as one-way hikes This has the potential to reduce hiking time considerably Having two cars increases the total mileage driven, though not necessarily the time Chain hikes (trips) may be useful in other settings as well, with or without multiple vehicles For example if the “parking” areas are airports, and customers are to be visited on one-way trips between airports Another example may occur with bike or car sharing programs, where the pick-up and drop-off locations can be different Other application notes are discussed

as part of Case A (Appendix C)

The modeling and solution approach here assumes that possible hiking trips are developed in advance This is reasonable, as there are many hiking guides available and there tends to be a finite number of reasonable hikes The problem becomes two-phased: 1) select which hikes to perform, visiting each peak at least once while minimizing the hiking objective; and 2) sequencing the sequencing hikes so the driving objective is optimized The objective can be time-based or distance-based, or a weighted combination In the spreadsheet implementation developed for this paper, the hiking-based objective has precedence over the driving-based objective

A mathematical programming formulation of the BCSP is presented here This is the same

as in Grinde (2017) That paper then used traditional optimization tools for the solution and presented computational experience This paper uses the formulation as a guide for the development of the spreadsheet-based approach which is the focus here When using this problem in an educational setting, the instructor can choose the depth in which to cover the formulation In a mathematical programming course, the formulation would probably receive much attention In an application-based MBA course, the formulation might be used mainly to illustrate the correspondence between the formulation and the resulting Excel™ and Solver™ model

Notation is as follows:

c i = hiking cost of trip i (e.g., time, distance)

d ik = driving cost of driving from trip i to trip k (e.g., time, distance)

a ij = 1 if trip i visits customer (peak) j; 0 otherwise

The direction of travel could affect the hike cost (e.g., terrain features), so it is common to define a hike in each direction, especially for chain hikes (cyclical hikes can be done in

Trang 7

the fastest way with no impact on driving logistics) The driving distance matrix

(elements are d ik) is the matrix of hike-hike distances

Decision variables for the problem are x i for each trip being selected or not, and y ik used

to model the sequencing of trips Both sets of variables are binary Specifically,

x i = 1 if trip (hike) i is selected; 0 otherwise

y ik = 1 if trip (hike) k follows trip (hike) i (k≠i); 0 otherwise

A mathematical programming formulation follows Because the objective is the

combination of hiking and driving objectives, w1 and w2 are used respectively to weight the objectives

The objective is the weighted sum of the hiking and driving costs For relatively larger

values of w1, the hiking objective is more important, and vice versa Constraints (1) ensure that every peak is visited at least once (these constraints are essentially the type of constraints found in set covering problems, hence the “covering” in the BCSP acronym) Constraints (2) and (3) make sure that the selected hikes are connected to the actual driving network That is, if a hike is not selected, no drives should be selected to or from that hike Similarly, if a hike is selected, there must be one drive to that hike and one drive away from that hike The subtour elimination constraints ensure that the hikes selected form a full cycle (aka, Hamiltonian tour) These latter constraints are essentially the constraints found in a typical Traveling Salesman Problem

Weights on the objective allow for differential importance of the hiking and driving objectives That said, the two-objective problem is a very difficult mathematical program

to solve However, the objective and constraints are separable by objective Specifically,

min 𝑤 𝑐 𝑥 + 𝑤 𝑑 𝑦 subject to

𝑎 𝑥 ≥ 1 𝑗 = 1 … 𝑛 (1)

𝑦 − 𝑥 = 0 𝑖 = 1 … 𝑚 (2)

𝑦 − 𝑥 = 0 𝑘 = 1 … 𝑚 (3) subtour elimination constraints

𝑥 , 𝑦 ∈ {0,1}

Trang 8

by addressing the hiking objective first, the best set of hikes can be identified This is essentially Phase I of the solution process Once this is done, the selected hikes can be sequenced to minimize the driving objective This is Phase II of the solution process The spreadsheet implementation developed in this paper is solved using this two-phased approach where the hiking objective taking precedence over the driving objective

3.0 Spreadsheet-Based Solution Approach

3.1 Overview of Workbook

Based on the problem formulation of the previous section, and the two-phased solution approach, the problem is modeled and solved using Excel™ and Solver™ Visual Basic for Applications (VBA) is used to automate tasks such as resetting and building the Solver settings, and for solving the Phase II problem using several different random starting sequences However, VBA is not needed for the core functionality of the model and heuristic solution Extensive use of range names is made to allow for better self-documentation of formulas, generality, easier scalability, and better generality of the VBA code A Documentation sheet is included that provides the formula logic in tabular form, definitions of the named ranges, and screen shots of Solver settings This section first provides an overview of the structure of the workbook and its sheets, and then provides explanations of the core functional aspects of those sheets

Figure 4 shows, in block diagram form, the logical structure of the workbook The two primary sheets are Model_Cover and Model_Sequence Model_Cover is for the Phase I problem It contains the definitions of the hikes and the optimization model to select the hikes that minimize the hiking objective Model_Sequence is for the Phase II problem It extracts the selected hikes from Model_Cover, and contains the optimization model to identify the best sequence in which to perform the hikes according to the driving objective Model_Sequence uses driving distances between hikes computed and stored in the Hike_Hike_Dist sheet In turn, the Hike_Hike_Dist sheet is computed from distance values between parking areas stored in the Drives sheet Two other sheets are used by VBA in the event the user wants to try one or more random starting sequences for the selected hikes These are the Index_Randomizer sheet, which computes a random sequence of hikes for the correct number of selected hikes The VBA_Support_Sheet is used to store the best-found sequence of hikes for the Phase II problem if the user tries one or more random starting sequences VBA is used on the Model_Cover sheet to quickly build the Solver settings for either a distance-based or time-based hiking objective, and to solve the Solver model On the Model_Sequence sheet, VBA is used to reset and rebuild the Solver model (necessary if the number of selected hikes changes),

to reset the sequence of hikes to an increasing order of hike number, to compute and show

Trang 9

a random sequence of hikes and the resulting driving distance, to solve the Solver model,

and to run the Solver model for a user-specified number of random starting solutions

Figure 4 Logical Structure of Workbook

Table 1 lists the defined ranges in the workbook Some of these will be mentioned when

discussing the detailed logic

Table 1 Range Names and Associated Cell References

Model_Cover Max_Allowed_Hiking_Tim

e

=Model_Cover!$C$73

Model_Cover Max_Number_Hikes =Model_Cover!$C$71

Trang 10

Worksheet Range Name Reference

Model_Cover PeakCoveredRequired =Model_Cover!$H$53:$BC$53

Model_Sequence Current_Run_Number =Model_Sequence!$M$32

Model_Sequence IndexSequenceAnchor =Model_Sequence!$F$10

Model_Sequence InterHikeDistance =Model_Sequence!$M$12 Model_Sequence NumStartingSolutions =Model_Sequence!$M$31

Hike_Hike_Dist Hike_Hike_Dist =Hike_Hike_Dist!$B$8:$AR$50

VBA_Support_Shee

t

Best_Index_Sequence =VBA_Support_Sheet!$A$2:$A$4

3

3.2 Model_Cover Sheet: Select Hikes To Be Performed

The detailed logic of the Model_Cover sheet is presented in this subsection Recall this solves the Phase I problem, to select the hikes to minimize the hiking objective, either time or distance Figure 5 shows an overview of the Model_Cover sheet (note: columns U-AZ are hidden for readability) This is intended to give the overall structure; the discussion covers each key area in detail Table 2 lists key formulas on the Model_Cover sheet

Trang 11

Figure 5 Model_Cover Worksheet

The range A8:G50 is a named range, Hike_Info This is essentially a database of the hikes that are defined Each hike has an ID, a description, a time (in hours) estimate to complete,

a mileage, a type (whether a chain hike or cyclical hike), and the starting and ending parking “nodes,” or trailheads For cyclical hikes, the starting and ending nodes are the same

Trang 12

Table 2 Key Formulas in Model_Cover Sheet

0=cyclical, 1=chain

containing each peak

Calculated number visits to each peak based on selected hikes

C56 =SUMPRODUCT(HikeChosen, C9:C50)

Total hiking time of selected hikes (objective function)

selected hikes

hikes selected

Moving to the right, the HikePeakArray (H9:BC50) is a binary matrix mapping the hikes

to the peaks, corresponding to a ij in the problem formulation presented earlier Some

hikes traverse numerous peaks; this may occur if multiple peaks are connected by a ridge

Other hikes contain only a single peak

Continuing to the right, the HikeChosen range (BD9:BD50) is the set of decision variables

x i in the problem formulation A hike chosen corresponds to a value of 1, and 0 if not

chosen These are binary values, but two decimal places are shown, so that after Solver

runs, it is easy to verify they are indeed binary Conditional formatting is used to

Trang 13

highlight the hikes actually chosen, and this formatting is carried over to help see the Hike_ID values that are chosen The decision variables, combined with each column of HikePeakArray, computes the number of times each peak is covered, using the SUMPRODUCT function This is shown in the PeakCoveredActual range PeakCoveredRequired is a range with values of 1 for all peaks This will be used in the constraint for the Solver settings Typical Set Covering Problem constraints have 1’s for all the right-hand-side values This is used here, but if desired, the user could set one or more peaks to be visited more than once, or not at all Thus, this model can be used for all the peaks in one big tour, or in a piecewise fashion, by setting some of the PeakCoveredRequired values to 0

Similarly, the TotalTime and Total_Miles values are computed using SUMPRODUCT functions, based again on the HikeChosen values The objective used here in Solver is TotalTime, but it is easy to change this to the Total_Miles objective if desired

At this point, all of the necessary ingredients for the optimization model are present on the worksheet The decision variables are HikeChosen, the objective function is TotalTime, and the constraints are represented as PeakCoveredActual >= PeakCoveredRequired The HikeChosen variables are set to be binary Finally, the LP Simplex algorithm is specified, as this is a linear model The Solver dialog box is shown

in Figure 6 The dialog box contains some additional constraints, utilizing the calculations and parameters shown in rows 59-73 of the spreadsheet For example, if the user wants

to limit the number of chain (one-way) trips to a smaller number than is optimal, the parameter value in cell C69 can be changed, and the model re-solved However, only the PeakCoveredActual >= PeakCoveredRequired constraints are truly required in this formulation; the others are included to be able to tweak the solution in a direction desired

by the user

Trang 14

Figure 6 Solver Box for Model_Cover Sheet

There are three VBA routines related to the Model_Cover sheet These set up the Solver settings for the time-minimization model, the distance-minimization model, and a button for running the current Solver model Code for these is contained in Appendix A

The Model_Cover sheet can be used without Solver if desired A user can experiment with different hike combinations, for example, if they have some favorite hikes In fact, like any optimization model in Solver, the user should be able to manually experiment with different solutions Of course, optimization takes all constraints into account simultaneously while minimizing the objective This manual experimentation on the spreadsheet, without Solver, can be a helpful way for students to get a better understanding of the impact of different decisions It is also useful in the debugging process

3.3 Model_Sequence Sheet: Sequence the Selected Hikes

The Model_Sequence sheet determines the best sequence of the hikes in order to minimize total driving distance between the hikes, returning to a home location As described earlier, two cars are used to be able to logistically execute chain hikes In essence, this is a Traveling Salesman Problem It is asymmetric due to the existence of chain hikes; the distance from one hike to another hike is dependent on which direction the hikes are performed The solution engine used for this portion is the evolutionary

Trang 15

algorithm in Solver, which accommodates sequencing problems quite well It should be noted that the “optimization” is really a heuristic, as an evolutionary algorithm cannot guarantee optimality To help the user experiment, provision has been included to solve the sequencing problem starting with multiple random starting sequences, and choose the best one This is discussed after the main logic is presented

Figure 7 shows an overview of the Model_Sequence sheet As with the Model_Cover sheet, the discussion explains each key area in more detail Table 3 contains key formulas

in Model_Sequence

Figure 7 Model_Sequence Worksheet

Table 3 Key Formulas in Model_Sequence Worksheet

hikes

B7 =COUNTIF(C10:C51,"<>0")

Number of selected hikes in current solution

B10

={INDEX(Hike_ID,SMALL(IF(HikeChosen=1,

B10:B51 (enter as

Extracts the Hike ID values from the

Trang 16

Address Formula Copy To Description

ROW(HikeChosen)-ROW(INDEX(HikeChosen,1))+1),A10))}

array formula)

Model_Cover sheet based on the decision variable values, HikeChosen

Conditional formatting

is used to hide the error values that occur for rows in excess of the number of hikes chosen

Converts the results in Column B to the same values, but with not Excel error values (necessary for Solver to function properly)

For readability, to better show the sequence of indices of the Hike ID values

For readability, to better show the Hike

ID values corresponding to this

position in the sequence

Pulls the Hike ID value for the hike in this position in the sequence

Pulls the inter-hike distance corresponding

to the pair of hikes adjacent in the sequence

Pulls the intra-hike distance of the current hike in the sequence

Sum of the total hike and intra-hike distances of the current

Trang 17

inter-Address Formula Copy To Description

sequence (M12 is the objective for Solver)

distance

distance

The left-hand portion (columns A-C) extract the Hike_ID values from the Model_Cover

sheet for the selected hikes The main issue in getting the problem ready for Solver is that

even though there are 42 defined hikes, the Model_Cover algorithm identifies just a subset (12 in this case) of these to actually be performed The sequencing aspect of the

evolutionary algorithm cannot accommodate “null” hikes, and even if it did, solution time would likely increase unacceptably Therefore, to get the problem ready for Solver,

it is necessary to extract just the selected hikes from Model_Cover into the Model_Sequence sheet, and to do this via Excel formulas From a formula standpoint, this is the most complex logic The key formulas are in cells B10:B51 The formulas are

entered as an array formula that finds the i th smallest value of the Hike_IDs from among

the hikes that are selected on the Model_Cover sheet The hikes that are not selected (HikeChosen values of 0) are ignored, so what results is just the Hike_ID values of the

chosen hikes, in the first positions of this area If more or less hikes are chosen, this area

fills in with just the rows visible for the chosen hikes Conditional formatting is used in

these columns to show only relevant Hike_ID values (the formula in column B results in

an error for those rows beyond the number of hikes chosen; column C simply converts

this to a 0 for those cases; see Table 3 for the formulas)

Moving to the right (columns E-J), it is important to recognize the difference between the

sequence position and the Hike_ID value In this case we have 12 hikes chosen, with Hike_ID values scattered from Hike_ID =1 to Hike_ID = 40 Column F shows the sequence index found after the Solver solution procedure Columns G and H translate the sequence index back into Hike_ID numbers An initial dummy hike (Hike_ID = 0) is

listed as the first hike This hike starts and ends at the home location The first sequence

number in the solution is 12 (cell F10) Looking in columns A-C, this is seen as corresponding to Hike_ID 40 (cell H10) The inter-hike distance from Hike_ID = 0 to Hike_ID = 40 is 68 miles This comes from the Hike_Hike_Dist sheet, shown in the block

diagram (Figure 4), with the specific formula in Table 3 Because Hike_ID 40 is a cyclical

hike, both cars are parked at the begin/end of the hike so there is no intra-hike driving

needed (cell J10)

Trang 18

Moving to the next line, sequence index 3 is next; this corresponds to Hike_ID = 7 So, from Hike_ID 40, the next hike is Hike_ID 7 From the Hike_Hike_Dist sheet, the distance from the former to the latter is 46 miles This continues; the third sequence index is 2, corresponding to Hike_ID 5 Using similar logic as before, the distance from Hike_ID 7

to Hike_ID 5 is 9 miles (inter-hike distance, cell I12) But since Hike_ID 5 is a chain hike,

it has 3 miles of intra-hike driving in order to shuttle a car, as the driving distance from the end of this hike is 3 miles from the beginning of the hike Columns I and J are the single-car distance; accounting for both cars in the distances is handled in the summary calculations of total miles

This process continues until the last line in green (cell F22), which indicates that sequence index 13 is the last value This cell is not a decision variable as will be seen in the Solver model Rather, this sequence index of 13 ensures that the entire tour completes with Hike_ID = 0, corresponding to the home location Thus, this logic forces a drive from the last hike (Hike_ID = 32 in this case) back to the home location

The last part of the logic in the sheet is the summary of distances The single-car hike distance is in cell M12), and it is the sum of column I Similarly, the intra-hike distances due to car-shuttling, is the sum of column J, shown in cell N12 From the standpoint of minimizing vehicle mileage, intra-hike distance is constant once the set of hikes has been determined, so the optimization model seeks to minimize cell M12 To calculate the total two-car distance traveled, the inter-hike and intra-hike distances are computed and doubled; this is shown in cell O13

inter-The Solver model for the sequencing problem is very compact Figure 8 shows the Solver dialog box The objective is to minimize InterHikeDistance (cell M12) The decision variables are F10:F21, corresponding to the sequence indices (values 1,2,…,12) in this case because there are 12 hikes selected The constraint uses Solver’s “All Different” constraint, which is designed for sequencing problems such as this The solution engine

is the “Evolutionary” solver, a heuristic technique Solution times with evolutionary algorithms depend on parameter settings for the solution process, and the user can experiment with those Solutions with evolutionary algorithms can also depend on the starting solution The solution shown in Figure 7 was obtained using a sequential 1,2,…,12 as the starting sequence setting The total single-car inter-hike distance for the starting solution is 458 miles, and the best solution found is 292 miles Experimenting with several different random starting solutions gives some reasonable confidence that this “best found” solution is close to optimal

Trang 19

Figure 8 Solver Model for Model_Sequence Sheet

For the Model_Sequence sheet, there are a number of embedded VBA routines, accessed

by buttons on the sheet Code for these is contained in Appendix B The first routine resets and rebuilds the Solver model This is needed any time the number of hikes selected changes For example, if the user re-runs the Model_Cover algorithm and selects 14 hikes instead of 12, the routine to reset and rebuild the Solver model needs to be run The reason for this is that the decision variables in the Solver model need to correspond to the number of hikes selected This routine is also useful if the user makes some modifications

to the Solver model, as this can be run to return the model to its default state Two routines initialize the index sequence One simply makes it an ascending order, and other randomizes the order There is a routine to run the Solver model Finally, there is a routine that runs Solver a user-specified number of times, each with a different random starting solution The best ending solution is retained and returned back in the Model_Sequence sheet at the end of the routine

Trang 20

3.4 Data and Calculation-Support Worksheets

There are four additional worksheets in the workbook that provide input data and calculation support These are shown in the block diagram (Figure 4) This section provides additional detail

The Drives sheet contains the driving distance matrix between parking nodes, aka trailheads These are determined using mapping software (e.g., Google Maps) or a detailed printed map of the area Node 1 is the home location where the overall tour begins and ends Nodes 2-25 correspond to trailhead locations The matrix of distances has a range name Park_Nodes (see Table 1)

The Hike_Hike_Dist sheet uses the information in Park_Nodes, plus information in the range Hike_Info (sheet Model_Cover), to determine the driving distances between each pair of hikes Figure 9 shows an excerpt of this sheet, with some rows and columns hidden for ease of viewing The key formula in this sheet is:

Cell B8 = INDEX(Park_Nodes,INDEX(Hike_Info,$A8+1,5),INDEX(Hike_Info,B$7+1,6))

This formula is copied to the right and down for the matrix elements Briefly, it looks up the driving distance (in Park_Nodes) from the beginning node of the hike represented by the current row, to the ending node of the hike represented by the current column The inter-hike driving always goes to the ending point of the next hike For cyclical hikes the beginning and ending nodes are the same, so this is immaterial But for chain hikes, the two cars are driven to the ending node of the hike, and then one car is driven to the starting node of the hike This latter driving is intra-hike driving and is captured in this matrix by the entries along the diagonal

Ngày đăng: 25/10/2022, 04:31

TRÍCH ĐOẠN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w