Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualEmergent

Posted 30 October 2012 - 07:03 PM

Combine solving the traveling salesman problem with the knapsack problem and you have two NP-hard problems -- at the same time. Don't be fixated on getting "the right answer". You won't. However, you can get something that is reasonable.


Do we know that traveling salesman and/or knapsack can be reduced to the poster's problem? I don't think we've established that the problem is NP-hard. In fact, I don't think we've committed to a particular problem statement at all.

Also: For a very long time, I have been inclined to dismiss NP-hard problems as unsolvable and move directly to heuristics or stochastic search (my current favorite is the cross-entropy method). But there is a middle ground: Many np-hard problems can be solved to within "epsilon" in polynomial time -- and some algorithms that can have exponential complexity practically never do (e.g., simplex algorithm). I'm developing a newfound respect for the Operations Research guys.

The linear programming approach looks suitable for this problem. I don't have much experience with LP though. I hope you will post again if you think of more.
With this solution, will it be possible to present the user with a production plan for each of his orders, that he can inspect (and possibly cancel)?
The production plan would be: "Produce x items a, y items b" and so on.


Sure, that's what's the flows represent. If you were to cancel production partway through, you'd be left with whatever quantities flow into the nodes corresponding to that timestep.

Let me play with this a little and see what I can do.

Also, when the user changes an order to 3 instead of 2 products, it would be really nice if the computer could continue where it left off with the previous solution instead of starting over, and thereby save tons of computation. This would give real-time responsiveness and make the game a lot more fun.


You can "warm start" most solvers with an old solution to a similar problem.

#1Emergent

Posted 30 October 2012 - 06:54 PM

Combine solving the traveling salesman problem with the knapsack problem and you have two NP-hard problems -- at the same time. Don't be fixated on getting "the right answer". You won't. However, you can get something that is reasonable.


Do we know that traveling salesman and/or knapsack can be reduced to the poster's problem? I don't think we've established that the problem is NP-hard. In fact, I don't think we've committed to a particular problem statement at all.

Also: For a very long time, I have been inclined to dismiss NP-hard problems as unsolvable and move directly to heuristics or stochastic search (my current favorite is the cross-entropy method). But there is a middle ground: Many np-hard problems can be solved to within "epsilon" in polynomial time -- and some algorithms that <em>can</em> have exponential complexity practically never do (e.g., simplex algorithm). I'm developing a newfound respect for the Operations Research guys.

The linear programming approach looks suitable for this problem. I don't have much experience with LP though. I hope you will post again if you think of more.
With this solution, will it be possible to present the user with a production plan for each of his orders, that he can inspect (and possibly cancel)?
The production plan would be: "Produce x items a, y items b" and so on.


Sure, that's what's the flows represent. If you were to cancel production partway through, you'd be left with whatever quantities flow into the nodes corresponding to that timestep.

Let me play with this a little and see what I can do.

PARTNERS