Roblox interview question

Optimize Factories - maximize the output while minimizing cost