'Genetic Algorithm on modified knapsack problem
Let’s say, you are going to spend a month in the wilderness. The only thing you are carrying is a backpack that can hold a maximum weight of 40 kg. Now you have different survival items, each having its own “Survival Points” (which are given for each item in the table). Some of the items are so essential that if you do not take them, you incur some additional penalty. Here is the table giving details about each item. Item Weight Survival Value Penalty if not taken: Sleeping Bag 30 20 0,
Rope 10 10 0, Bottle 5 20 0, Torch+Battery 15 25 -20, Glucose 5 30 0, Pocket Knife 10 15 -10, Umbrella 20 10 0 .Formulate this as a genetic algorithm problem where your objective is to maximize the survival points. Write how you would represent the chromosomes, fitness function, crossover, mutation, etc.
I am not sure about what would be the fitness function. A simple fitness function that I thought of is just simply adding the survival points of the weights that we want to take and subtracting the penalties of the weights that we don't want to take. But by doing this the overall value of the fitness function for a particular gene can be negative as well.
Please tell me how should I proceed further and what should be an appropriate fitness function in this case.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
