I was recently watching a video game "speedrunner", who was trying to earn $1 billion of in-game currency in the shortest possible time.
He identified 3 different actions ($a$, $b$ and $c$) he could perform to generate money. The total $ value generated by (repeatedly) performing these actions was:
$$ x_{total}=n_{a}x_{0}\prod_{i=1}^{n_{c}}n_{b}[i] $$
where:
- $x_0=\$25000$ is a known constant.
- $n_a$ is the number of repetitions of action $a$.
- $n_c$ is the number of repetitions of action $c$.
- $n_b[i]$ is the number of repetitions of action $b$ associated with the $i^{th}$ repetition of action $c$.
The corresponding time cost was:
$$ t_{total}=n_{a}t_{a}+\left( \sum_{i=1}^{n_{c}}n_{b}[i]\right)t_{b}+n_{c}t_{c} $$
where $t_a = 52\text{ secs}$, $t_b = 18\text{ secs}$ and $t_c = 600\text{ secs}$ were the known times consumed (per repetition) by actions $a$, $b$ and $c$.
So, the goal was to find the integers $n_a$, $\{n_b\}$ and $n_c$ that minimize $t_{total}$, subject to the requirement that $x_{total} \geq \$1,000,000,000$.
After several minutes of trial and error, the "speedrunner" and his viewers found that $n_a = 7$, $\{n_b\} = \{18, 18, 18\}$ and $n_c = 3$ yielded $x_{total} \approx \$1.02 \text{ billion}$ and $t_{total} \approx 52.3 \text{ minutes}$. This seemed to be difficult to beat, but how can I find the optimal solution?
Some googling led me to a topic called "integer programming", but I couldn't figure out if it was applicable to this problem.
If a numerical/programmatic method is required, then:
- I would prefer to avoid brute force, if possible.
- I would like to understand how the method works, not just feed my parameters into a software package.