I wrote a small module in python for get all the possibilities of x products that fit into y total cost. The module runs fine, but slow. It takes about six hours to calculate six products up to 30 iterations of each product. So, I was thinking of rewriting the script in FORTRAN and see if I can’t milk out some better speed. Unfortunately, I’m new to FORTRAN, and don’t now most of the libraries and so on.
Is there a similar module/function to python’s itertools.combinations_with_replacement(pool, r) in FORTRAN, or module that accomplishes the same thing?
Don’t do that. You are trying to do micro-optimization when you need to be doing algorithmic optimization. This is why I argued you should not use the exponential-time solution based on itertools, but a better, recursive solution.