Under linear constraints, a greedy algorithm effectively solves the fractional knapsack problem. However, when additional constraints, such as weight and risk, are added, the complexity of the approach rises. Previous studies have shown that the greedy strategy is optimal under single linear constraints and have provided comprehensive documentation of its efficacy in solving the fractional knapsack problem in straightforward, unconstrained circumstances. Nevertheless, there hasn't been much research done on using greedy algorithms to solve issues with many constraints. This study examines how well genetic algorithms (GAs) perform in comparison to the greedy technique for solving the fractional knapsack problem under conditions with various restrictions. Our results show that, although the greedy method is still efficient in linear or unconstrained circumstances, GAs perform better when dealing with various constraints and provide better solutions in spite of their increased complexity of calculation. This study demonstrates the benefits of using evolutionary algorithms to solve difficult restricted optimization issues when more conventional approaches fall short.
Read full abstract