Solving the Fractional Knapsack Problem - Wave and Thinking

  • Topic:
  • Thread starter evinda
  • Start date
  • Tags Tags
    fractional
1 reply · 2K views · last reply
evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! (Wave)

I found the following algorithm for the fractional knapsack problem.

Pseudocode for the fractional knapsack algorithm, with input S, n and W, and output array X of amounts per item; the else branch sets X[i] to (W-w)/S[i].weight then breaks.
Why at the case else, we do not change the variable w to w+(W-w)/S.weight? (Thinking)
 
evinda said:
Why at the case else, we do not change the variable w to w+(W-w)/S.weight?
That would be adding a dimensionless number to pounds.