Skip to content

Commit

Permalink
Merge pull request #19 from Stefan-Haas/main
Browse files Browse the repository at this point in the history
fix issue where split_idx is incorrect if all projects are feasible
  • Loading branch information
Simon-Rey authored Mar 24, 2024
2 parents 9b53ce6 + 3bebe02 commit ea689a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pabutools/rules/maxwelfare.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ def primal_dual_branch(items: list[KnapsackItem], capacity: float):
for i, item in enumerate(items):
tmp_capacity -= item.weight
split_idx = i
if split_idx == len(items) - 1 and tmp_capacity >= 0:
split_idx += 1

if tmp_capacity < 0:
break

Expand Down

0 comments on commit ea689a8

Please sign in to comment.