#sudhakaratchala #daavideos #daaplaylist
We are having ‘n’ objects and a knapsack or a bag in which the object ‘i’ has weight ‘wi’ is to be placed. And the knapsack has capacity ‘M’.
The profit pixi can be earned, if an object ‘i’ has to be placed into the knapsack.
The objective of the knapsack problem is to fill the knapsack with maximum profitable objects and the sum of the weights of the object is lessthan or equal to the capacity of the knapsack. That is
Maximize ∑2_(𝑖=0)^𝑛▒"pixi"
Purging rule (or) Dominance rule
If Si+1 contains (pj, wj) and (pk, wk) two pairs such that (pj ≤ pk ) and (wj ≥ wk)
then (pj, wj) pair can be eliminated. This purging rule is also called "dominance rule”.
In purging rule basically the dominated tuples get purged that is remove the pair with less profit and more weight.
The formula for solving the problem is
Si+1 = Si U S1i