http://qs321.pair.com?node_id=726127


in reply to How can I calculate the right combination of postage stamps?

Basically, this is very similar to a bin packing problem. Your fitness test is the minimum amount over the postage required, and your termination test is greater than or equal to the amount of postage required. Very commonly solved with a recursive or stack-based solution.

IIRC, with the exception of pruning paths once they reach the required postage, the only way to get all solutions is really brute-force. If you are satisfied with the first solution found, then you can trim that somewhat. This is, I believe, your classical NP-Complete problem, which, without some assumptions, is only solvable by brute force.

Very enjoyable (meaning interesting :-) post and problem, BTW.

--MidLifeXis

  • Comment on Re: How can I calculate the right combination of postage stamps?