Path: csiph.com!aioe.org!.POSTED!not-for-mail From: Jim Burns Newsgroups: sci.logic Subject: Re: puzzle: Cross the desert Date: Wed, 10 Feb 2016 21:45:44 -0500 Organization: Aioe.org NNTP Server Lines: 152 Message-ID: <56BBF5D8.8020105@att.net> References: NNTP-Posting-Host: qGtkzLByur+7+qymMLji6g.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com sci.logic:141590 On 2/10/2016 2:00 PM, rdelaney2001@gmail.com wrote: > You are stranded in a desert, at a base station, > looking to get home. There's a rescue truck, > 11 miles away. Along the route, there is a > series of rest stations, one at each mile. > > To make this long trip, you need water. You > have a wagon, which can carry up to 7 liters. > You drink one liter of water during the hike > between each station, forward or backward > > Clearly, you cannot make it in one shot. However, > you may store any quantity of water at the rest > stations. Hence the solution: a series of hikes, > back and forth,dropping and picking up water, until > you ultimately arrive at the rescue point. > > What is the minimum initial quantity of water required, > at the base? > > This case isn't hard, as 11 miles is a short > distance. But imagine it's 20 to the rescue station, > that would be a lot of work! > > Note the problem statement: not merely to find > a procedure to reach safety, but also minimizing > the store of water. So, for a long walk, you > could find an algorithm solution; but how would > you show your algorithm is optimal? I think I have at least the start of an answer. I'll post what I have and see if anyone can improve on it. The thing to focus on is how many times I cross each mile of desert. That is a bare minimum of liter per mile. (And also no more than that should be needed, too.) Starting 1 mile away, getting to safety costs 1 liter. 2 miles away, 2 liters. ... 7 miles away, 7 liters. 8 miles away ... We can only leave base with at most 7 liters, so we will have to leave base twice and return once. That 8th mile gets crossed 3 times, so it costs 3 liters. ... 10 liters. 9 miles away ... The 9th mile gets crossed 3 time also. ... 13 liters. 10 miles away ... We can't leave base with 16 liters on 2 trips, so now we'll need to leave 3 times, and that 10th mile gets crossed 5 times. ... 18 liters. 11 miles away ... Same reasoning as before, only we can't do 23 liters in 3 trips, so now the last (first) mile costs 7 liters. ... 25 liters. Now we're adding 7 liters per mile, and the number of times we need to leave base is mounting rapidly. The example problem you gave is just before things start to get really complicated. Note that this is an argument for a lower bound. At 11 miles away, the needed number of liters is at least 25. I don't have a guarantee that a 25-liter solution exists, but if it did it would be provably a minimum. As it happens, I did find a 25-liter solution for the 11-mile trek -- and that was after I had thought I was so clever in finding a 27-liter solution. I think that I have a general pattern to follow for a minimal solution, guided by how many times I need to cross each patch of ground (which I know because of this argument for a minimum number of liters). Here is the 25-liter solution I found, in an ASCII graphical sort of view. Each '>' and '<' is a mile of desert crossed. The leftmost column is how many bottles I start out from base with. The numbers between the '>' and '<' are the bottles left at each station. 7 > < 5 5 > > < < 3 3 6 > > > > < < < < 1 1 1 1 7 > > > > > > > > > > > :) My goal for each station is to have enough bottles to keep my wagon full for the rest of the trips back and forth. So, on the second to last trip, I want 1 bottle at each station for the final dash across the desert. On the third-to-last, I want 3 bottles for one more back-and-forth and the final dash. If I intend to just pick up a bottle at every mile, any bottles left at a station beyond 1 the second-to-last time and 3 the third-to-last time and so on will just be wasted, so the pattern I follow is to take no more bottles than needed for that goal, and at the stations that I must need to travel to, as indicated by the minimum bounds bounds for miles 1,2,...,11,... As we increase the miles I need to cross in that final dash, the number of bottles that I will try to put at the near stations will be 7, then 9, then 11, and so on, and it will take multiple trips to the first one out. Or so it seem to me. I don't have a proof of the existence of a solution using the minimum liters, but the number of trips to each stations is a good clue to what a minimal solution would look like. The relationship I described above could be described as liters(m) = liters(m-1) + 2*out(m) - 1 7*out(m) >= liters(m) where -- liters(m) is the number of liters to cross back and forth over the miles m to 0, and -- 2*out(m) - 1 is the number of times I cross back and forth over mile m. (Just mile m, not m-1, m-2, ... ) If the base with the water were at mile m I would need to set out at least out(m) times, and the maximum water I could carry would be 7*out(m) . This can be sorted out a bit: 5*out(m) >= liters(m-1) - 1 Because out() is an integer and we are minimizing, we can set out(m).= [ (liters(m-1) - 1)/5 ] where [x] is ceiling(x), the smallest integer >= x . Substituting for trip(m) in the first equation gives liters(m) = liters(m-1) + 2*[(liters(m-1) - 1)/5] - 1 This is a minimum number of liters a solution needs to have. I haven't proved there is always a solution, but I suspect that there is.