Skip to content

Instantly share code, notes, and snippets.

@hectorpefo
Created August 8, 2016 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hectorpefo/2de28d28229e488126db99a9ea8ebc74 to your computer and use it in GitHub Desktop.
Save hectorpefo/2de28d28229e488126db99a9ea8ebc74 to your computer and use it in GitHub Desktop.
Bear Salmon Riddler
First the intuitive case. Passing up on the first fish won't turn out to have been a win if the second fish is bigger, because she could have eaten both. And if the second is smaller, if the bear passed up on the first, she's eating a smaller fish than she would have if she had eaten the first. So, whether the second fish is bigger or smaller than the first, the bear will be glad she ate the first.
For three fish: If the second fish is bigger than the first, then she gets to eat both and will be glad she did, whether the third fish is smaller or bigger still. If the second fish is smaller than the first, though, there is a chance that the third will be in between them in size, and that together, the second and third will weigh more than the first, in which case she'd have done better passing on the first. So for three fish there is no ``dominance" style argument (no choice invariably leads to the best outcome), and the numbers matter.
In the two-fish case, Let the first fish $A$ weigh $a$ and the second, $B$, weigh $b$. If grizzly $G$ passes up $A$, she expects to get the expected weight of $B$, which is $1/2$ kg, of fish. If she eats $A$, she expects $a$ plus an additional amount equal to the chance that $b\geq a$ (which is $1-a$) times the expected value of $b$ given that $b\geq a$ (which is $(1+a)/2$). So her two-fish expectation is $a+ (1-a^2)/2$. Thus she should pass on $A$ if $a + (1-a^2)/2 \leq 1/2$, or $2a+1-a^2\leq 1$, or $2a-a^2 \leq 0$ or $a\geq2$. Thus, she should always eat the first fish.
With a third fish, $C$, in view, if $G$ passes up $A$, she should eat $B$ no matter what it weighs, as we've seen, and so her expectation is that of a two-fish scenario:
\[E_{3P} = E_{2} = \int_{b=0}^1 \left(b + \frac{1-b^2}{2}\right) db\]
\[=\bigg[_{b=0}^1 \frac{b^2}{2}+\frac{b}{2} - \frac{b^3}{6}\bigg]
=\frac{5}{6}
\]
And if she eats $A$, her expectation ($E_{3E}$) is $a$ plus two quantities, corresponding to whether $b<a$, in which case she's effectively in a two-fish scenario with $A$ and $C$, or $b\geq a$, in which case she's got (in addition to $a$) the expectation of a two-fish scenario with $B$ and $C$. The first is the probability that $b < a$ (which is $a$) times the expected consumed weight of the second fish in a two-fish scenario where the first fish weighs $a$ (which is $(1-a^2)/2$). The second is the same as the above integral except over the interval $[a,1]$. The total expectation if she eats $A$, then, is:
\[E_{3E} = a + \frac{a(1-a^2)}{2} + \bigg[_{b=a}^1 \frac{b^2}{2}+\frac{b}{2} - \frac{b^3}{6}\bigg]\]
\[= a + \frac{a}{2} - \frac{a^3}{2} + \frac{5}{6} - \left(\frac{a^2}{2}+\frac{a}{2} - \frac{a^3}{6}\right)\]
\[ = \frac{5}{6} + a - \frac{a^2}{2} - \frac{a^3}{3}\]
Passing up $A$ makes sense when $E_{3P} > E_{3E}$:
\[\frac{5}{6} > \frac{5}{6} + a - \frac{a^2}{2} - \frac{a^3}{3}\]
\[ 0 > a - \frac{a^2}{2} - \frac{a^3}{3}\]
\[ 0 > 1 - \frac{a}{2} - \frac{a^2}{3}\]
\[2a^2 + 3a -6 > 0\]
But this is never true for $a<1$. So eat the fish already!
The expectation in the three-fish case, assuming $G$ does eat $A$, is:
\[E_3 =\int_{a=0}^{1} \left(\frac{5}{6} + a - \frac{a^2}{2} - \frac{a^3}{3}\right) da \]
\[=\bigg[_{a=0}^1 \frac{5a}{6} +\frac{a^2}{2} - \frac{a^3}{6} -\frac{a^4}{12}\bigg] = \frac{13}{12}\]
That's the same as $E_{4P}$, the expectation, in a four-fish case, of what $G$ will get if she passes up $A$. If she eats $A$, she expects $a$ plus two quantities (as before). The first is $a$ times the expectation, minus $a$, of a three-fish scenario starting with $A$. The second is the integral immediately above, except over the interval $[a,1]$:
\[E_{4E} = a +
\left(\frac{5a}{6} - \frac{a^3}{2} - \frac{a^4}{3}\right) +
\bigg[_{b=a}^1 \frac{5b}{6} +\frac{b^2}{2} - \frac{b^3}{6} -\frac{b^4}{12}\bigg] \]
\[=\frac{13}{12} + a - \frac{a^2}{2} - \frac{a^3}{3} - \frac{a^4}{4}\]
$E_{4E}$ is less than $13/12$ when:
\[12 - 6a - 4a^2 - 3a^3 <0 \]
which occurs when $a \geq .955$ (call that threshold $T_4$; $T_2$ and $T_3$ are each $1$). So $G$ shouldn't eat the first of four fish if it's so big that it blocks his chances of multiple smaller fish.
The expectation for the four-fish scenario, assuming that the persnickety $G$ chooses wisely, is:
\[E_4 = .045\times \frac{13}{12} + \int_{a=0}^{.955} \left(\frac{13}{12} + a - \frac{a^2}{2} - \frac{a^3}{3} - \frac{a^4}{4}\right) \approx 1.285\]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment