Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.logic > #141588 > unrolled thread
| Started by | rdelaney2001@gmail.com |
|---|---|
| First post | 2016-02-10 11:00 -0800 |
| Last post | 2016-02-11 17:02 +0000 |
| Articles | 6 — 3 participants |
Back to article view | Back to sci.logic
puzzle: Cross the desert rdelaney2001@gmail.com - 2016-02-10 11:00 -0800
Re: puzzle: Cross the desert Jim Burns <james.g.burns@att.net> - 2016-02-10 21:45 -0500
Re: puzzle: Cross the desert Jim Burns <james.g.burns@att.net> - 2016-02-11 11:13 -0500
Re: puzzle: Cross the desert Justin Thyme <JustinThyme@nowhere.com> - 2016-02-11 16:44 +0000
Re: puzzle: Cross the desert Justin Thyme <JustinThyme@nowhere.com> - 2016-02-11 16:59 +0000
Re: puzzle: Cross the desert Justin Thyme <JustinThyme@nowhere.com> - 2016-02-11 17:02 +0000
| From | rdelaney2001@gmail.com |
|---|---|
| Date | 2016-02-10 11:00 -0800 |
| Subject | puzzle: Cross the desert |
| Message-ID | <e46eb715-2ac3-4f34-89c7-a2606d7a57a8@googlegroups.com> |
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? -- Rich
[toc] | [next] | [standalone]
| From | Jim Burns <james.g.burns@att.net> |
|---|---|
| Date | 2016-02-10 21:45 -0500 |
| Subject | Re: puzzle: Cross the desert |
| Message-ID | <56BBF5D8.8020105@att.net> |
| In reply to | #141588 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Jim Burns <james.g.burns@att.net> |
|---|---|
| Date | 2016-02-11 11:13 -0500 |
| Subject | Re: puzzle: Cross the desert |
| Message-ID | <56BCB32E.6070904@att.net> |
| In reply to | #141588 |
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?
Yesterday, I gave what seems to me to be a good start
on answering your question.
<https://groups.google.com/d/msg/sci.logic/rp_4tkC_AKE/ddKFWYSPEwAJ>
I wrote out a recursive relationship for how much water
is _necessary_ to cross m miles of desert.[1]
After thinking a bit more, I have convinced myself that
the minimal solution that I gave for crossing 11 miles
of desert generalizes (using instructions that are pretty
obvious in hindsight).[2]
If I'm right, the _necessary_ number of liters is also a
_possible_ number of liters, the recursive relation I gave
is the number of liters needed, and the instructions tell
how to distribute them. That would be most of what you ask for.
The last part of your question, proving my solution is optimal,
depends upon me defining my terms properly, I think, and
I haven't done that. A good part of the proof is done if I
can show I have an optimal process for a task like:
Your base is at mile marker 20. Optimally place 97 liters
of water at mile marker 19. Then, continue with the
optimal process for a base at mile marker 19, picking
up a bottle from that station as you pass through in
either direction.
It seems obvious to me that the optimal process for this
sub-task is:
Load up with 7 bottles, walk a mile out, drop off 5 bottles,
walk a mile back. Repeat. The last time, load up with
4 bottles and drop off 2.
I calculated the minimum water necessary to cross m miles
by reducing it to the problem of crossing that first mile some
number of times and the problem of crossing the m-1 miles
left. As you see, my instructions for distributing the
water follows the same pattern, so I don't expect a snag
to appear.
----
[1]
The rescue truck is at mile 0, and the rest stations are at
miles 1, 2, 3, ... , m-1 . If the base with all the water is at
mile m, what is minimum amount of water needed to cross m miles?
WATER(m) = the minimum water needed to cross m miles, with the
base at mile m
cross(m) = the number of times I cross mile m to mile m-1
or mile m-1 to mile m
WATER(m) = WATER(m-1) + cross(m)
If the base is at mile m, and I leave the base some number of
times, LEAVE(m), optimally distributing and using water, the
most water I could take is 7*LEAVE(m) . That cannot be less than
the water needed to cross m miles.
7*LEAVE(m) >= WATER(m)
(I need to add an obvious constraint. I will pass through
each rest station at least once, on my way to the rescue truck.
When I left that out, my formula came out wrong at miles 1 and 2.)
LEAVE(m) >= 1
Every time I leave the base, I return, except for the last time,
so the number of times I cross ( m, m-1) is
cross(m) = 2*LEAVE(m) - 1
After a bit of sorting out,
LEAVE(m) = max( 1, ceiling((WATER(m-1) - 1)/5) )
WATER(m) = WATER(m-1) + 2*LEAVE(m) - 1
WATER(0) = 0
miles water leave
0 0
1 1 1
2 2 1
3 3 1
4 4 1
5 5 1
6 6 1
7 7 1
8 10 2
9 13 2
10 18 3
11 25 4
12 34 5
13 47 7
14 66 10
15 91 13
16 126 18
17 175 25
18 244 35
19 341 49
20 476 68
----
[2]
I see I don't have my instructions perfectly written down,
(Note lines with '(?)') but it's pretty close. It should be
obvious what needs to be done at each step. I just haven't
thought out what tests could be done to decide whether I am
at that step or not.
Giving instructions for distributing the water is easiest if we
count back from the last trip, which crosses all the way to
the rescue truck, trip = 0, _preceded_ by a trip that stops about
7 miles from the truck and turns back, trip = 1, and so on.
(I notice 'trip' is the number of trips left.)
Each trip has a goal, the number of bottles water that I want
to see at each rest station that I come to. If the rest station
has more, I take a bottle and go on. If it has too few, I leave
whatever bottles I can, keeping enough to return to base.
(The number I keep should always be 1 bottle, because I should
have previously stashed enough bottles in the higher-mileage
rest stops.)
The goal gets smaller for every trip, because the number of times
I will need to pass through and take a bottle gets smaller for
every trip.
goal(0) = 0
goal(trip) = 2*trip - 1
Consider the 20-mile solution:
trip = 67, goal = 133
load 7
walk to 19
cache(19) = 0 < goal = 133
then drop 5 and go back
walk to 20
trip = 66, goal = 131
load 7
walk to 19
cache(19) = 5 < goal = 131
then drop 5 and go back
walk to 20
...
trip = 48, goal = 95
load 7
walk to 19
cache(19) = 95 = goal = 95
then take 1 and go forward
walk to 18
cache(18) = 0 < goal = 95
then drop 5 and go back
walk to 19, take 1
walk to 20
trip = 47, goal = 93
load 7
walk to 19
cache(19) = 93 = goal = 93
then take 1 and go forward
walk to 18
cache(18) = 5 < goal = 93
then drop 5 and go back
walk to 19, take 1
walk to 20
...
trip = 1, goal = 1
load 7
walk to 19
cache(19) = 3 > goal = 1
then take 1 and go forward
walk to 18
cache(18) = 3 > goal = 1
then take 1 and go forward
...
walk to 10
cache(10) = 3 > goal = 1
then take 1 and go forward
walk to 9
cache(9) = 0 < goal = 1
then drop 1 and go _forward_ (?)
walk to 8
cache(8) = 0 < goal = 1
then drop 1 and go back
walk to 9, take 1
walk to 10, take 1
...
walk to 20
trip = 0, goal = 0
load 7
walk to 19
cache(19) = 1 > goal = 0
then take 1 and go forward
walk to 18
cache(18) = 1 > goal = 0
then take 1 and go forward
walk to 17
cache(17) = 1 > goal = 0
then take 1 and go forward
...
walk to 7
cache(7) = 0 = goal = 0
then _don't_ take 1 and go forward (?)
...
walk to 0
start rescue truck. Keys!
slap forehead.
[toc] | [prev] | [next] | [standalone]
| From | Justin Thyme <JustinThyme@nowhere.com> |
|---|---|
| Date | 2016-02-11 16:44 +0000 |
| Message-ID | <n9idpm$ms0$1@news.albasani.net> |
| In reply to | #141588 |
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 Nathan Fine solved this problem. I'll see if I can find a reference. > > 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? > > -- > Rich > -- Nam Nguyen: *As we speak*, MS and NN would understand what "blue" would mean. Martin Shobe: No I don't. You could mean the color, the feeling, or given your past history, something entirely different. Nam Nguyen: Go and get fucked. sci.logic 24/10/2015
[toc] | [prev] | [next] | [standalone]
| From | Justin Thyme <JustinThyme@nowhere.com> |
|---|---|
| Date | 2016-02-11 16:59 +0000 |
| Message-ID | <n9iekp$o0i$1@news.albasani.net> |
| In reply to | #141612 |
Justin Thyme wrote: > 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 > > Nathan Fine solved this problem. I'll see if I can find a reference. 'The jeep problem', American Mathematical Monthly, vol 54, 1947 -- Nam Nguyen: *As we speak*, MS and NN would understand what "blue" would mean. Martin Shobe: No I don't. You could mean the color, the feeling, or given your past history, something entirely different. Nam Nguyen: Go and get fucked. sci.logic 24/10/2015
[toc] | [prev] | [next] | [standalone]
| From | Justin Thyme <JustinThyme@nowhere.com> |
|---|---|
| Date | 2016-02-11 17:02 +0000 |
| Message-ID | <n9ieqr$o0i$2@news.albasani.net> |
| In reply to | #141588 |
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. See http://www.gutenberg.us/articles/Jeep_problem for example. -- Nam Nguyen: *As we speak*, MS and NN would understand what "blue" would mean. Martin Shobe: No I don't. You could mean the color, the feeling, or given your past history, something entirely different. Nam Nguyen: Go and get fucked. sci.logic 24/10/2015
[toc] | [prev] | [standalone]
Back to top | Article view | sci.logic
csiph-web