With the third idea, you have the following steps of Greedy Three. The algorithm will select (package 1, package 2) with a total value of 26, while the optimal solution of the problem is (package 3) with a total value of 28.The packages: -> Light weight but the value is also very light.The parameters of the problem are: n = 3 M = 19.However, this greedy algorithm does not always give the optimal solution. In turn consider the ordered packages, put the considering package into knapsack if the remaining capacity of the knapsack is enough to contain it (which means that the total weight of the packages that have been put into the knapsack and weight of considering packages do not exceed the capacity of the knapsack).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |