1

Let's assume I have 3 different baskets with a fixed capacity

And n-products which provide different value for each basket -- you can only pick whole products

Each product should be limited to a max amount (i.e. you can maximal pick product A 5 times)

Every product adds at least 0 or more value to all baskets and come in all kinds of variations

Now I want a list with all possible combinations of products fitting in the baskets ordered by accuracy (like basket 1 is 5% more full would be 5% less accurate)

Edit: Example
Basket A capacity 100
Basket B capacity 80
Basket C capacity 30

fake products
Product 1 (A: 5, B: 10, C: 1)
Product 2 (A: 20 B: 0, C: 0)
There might be hundreds more products

Best fit with max 5 each would be
5 times Product 1
4 times Product 2

Result
A: 105
B: 50
C: 5
Accuracy: (qty_used / max_qty) * 100 = (160 / 210) * 100 = 76.190%

Next would be another combination with less accuracy

Any pointing in the right direction is highly appreciated Thanks

Edit:
instead of above method, accuracy should be as error and the list should be in ascending order of error.

Error(Basket x) = (|max_qty(x) - qty_used(x)| / max_qty(x)) * 100

and the overall error should be the weighted average of the errors of all baskets.

Total Error = [Σ (Error(x) * max_qty(x))] / [Σ (max_qty(x))]

Skeec
  • 125
  • 9
  • 2
    If you show some own efforts and clear example, you'll have more chance for an answer – MBo Oct 24 '18 at 04:31
  • Well I tried to make it clear enough what particularly don't you understand? I think it might be multiple objective knapsack problem but I'm not 100% sure could also be bin packaging problem – Skeec Oct 24 '18 at 07:46
  • It just want to help to make this quesion more "answerable". Show example like: `{apple; qty:5 pcs; valuesforbaskets: [2, 3, 1]...}` – MBo Oct 24 '18 at 07:59
  • Added example yeah you could totally make objects or arrays – Skeec Oct 24 '18 at 08:06
  • In the Accuracy part, i can see that 100 is the multiplier for converting into percentage and 210 is the max amount (100+80+30), is 155 supposed to be 160 (105+50+5)? –  Oct 24 '18 at 12:06
  • Also, if you take 5 of product 2 instead of 4, your accuracy will be 85.714% which is closer to 100 compared to the current 76.190% (Complying to your method of calculating accuracy, which I highly doubt is correct). –  Oct 24 '18 at 12:18
  • somehow the markup ripped the example apart – Skeec Oct 24 '18 at 23:23
  • also A: 105 should not count as max is only 100 so you can just say it's 160 just 155 – Skeec Oct 24 '18 at 23:31
  • Are you saying that we can overfill the baskets and it will not count as error? It will just be ignored? or are we not allowed to overfill a basket (which will contradict the example)? –  Oct 25 '18 at 06:14
  • Overfilling will be less accurate 105 will count like 95 so every delta in any direction will be less accurate – Skeec Oct 25 '18 at 11:07

0 Answers0