I'm asked to solve the following optimization problem. So far I've only learned the simplex algorithm and I'm not sure what I'm doing wrong but the Z value only gets worse and never gets better.
The question is:
- A pound of feed A costs 0.4 dollars and a pound of feed B costs 0.8 dollars.
- Bag A provides 800 calories and bag B provides 1000 calories
- Bag A has 140 units of vitamins while bag B has 70
- I must have at least 8000 calories a day
- I must have at least 700 vitamins
- No more then 1/3 of my diet can come from bag A
- Minimize cost
These are what I think the equations should be:
$$ \begin{array}{ll} \min & Z = 0.4A + 0.8B\\ &800A+1000B \ge 8000\\ &140A+70B \ge 700\\ &2A-B\le0 \end{array} $$
First I got problem into standard equality form
I changed minimize to maximize by multiplying -1:
Maximize: Z = -0.4A - 0.8B $\Rightarrow$ Z+0.4A+0.8B = 0
I added a slack variable to the constraints to make them = $$ \begin{array}{ll} &800A+1000B - S_1 = 8000\\ &140A+70B - S_2 = 700\\ &2A-B + S_3 = 0 \end{array} $$
At this point I set up the following tableau
| --- | Z | A | B | S1 | S2 | S3 | RHS | Ratio |
|---|---|---|---|---|---|---|---|---|
| Z | 1 | 0.4 | 0.8 | 0 | 0 | 0 | 0 | ------- |
| S1 | 0 | 800 | 1000 | -1 | 0 | 0 | 8000 | ------- |
| S2 | 0 | 140 | 70 | 0 | -1 | 0 | 700 | ------- |
| S3 | 0 | 2 | -1 | 0 | 0 | 1 | 0 | ------- |
For my entering variable I choose A because Z is larger the smaller (0.4A+0.8B) are so maxing out A is better for that. So I calculate my ratio to determine the leaving variable
| --- | Z | A | B | S1 | S2 | S3 | RHS | Ratio |
|---|---|---|---|---|---|---|---|---|
| Z | 1 | 0.4 | 0.8 | 0 | 0 | 0 | 0 | ------- |
| S1 | 0 | 800 | 1000 | -1 | 0 | 0 | 8000 | 10 |
| S2 | 0 | 140 | 70 | 0 | -1 | 0 | 700 | 5 |
| S3 | 0 | 2 | -1 | 0 | 0 | 1 | 0 | ------- |
So I determine that S2 should be the leaving variable because it has the smallest ratio. perform row operations on that row
| --- | Z | A | B | S1 | S2 | S3 | RHS | Ratio |
|---|---|---|---|---|---|---|---|---|
| Z | 1 | 0.4 | 0.8 | 0 | 0 | 0 | 0 | ------- |
| S1 | 0 | 800 | 1000 | -1 | 0 | 0 | 8000 | --- |
| S2 | 0 | 1 | 0.5 | 0 | -1/140 | 0 | 5 | --- |
| S3 | 0 | 2 | -1 | 0 | 0 | 1 | 0 | ------- |
This is where my understanding fails to perform row operations and eliminate other values in column A I would need to subtract row S2 from them. This leads to a negative Z value since. Since I'm maximizing shouldn't RHS of the Z row only go Up? I'm not sure where I've gone wrong here any help would be appreciated.