-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (23 loc) · 695 Bytes
/
main.py
File metadata and controls
30 lines (23 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
File: .py
Author: AlexString
Description:
Algorithm that simply implements the knapsack problem with maximum and minimum weight criterion.
"""
from KnapSack import KnapSack
from Strategy import MinStrategy, MaxStrategy, MaxValueStrategy
def Main():
# VALUES HERE
knapSack_MaximumWeight = 100
items_weight = [10,20,30,40,50]
items_values = [20,30,66,40,60]
# Printing items data
print("Items weight:")
print(items_weight)
print("\nItems values:")
print(items_values)
print("\n")
# You can switch between using MinStrategy / MaxStrategy / MaxValueStrategy
knapSack = KnapSack(MaxValueStrategy())
knapSack.execute(knapSack_MaximumWeight, items_weight, items_values)
Main()