You mention the problem with the number of computations with a high number of variables. If it takes too long you could have a look at https://en.wikipedia.org/wiki/Linear_programming problems or rather the variant for integer values (afaik there are also specialized algos for binary integer values which this would be since you either buy it in a phase or don't but it is probably easier to find a solver for the less specialized version) which has algorithms available with good speed for normal cases (the worst case complexity for some special cases is high but I doubt that would apply here). I think it is easy to formulate this as an LP problem and while understanding and implementing an algo would be significant work if you are unfamiliar with them and probably not worth it for this, you could check whether there is a solver available somewhere for js. (For normal LP problems I would find that likely because the simplex algo is taught to many people but I have never looked at the integer variant so dunno about that.)
As for describing this as such a problem I would make each investment combined with each phase an variable. So buying investment K in the first phase is the variable k1, in the second k2. And the related constraints are that they have to be integers in the range from 0 to 1. And that the sum of the variables for the same investment can't be greater than 1 because you can only buy it in one phase. (The thread mentions a variable price investment, I honestly forgot how that worked in the game but if it is just a few discrete values you could give each their own variable.)
Then you need to restrict the spending to available capital, which is easy enough. For the first phase you just have your start capital. So that has to be greater than the sum of the chosen option which is just the sum of the first phase variables * their price, when they are not chosen the variable will be 0 when chosen 1 so the sum works out.
Second phase you still have your start capital on the right side of the equation, keep the costs from the first phase on the left side but substract the gains from the first phase and add the costs from the second. Well guess I don't need to go on.
And the term to maximize is just the sum at the end of the process.
To be honest I have mostly forgotten how it worked in the game (currently doing a new run to remember stuff) so I might be approaching it wrong. But the way I interpret the wiki is that once you bought it you get the noted profit each reward period. if that is right I made an example using python with this library (an example ) though I didn't add all of the investments. https://www.online-python.com/OoudEFfQhB (the online compiler won't execute it since you need to install the lib, just using it for easy sharing.) You can see the output of the current state here https://pastebin.com/qXCwwXQY (If it says "Stineford Weapons Store round 1 = 1" that means it bought Stineford Weapons Store in round 1, =0 means it didn't buy it in that round) Can't guarantee that I screwed nothing up but output looks plausible at first glance. Well that is more work than I originally intended to do.^^