filmov
tv
Greedy algorithm to find optimal solution for fractional knapsack problem

Показать описание
Given n objects and knapsack of capacity m.
Each object i has a weight wi and profit pi
The objective is to fill the knapsack to maximum profit
but keep the total wight ≤ m
If a fraction xi , 0 ≤ xi ≥ 1 of object i is placed in into the knapsack,
then the profit of pixi is earned.
Each object i has a weight wi and profit pi
The objective is to fill the knapsack to maximum profit
but keep the total wight ≤ m
If a fraction xi , 0 ≤ xi ≥ 1 of object i is placed in into the knapsack,
then the profit of pixi is earned.