Created
November 27, 2017 17:18
-
-
Save NicolleLouis/6faa8156645da6e3308e5e9272b22770 to your computer and use it in GitHub Desktop.
Fitness Knapsack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fitness(individual, item_set): | |
Knapsack_Capacity = round(total_weight_of_item_set(item_set) / 2) | |
result = 0 | |
if (weight_of_individual(individual, item_set) <= Knapsack_Capacity): | |
result = 2 * value_of_individual(individual, item_set) - weight_of_individual(individual, item_set) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment