79431032

Date: 2025-02-11 18:51:24
Score: 1
Natty:
Report link

This is slightly more detailed than the comment by m.raynal.
First, to simplify the solution, divide the constraint by 2, i.e., you have 8X1 + 3X2 + 2X3 <= 12. Then for each weight W, W = 0 to 12, item i, i = 1 to 3, determine the maximum objective value f(i,W). This is the maximum of (a) if item i is not increased by 1 and (b) if i is increased by 1, at stage W. Then determine f(W) = max( f(1,W), f(2,W), f(3,W) ). The formula for f(i,W) = max( f(W-1), Vi + f(W-Wi) ), where Vi is value of item i and Wi is the weight of item i.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Mehran Hojati