Integer Linear Programming Model and Greedy Algorithm for Camping Along the Big Long River Problem Zhen-ping Li1, Xiao-dong Huang 2 1 School of Information, Beijing Wuzi University, Beijing, China Department of Postgraduate, Beijing Wuzi University, Beijing, China ([email protected], [email protected]) 2 Abstract - In this paper, we investigate the problem of camping along the Big Long River: How to schedule the X trips in a rafting season of the Big Long River so that the total meets of any boats are minimal? By introducing the proper variables, the problem is formulated into an integer linear programming model. For small size problem, this integer linear programming can be solved by Lingo software; for large size problem, we design a greedy algorithm to arrange the schedule of the given X boats. Finally, we do some simulations of the above model and algorithm and obtain the optimal solution. Keywords – Camping along the river, integer linear programming model, greedy algorithm, simulation, the optimal solution I. INTRODUCTION Visitors to the Big Long River (225 miles) can enjoy scenic views and exciting white water rapids. The river is inaccessible to hikers, so the only way to enjoy it is to take a river trip that requires several days of camping. River trips all start at First Launch and exit the river at Final Exit, 225 miles downstream. Passengers take either oar- powered rubber rafts, which travel on average 4 mph or motorized boats, which travel on average 8 mph. The trips range from 6 to 18 nights of camping along the river. Currently, X trips travel down the Big Long River each year during a six month period (the rest of the year is too cold for river trips). There are Y camp sites on the Big Long River, distributed fairly uniformly throughout the river corridor. In order to make sure the passengers enjoy a wilderness experience and also for the sake of their safety [1], we should try to avoid the meet of two groups of boats on the river. Besides, due to the capacity constraints, no two sets of campers can occupy the same site at the same time. Every year, before the rafting season, the park managers must arrange the schedule of these X trips that will raft along the Big Long River in the rafting season. The key problem is how to schedule these X trips so that the total meets among all boats in the river is minimum. In this paper, we will solve this problem. This paper is organized as follows: In section II, we make some assumptions [2], [3] and introduce several variables [4], and then we formulate the problem into an integer linear ____________________ This work is supported by National Natural Science Foundation of China under Grant No.11131009 and the Funding Project for Academic Human Resources Development in Institutions of Higher Learning under the Jurisdiction of Beijing Municipality (No.PHR201006217). model; Then we will design a greedy algorithm in section III; Section IV is the simulation results; The conclusion is given in section V. II. THE INTEGER LINEAR PROGRAMMING MODEL A. Assumptions and variables a) Assumptions Once people choose one of the propulsion (oarpowered rubber rafts or motorized boats) at first, they can not change again on the way; The duration of each trip ranges from 6 to 18 nights on the river; There are X trips, each trip has a given duration; There are Y camps distributed fairly uniformly throughout the river corridor; There is so enough fuel and power for each boat that no breakdown might occur on the whole river trip; Each boat, controlled by the specialized staff, will run exactly on schedule; There are 180 days in the Big Long River’s rafting season; There are 8 hours open for the river trip at daytime; Each rafting boat must stay in one camping site at night. b) Variables X: the total number of available trip boats; Y: the total number of camping sites; rik: the time when boat i arrives at camping site k; dik: the time when boat i leaves from camping site k; 1,boat i occupys camping site k xik = 0, otherwise 1,boat i and j meet at river between camping site k and k +1 cijk = 0,otherwise 0,if dik >d jk cijk1 = 1,otherwise and rik+1 >rjk+1 0,if dik <d jk and rik+1 <rjk+1 cijk2 = 1,otherwise Ti: the total trip duration of boat i (measured in nights on the river); Pi: from which day boat i start off (Pi is an integer) at the First Launch; vi, min: the minimal speed of boat i; vi, max: the maximum speed of boat i. B. The Integer Linear Programming Model The problem of camping along the Big Long River can be formulated into an Integer Linear Programming Model[5-7]], in which the schedule time table of all given X boats (the total number of available trip boats) can be obtained with the total meets among all boats in the river be minimal. (7) (8) III. GREEDY ALGORITHM (9) As a matter of fact, we could use Lingo software to solve this problem; however, the problem scale is so large that the time consuming will be too long. So it’s not wise enough to use Lingo software in this situation. Here we design a greedy algorithm [8-12] to solve this problem. Firstly, we define the open time for river trip. According to the given information, we could define that the river trip is only allowed at daytime from 08:00 to 16:00 clock; for the other time, passengers have to stay at the camping site. b) The integer linear programming model As analyzed above, the objective function is constructed to minimize the total meets between any pair of boats on the river. The constraints including: (1) the river trip can only be allowed at daytime from 08:00 to 16:00; (2) the river trip duration of each boat is an integer, ranging from 6 to18 nights; (3) no two sets of campers can occupy the same site at the same time; (4) the season for river trip only lasts 6 months (180 days). Based on the descriptions above, we formulate the integer linear programming mode as follows: X X Y i j k (1) s.t 0 rik dik , i 1, 2, , X ; k 1, 2, w w 225 rik di ( k 1) , w= vi max vi min Y 1 24 Pi 8 dio 24 Pi 16 k s 1 s 1 k k 1 s 1 s 1 24( Pi xis ) 8 rik 24( Pi xis ) 8 Y s 1 is Ti xik dik rik Mxik (2) (3) (4) k 24( Pi xis ) 8 dik 24( Pi xis ) 16 x ,Y (10) rik rjk M xik x jk (11) rik 0 xik 0,1 c k 0,1 ij Pi 0 (integer) T 0 i i, j 1, 2,..., X k 1, 2,..., Y (12) The objective function (1) is to minimum the total meets between any pair of boats on the river; Constraint (2) means the time when boat i leaves site k is later than that when boat i arrives at site k; Constraint (3) guarantees the time for boat i to travel from site k-1 to site k is between the lower and upper bound; Constraint (4) means that boat i will begin its trip in the Pith day at the open time, where Pi =1,2,…174; Constraint (5) guarantees that boat i leaves camping site k at the open time; Constraint (6) guarantees that boat i arrives at camping site k at the open time; Constraint (7) means the duration of boat i is Ti, where Ti is an integer ranging from 6 to 18; Constraint (8) describes the condition whether boat i occupies the camping site k; Constraint (9) guarantees all the boats will finish their river trips in six months; Constraint (10) describes the condition whether boat i and boat j meets on the river; Constraint (11) guarantees no two sets of campers can occupy the same camping site at the same time; Constraint (12) describes the value range of variables. a) One essential definition min z = Cijk dik djk Mcijk 1 k1 ri ( k 1) rj ( k 1) Mcij k2 dik djk Mcij k2 ri ( k 1) rj ( k 1) Mcij k k1 k2 cij cij cij 1 (5) (6) Y 6 Pi xis 180 s 1 A. Several Essential Supposes According to our model, we will write a procedural by using the MATLAB software, but before this we give some essential supposes again: To avoid the meet between any pair of boats on the river, the boats have to start off by some gap time, and we define the gap time as follows: Gap time =225/(Y+1)/v, where v is the speed of boat; The boat will run at the same speed during the whole trip; The actual time of river trip for each boat every day is not more than 5 hours; Passengers who want to have a river trip need to make a booking in advance, and then we will divide the six months’ rafting season into several cycles according to the passengers’ booking. During one cycle time, we will arrange the boats by their duration like this: boat of 6 nights first, and then it will be 7, 8,… in turn, boats of 18 nights will be the last to be arranged; The number of boats (represented with Q) arranged every day will depend on its duration and could be calculated by Q=[Y/Tdur]. For example, for boats whose duration is 6, the maximum number of this type boats we can arrange every day is [Y/6]; for boats whose duration is 7, the maximum number we can arrange every day is [Y/7].Why? We can explain this by the following graph (see Fig. 1). Suppose Y=24,then for boats whose duration is 6, the maximum number of boats we can arrange every day is 4: … Fig.1 Trip process of boats arranged in the first and the second days In Figure 1, the bold horizontal line denotes the riverbank while the thin vertical line represents the camping site and the arrow symbolizes the boat. At the first day we arrange 4 boats. Then we can see these four boats as a whole and its whole trip process could be described vividly in the above graph. By this method we can guarantee to utilize the camping sites in the best possible way. As to other boats of different duration, we can draw the similar graph like the above. B. The Greedy Algorithm The greedy algorithm can be described as follows. BEGIN Classes all X boats into 13 groups according to their duration. Denote the number of boats whose duration is i by X(i), i=6,7,…,18. Provided that the maximum river trip time every day is no more than 5 hours, calculate the maximum number of boats whose duration is i we can arrange every day, denoted it by m(i), where m(i)=[Y/i]. for i = 6:18 Arrange the schedule of all boats with duration i. For all X(i) boats with duration i, arrange them to start off from the First Launch in X (i) / m(i) consecutive days, with the time gap between two successive boats is 225/(Y+1)/v daytime. After all X(i) boats with duration i arranged, we can arrange the following X(i+1) boats with duration i+1 in the following X (i 1) / m(i 1) days…., till all X boats are arranged. end END IV. SIMULATION RESULTS In this section, we will do some simulations of the model and algorithm described above. Supposing Xi denotes the number of boats whose duration is i (i=6, 7…18), where X6=5, X7=6, X8=11, X9=12, X10=10,X11=8, X12=6, X13=15, X14=7, X15=12,X16=12, X17=11, X18=9. Given Y=53. We run our procedural coded by MATLAB software, the simulation result are as follows: D1: 5 boats whose duration is 6 nights and 3 boats whose duration is 7 nights will start off in the first day; D2: 3 boats whose duration is 7 nights and 4 boats whose duration is 8 nights will start off in the second day; D3: 6 boats whose duration is 8 nights will start off in the third day; D4: 1 boat whose duration is 8 nights and 5 boats whose duration is 9 nights will start off in the fourth day; D5: 5 boats whose duration is 9 nights will start off in the fifth day; … D31: 2 boats whose duration is 18 nights will start off in the 31st day; D32: 2 boats whose duration is 18 nights will start off in the 32nd day; D33: 1 boat whose duration is 18 nights will start off in the 33rd day. The detail rafting schedule of all boats can be described in Figure 2. According to the simulation results, we find that we can arrange the 124 boats in about 50 days. This inspired us that we can divided the rafting season (180 days) into several (for example 3) periods. Arrange X/3 boats in camping site day 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 7 8 8 9 9 10 10 11 11 12 13 13 13 13 14 14 15 15 15 15 16 16 16 16 17 17 17 17 18 18 18 18 1 7 8 8 9 9 10 10 11 11 12 12 13 13 13 14 14 14 15 15 15 15 16 16 16 16 17 17 17 18 18 18 18 18 2 7 8 8 9 9 10 10 11 11 12 12 13 13 13 13 14 14 15 15 15 15 16 16 16 16 17 17 17 17 18 18 18 18 3 4 6 7 8 9 9 9 10 10 11 11 12 13 13 13 13 14 14 14 15 15 15 15 16 16 5 6 7 8 8 9 9 10 10 11 11 12 12 13 13 13 13 14 14 15 15 15 15 16 16 16 6 9 9 10 10 11 11 12 12 13 13 13 13 14 14 15 15 15 15 16 16 16 7 17 17 17 17 18 18 18 18 8 9 7 8 8 9 9 9 10 10 11 11 12 13 13 13 13 12 13 14 15 17 11 7 8 16 8 8 6 7 8 8 6 7 8 8 9 9 6 7 8 8 6 7 8 8 9 9 9 9 10 10 10 9 9 10 10 10 11 11 12 13 13 13 13 6 7 8 8 9 9 10 10 11 11 12 13 13 13 13 14 14 15 15 15 15 16 16 16 16 9 9 10 10 11 11 12 12 13 13 13 13 14 14 15 15 15 15 16 16 16 11 11 12 13 13 13 13 14 14 15 15 15 16 16 16 16 11 11 12 13 13 13 13 11 11 12 12 13 13 13 13 14 14 14 15 15 15 16 16 16 16 17 17 17 14 14 15 15 15 15 16 16 16 17 17 17 17 14 14 15 15 15 15 16 16 16 11 11 12 12 13 13 13 13 14 14 15 15 15 15 16 16 16 17 17 17 17 17 17 17 9 9 10 10 11 11 12 12 13 13 13 13 14 14 14 15 15 15 15 16 16 16 14 14 15 15 15 15 16 16 16 17 17 17 18 18 18 18 18 18 17 17 17 17 17 17 17 17 18 18 18 18 18 18 18 18 18 17 17 17 17 17 17 17 17 18 18 18 18 7 8 8 9 9 9 10 17 17 17 18 18 18 18 6 7 8 8 9 9 10 10 17 17 17 17 18 18 18 18 11 11 12 13 13 13 13 14 14 14 15 15 15 15 16 16 16 18 18 18 18 6 7 6 8 8 9 9 9 10 10 11 11 12 13 13 13 13 14 14 15 15 15 15 16 16 16 18 18 18 18 17 17 17 17 17 17 17 18 18 18 18 18 18 18 18 18 18 18 18 18 8 8 9 9 10 10 11 11 12 12 13 13 13 13 19 7 8 8 9 9 10 10 11 11 12 12 13 13 13 13 17 17 17 17 14 15 15 15 15 16 16 16 16 17 17 17 17 18 18 18 14 15 15 15 15 16 16 16 16 18 18 18 7 8 8 20 9 9 10 10 6 7 8 8 21 9 9 10 10 6 7 8 8 22 9 9 10 10 6 7 8 8 23 11 11 12 13 13 13 13 8 8 9 9 10 10 6 7 24 11 11 12 12 13 13 13 8 8 9 9 10 10 10 6 25 14 14 15 15 15 15 16 16 16 16 11 11 12 12 13 13 13 13 7 8 8 9 9 9 10 10 26 14 15 15 15 15 16 16 16 16 11 11 11 12 13 13 13 13 7 8 8 9 9 9 10 10 27 14 14 15 15 15 16 16 16 16 11 11 12 13 13 13 13 9 9 10 10 7 8 8 11 11 12 12 13 13 13 9 9 10 10 8 7 9 9 9 10 10 8 6 7 30 9 9 9 10 10 8 6 7 31 6 32 6 33 6 34 18 18 18 18 18 18 17 17 17 17 17 17 17 18 18 18 17 17 17 17 28 9 10 10 10 11 11 12 12 13 13 13 11 11 12 12 13 13 13 13 14 14 15 15 15 16 16 16 16 11 11 12 13 13 13 13 11 11 12 12 13 13 13 13 14 14 15 15 15 16 16 16 16 14 14 15 15 15 16 16 16 16 14 14 14 15 15 15 16 16 16 16 14 14 15 15 15 16 16 16 16 14 14 14 15 15 15 16 16 16 16 14 14 15 15 15 15 16 16 16 16 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 29 11 11 12 12 13 13 13 13 8 8 9 9 9 10 10 8 8 9 9 10 10 7 8 8 7 8 7 37 8 36 7 35 8 38 6 7 39 6 40 8 8 6 41 7 8 8 6 42 8 7 9 9 10 10 8 8 7 9 9 9 10 10 8 8 7 9 9 9 10 10 8 8 7 10 10 8 8 7 10 10 8 8 6 48 10 10 8 6 49 7 6 50 7 6 51 7 6 52 43 6 7 8 8 9 9 10 10 44 45 46 47 16 16 16 16 16 16 16 15 15 15 15 16 16 16 15 15 16 16 16 16 15 15 15 16 16 16 16 17 17 17 17 15 15 15 15 16 16 16 16 17 17 17 18 18 17 17 17 17 17 17 18 14 14 15 15 15 15 16 16 16 16 17 17 17 17 18 18 17 17 17 17 17 18 8 8 8 8 9 9 10 10 17 17 18 18 10 10 9 9 10 10 17 17 17 18 18 18 10 10 9 9 9 10 10 8 8 9 9 10 10 9 9 9 10 10 13 13 13 9 9 10 10 9 9 9 10 10 11 11 11 12 12 13 13 13 13 13 13 13 9 9 10 10 9 9 9 10 10 11 11 11 12 13 13 13 13 12 13 13 13 13 17 17 17 18 18 13 13 13 13 12 12 13 13 13 13 17 17 17 18 18 13 13 13 13 12 12 13 13 13 11 11 12 13 13 13 13 14 14 14 15 15 15 15 16 16 16 12 13 13 13 13 11 11 12 13 13 13 13 14 14 15 15 15 15 16 16 16 16 11 11 12 13 13 13 13 11 11 11 12 12 13 13 13 13 14 14 15 15 15 15 16 16 16 11 11 12 12 13 13 13 13 14 14 14 15 15 15 15 16 16 16 11 11 12 12 13 13 13 14 14 15 15 15 15 16 16 16 16 14 14 14 15 15 15 16 16 16 16 14 14 15 15 15 15 16 16 16 16 11 11 11 12 13 13 13 13 14 14 15 15 15 15 16 16 16 14 14 15 15 15 15 16 16 16 16 17 17 17 17 18 18 18 18 18 18 14 14 15 15 15 15 16 16 16 16 17 17 17 17 18 18 17 17 17 18 18 18 17 17 17 17 18 18 18 17 17 17 17 18 18 18 11 11 12 12 13 13 13 13 14 14 15 15 15 15 16 16 16 16 11 11 12 12 13 13 13 14 14 15 15 15 15 16 16 16 16 16 17 17 17 11 11 12 13 13 13 13 14 14 15 15 15 15 16 16 16 17 17 17 17 11 11 11 12 13 13 13 13 14 15 15 15 15 16 16 16 16 17 17 17 17 14 15 15 15 15 16 16 16 16 17 17 17 17 17 17 17 17 17 17 18 18 18 17 17 17 17 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 16 16 16 16 53 16 16 Fig.2 The detail schedule of all boats obtained by greedy algorithm every period respectively according to the greedy algorithm. This can avoid all boats with same duration be arranged in several concentrate days. Remarks: By using the greedy algorithm, we can give a solution to the problem; however this solution might not be the optimal one. But based on this solution, we can take some measures to improve. By continuous adjusting, we can finally find a satisfied solution. V. CONCLUSION The problem of Camping along the Big Long River is very complex and the solution should be of great openness. In this paper, we formulate this problem into an integer linear programming model and design a greedy algorithm to arrange the schedule of boats. Then by doing some simulations with this algorithm, we give a solution to the problem. The results show that this method can obtain the optimal solution by continuous improving. Furthermore; we can estimate the capacity of the river by this greedy algorithm. Although river trip is quite interesting and exciting, it is also very risky and need some spirit of adventure. Any accident may happen during this process, such as bad weather, passenger’s injuries and so on. These potential factors might have a great impact on the supervisor’s decision and management. We don’t take these factors into account. In the future, we will consider these factors in the model and algorithm. ACKNOWLEDGMENT The author gratefully acknowledges the valuable discussions and comments that Huang qiuai, Chen Qing, Li Tingting and Wang Shan provide for this paper. REFERENCES [1] http://wenku.baidu.com/view/19fab121192e45361066f5e4 .html. [2] Fu Yeqin, “The study of whitewater drifting tourism product development based on tourists experience at Hongkou scenic spots of Dujiangyan City,” master dissertation of Southwest Jiaotong University, 2008, pp. 33–36. [3] Xiang Wenya, Xu Chunxiao, “Analysis of the factors influencing whitewater rafting experience,” vol.3, no.6, pp.56-60, Feb, 2011. [4] Gan Ying’ai, Tian Feng, Li Weizheng, Li Meisheng, Chen Bingzheng, Hu Yunquan, “Operations Research, ” Tsinghua University Press, 2005,6(edition 3), pp. 122-126. [5] Liu Dun, Zhao Jun, Han Dong, Chen Zili, “Model and Algorithm for the Marshalling and Dispatching Problem of Railway Freight Train (in Chinese),” Mathematics in Practice and Theory, vol.39, no.16, pp.162-172, Aug, 2009. [6] Wang Peng, “The study on train operation simulation, Realtime scheduling model and algorithm,” master dissertation of Beijing Jiaotong University, 2010, pp. 9–11. [7] Li Zhuoshi, Wang Hongfang, “A feasible mathematical model for the marshalling and dispatching problem of railway (in Chinese),”Internet Fortune, 2009, 11, pp.92-93 [8] Chen Dedong, You Shuang, Han Binbin, “Algorithm to create and rate sudoku puzzles,” 2008 MCM PRO BLEM B. [9] Chen Hao, XU Liqing, “Greedy algorithm computing minkowski reduced lattice bases with quadratic bit complexity of input vectors,” Chinese Annals of mathematics, 2011, 32B (6). [10] Su Fangfang, Zhang Jinling, “Research on greedy algorithm to solve the activity arrangement (in Chinese),” Software Guide, vol.10, no.12, pp.43-44, Dec, 2011. [11] Liang Li, Chen Yuhua, Xu Min, “Schedule arrangement algorithm based on greedy method (in Chinese),” vol.25, no.3, pp.9-16, May, 2005. [12] Wang Banghai, Li Zhenkun, “Research and implementation of automatic course system based on greedy algorithm,” vol.29, no.18, pp.4843-4846, Sep, 2008.
© Copyright 2026 Paperzz