Skip to content

Commit d753806

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2ea31ba commit d753806

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

knapsack/knapsack_branch_and_bound.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ def calculate_bound(node: Node, capacity: int, items: List[Item]) -> float:
4848

4949
if index < len(items):
5050
profit_bound += (
51-
(capacity - total_weight)
52-
* items[index].value
53-
/ items[index].weight
51+
(capacity - total_weight) * items[index].value / items[index].weight
5452
)
5553

5654
return profit_bound
@@ -122,8 +120,4 @@ def knapsack_branch_and_bound(
122120
weights_example = [10, 20, 30]
123121
values_example = [60, 100, 120]
124122

125-
print(
126-
knapsack_branch_and_bound(
127-
capacity_example, weights_example, values_example
128-
)
129-
)
123+
print(knapsack_branch_and_bound(capacity_example, weights_example, values_example))

0 commit comments

Comments
 (0)