I have a problem that I am trying to use a solver with a Simplex Linear solving method for. The problem is simple until the last part. See an example of the basic table below, mine is much larger but this example should show the major constraints. I want to create a basket of fruit and want to choose one fruit from each of the different groups.
The problem I am trying to maximize is income and my first constraint is cost. The second constraint is that I can only choose each fruit once. You can see in this example if I just tried to maximize income I could choose apple every time. However apple can’t be chosen every time. The solver works by changing column 1 between 0 and 1. If it is chosen a 1 is selected and if not then a zero. Maximizing income and staying under budget are two easy constraints however I am having a hard time when it comes to making sure that each item can only be selected once. Any ideas on how to best set this solver constraint up?
Here is a basic example of the table. Sorry for the formatting I am slow to understand the table builder.
Pick Group 1 Cost Income
0/1 Apple 10 1000
0/1 Pear 50 60
0/1 Banana 40 60
Group 2
0/1 Apple 10 1000
0/1 Plum 25 30
0/1 Strawberry 30 50
Group 3
0/1 Apple 10 1000
0/1 Raspberry 20 25
0/1 Kiwi 30 40
The problem I am trying to maximize is income and my first constraint is cost. The second constraint is that I can only choose each fruit once. You can see in this example if I just tried to maximize income I could choose apple every time. However apple can’t be chosen every time. The solver works by changing column 1 between 0 and 1. If it is chosen a 1 is selected and if not then a zero. Maximizing income and staying under budget are two easy constraints however I am having a hard time when it comes to making sure that each item can only be selected once. Any ideas on how to best set this solver constraint up?
Here is a basic example of the table. Sorry for the formatting I am slow to understand the table builder.
Pick Group 1 Cost Income
0/1 Apple 10 1000
0/1 Pear 50 60
0/1 Banana 40 60
Group 2
0/1 Apple 10 1000
0/1 Plum 25 30
0/1 Strawberry 30 50
Group 3
0/1 Apple 10 1000
0/1 Raspberry 20 25
0/1 Kiwi 30 40