2
$\begingroup$

Sorry about the title. Not sure what to call this question.

I am trying to calculate the lowest total cost of lets say a box, circle and square over n amount of suppliers. Each supplier charges a delivery charge for any order. (Very difficult to explain so here's an example)

Supplier   A       B     C Box        10      7      1 Circle      7      9     11 Square     10      8     12 Delivery    5      6      6 

If I were to order a single box, circle and square from each supplier, the total order would be

Total      32     30     30 

So clearly I would order it from B or C.

However! If I were to order a box from C and the rest from A, then (1 + 6) + (7 + 10 + 5) = 29. So I would be saving myself £1.

The way I figured that out was good ole AAA, BBB, CCC, AAB, AAC, ABC, ACB etc etc and to compare the final result of each selecting the lowest, but I figure there must be a formula out there!?

Some other factors to take into consideration:

  • Delivery is dependent on weight, the heavier the order, the more the delivery charge. so 5kg = £5, 10kg = £10. So it may be that ordering two items from supplier A actually causes double the delivery rate.
  • There may be more than one of an item, for example, 2 circles, 1 box, 3 squares.
  • One supplier might not have all items, for example, supplier C might not have any squares.
  • An item may have to be split over suppliers. For example, you want 10 boxes but each supplier only has 5

Welcome to my nightmare :(

enter image description here Excel File

  • 0
    complex-analysis is a well defined branch of mathematics which deals with functions of complex numbers. Please read the description before choosing to use the tag. Your problem is possibly more algorithmic than "formulaic". Also, the "some other factors" part of the question needs to be made precise before someone can answer your question.2012-04-10
  • 0
    Thanks Henning and Aryabhata2012-04-10
  • 0
    As pointed out by Robert Israel, this is an integer linear programming problem (which is in general NP-hard), but there is very simple $O(2^nnk)$ algorithm: consider every subset of suppliers and calculate minimum for it (and calculating minimum is easy, you just sum the delivery cost of the suppliers in the considered subset and use the cheapest price for every object from available suppliers).2012-04-10

3 Answers 3