Quote Originally Posted by RoboTact
It's linear programming optimization problem. Note that all given limitations are just linear inequalities imposed on a number of cost/time variables. You need only to create a system containing all those limitations and solve optimization problem, maximizing profit.
I was said it doesn't have optimal solution and best is to use some heuristics, maybe let's say 3 levels of prediction and always choose the best way. I don't think there is some easy way to construct system of inequations for linear programming task and whether it would even help...