# Algorithm for cheapest order

• Dec 7th 2012, 06:57 AM
chriswaller
Algorithm for cheapest order
I have a problem in which I have people ordering different goods from my website and I have a number of suppliers who provide these goods, but I need an algorithm to find the cheapest combination of supplies from each supplier. It would seem easiest to just see which company offers the product at the lowest price, but I need to take into account that it may be cheaper delivery if I order from as few people as possible, and also that not every supplier will offer every product.

Does anybody know a good algorithm for working this out or have any advice on the problem? Any help would be very much appreciated, no matter how small.
• Dec 16th 2012, 05:29 PM
Wilmer
Re: Algorithm for cheapest order
Post an example...
• Dec 17th 2012, 03:31 AM
chriswaller
Re: Algorithm for cheapest order
Ok, here is an example:

I have three suppliers: Company A, B and C. There are 3 products I want to order, A, B and C, which I order in various quantities. Not all the companies offer all the products. I want to order all the products at minimal cost, but because each company charges fixed delivery costs regardless of what is ordered, it is not as simple as ordering each individual product from the supplier that offers it at the cheapest price, as it may be cheaper to order it all from one supplier and save on delivery.

My question is this: how do I make it so I can work out the cheapest combination of orders from different suppliers and then apply this to arbitrarily many products and arbitrarily many suppliers? Below is an example using some costs and order quantities, which serves as an example.

Any help would be greatly appreciated, even if it is just to point me in the right direction.

 Company A Company B Company C Quantity Product A £0.85 £0.90 £0.95 4 Product B £1.20 - £1.10 7 Product C - £0.60 £0.55 3 Delivery £4.50 £5.50 £5.00