The right system of equations to solve the cheapest route problem

27 Views Asked by At

I have 1 hour to go 10km. I can go by taxi (30km/h) or walk (5km/h). I'm cheap, so I want to pay as little as possible for the taxi. I'm willing to drive the minimum distance and walk the rest to be on time.

  • x is the distance I go by taxi
  • y is the distance I walk

How do I find x and y values for the minimum possible x?

I came up with 2 equations:

  • sum of distances is 10km
  • sum of times of the trips is 1 hour

$$ \left\{ \begin{array}{c} x + y = 10 \\ x / 30 + y / 5 = 1 \\ \end{array} \right. $$

This solution, however, gives only one possible x and y it is not clear if this is the optimal solution. Is this the correct approach or I'm missing something?

1

There are 1 best solutions below

1
On BEST ANSWER

I think you may be feeling some unease that your equations aren't obviously minimizing $x$ (the distance travelled by taxi).

As written, your second equation is asserting that you will arrive at the destination in exactly one hour. If it ended with "$\le 1$" instead of "$= 1$" then you would admit solutions that had you arriving early, and there are obviously several of these: the taxi could go the whole way in 20 minutes, or it can drop you off at an earlier point. Of course, if it drops you off too early then you will be late, which we don't want.

From the structure of the problem, what you're trying to find is the earliest point that the taxi can drop you off, such that you will still be on time. This solution will be unique. To see that, note that if you had any time left over at all from the one-hour journey, that would not be the best solution, since the taxi could have stopped a little bit earlier. So in fact your "$=1$" is the right thing to say, and this is the place where the optimization is lurking.