Sorry for the delay, have been busy last week.
Because sometimes it's better to buy more expensive investments with lower percentage returns in order to have less ProN sitting around doing nothing at the end of an iteration, and sometimes it's better to leave the money sitting around instead of buying the only profitable investment you can afford with what you have left so that you can afford an extra investment next iteration that has higher returns than the one you skipped.
Ah, good old local optimum versus global optimum issue.
Not a perfect solution, but I've added a field to tell the algorithm to ignore one or more investments, so the user can explicitly force out investments that might be bad in the middle run even if technically okay in the short run (the Succubus Armorer comes to mind for example).
Though admit I can't use it personally as of yet 🙁 because of assumptions 2 and 5.
My plan for this tool is to first manage to cover all of Chapter 4, then to slowly remove as much assumptions as possible. Some however will certainly have to remain to keep the complexity in check. Not really sure which one exactly yet sadly.
(Carina's men can definitely be saved while satisfying both assumptions though, but it's more of a subject for this thread: https://thelastsovereign.flarum.cloud/d/31-optimization-discussion)