image

(Image source: phirschler on Flickr)

Solving another Riddler posted yesterday on FiveThirtyEight.com just for kicks:

A grizzly bear stands in the shallows of a river during salmon spawning season. Precisely once every hour, a fish swims within its reach. The bear can either catch the fish and eat it, or let it swim past to safety. This grizzly is, as many grizzlies are, persnickety. It’ll only eat fish that are at least as big as every fish it ate before.

Each fish weighs some amount, randomly and uniformly distributed between 0 and 1 kilogram. (Each fish’s weight is independent of the others, and the skilled bear can tell how much each weighs just by looking at it.) The bear wants to maximize its intake of salmon, as measured in kilograms. Suppose the bear’s fishing expedition is two hours long. Under what circumstances should it eat the first fish within its reach? What if the expedition is three hours long?

Extra credit: It’s been a while, so let’s offer up a 🏆 Coolest Riddler Extension Award 🏆. Lengthen the expedition, change the bear’s preferences, alter the fish population, or something even more creative. Submit your extension and its solution via the form below. The winner gets a shiny emoji trophy next week.

Roughly here was my approach:

  • In the 2-hour scenario, our bear (let’s call her Betsy) only has 1 choice to make. In the second hour, it’s obvious based on the rules whether she can or cannot eat the fish.
  • It seems there are 2 limits you could place on Betsy’s first choice: either it must be larger than some value X or smaller than some value X to optimize for the second salmon.
  • Only eating salmon larger than some value X doesn’t really make sense. If Betsy eats a small salmon the first hour, this only eliminates the small chance of eating a smaller salmon in the second hour. So always eating a small salmon makes sense. No minimum size limit should be placed.
  • What about the inverse? Avoid large salmon the first hour to make sure Betsy can eat any large fish in the second hour. Running some simulations, this didn’t bear out in the data. The graph below shows the mean fish eaten in kilos if we only eat fish no more than a certain size. The 1.0 case yields the most fish on average, meaning we don’t limit what we eat for the first round.

For a 2-hour fishing session, Betsy should always eat the first salmon regardless of its size. Skipping fish big or small doesn’t improve the average yield.

What about the 3-hour case? I thought there might be something more sophisticated going on where you avoid large fish in the first hour to ensure you can eat in the remaining 2 hours. Or perhaps have a different limit for the first vs second hour. But again, the data didn’t support that. For the 3-hour fishing session, Betsy should still always eat a fish if she can.

Caveat: I wouldn’t be surprised if I’m missing something clever about this problem. I only spent a couple hours noodling on the Python code. I’ll update the post on Friday if I’m right or not!

You can find the code on GitHub here.