Find the optimal solution in linear programming exercises with our **Simplex Method Online Calculator**, which will allow you to develop maximization and minimization problems with the normal method and applying the two-phase method when appropriate. Our tool has a friendly and easy-to-use design. It also shows us all the intermediate steps that are needed to reach the final solution, which will facilitate your learning.

## How to use the simplex method online calculator

To use our tool you must perform the following steps:

- Enter the number of variables and constraints of the problem.
- Select the type of problem:
**maximize**or**minimize**. - Enter the coefficients in the objective function and the constraints. You can enter negative numbers, fractions, and decimals (with point).
- Click on “Solve”.
- The online software will adapt the entered values ββto the standard form of the
**simplex algorithm**and create the first**tableau**. - Depending on the sign of the constraints, the normal
**simplex algorithm**or the**two-phase method**is used. - We can see step by step the
**iterations**and**tableaus**of the simplex method calculator. - In the last part will show the results of the problem.

We have considered for our application to solve problems with a maximum of 20 variables and 50 restrictions; this is because exercises with a greater number of variables would make it difficult to follow the steps using the simplex method. For problems with more variables, we recommend using other more advanced tools.

### Solving an exercise with the Simplex Method Calculator – Two Phase

**Minimize **z = -3x_{1}Β + x_{2}Β – 2x_{3}

**Subject to** x_{1}Β + 3x_{2}Β + x_{3}Β β€ 5

2x_{1}Β β x_{2}Β + x_{3}Β β₯ 2

4x_{1}Β + 3x_{2}Β – 2x_{3}Β = 5

x_{1}, x_{2}, x_{3}Β β₯ 0

#### Solution

We put the number of variables and restrictions in the form:

We select the type of problem and enter the coefficients of the objective function and the constraints:

Finally, we click on “Solve” and we will see the adaptation of the problem to the standard form and the iterations of the simplex table with the algorithm of the two-phase method. For this example, the explanation would be:

The problem will be adapted to the standard linear programming model, adding the slack, excess and / or artificial variables in each of the constraints:

**Constraint 1:**It has a sign “β€” (less than or equal) so the slack variable will be added S_{1}.**Constraint 2:**It has a sign “β₯” (greater than or equal) so the excess variable S_{2}will be subtracted and the artificial variable A_{1}will be added.**Constraint 3:**It has an “=” sign (equal) so the artificial variable A_{2}will be added.

The problem has artificial variables, so we will use the **two-phase method**. In the first phase, the objective function seeks to **minimize the sum of the artificial variables**.

The problem is shown below in standard form. The coefficient 0 (zero) will be placed where it corresponds to create our table:

#### Objective Function:

Minimize: Z = 0X_{1} + 0X_{2} + 0X_{3} + 0S_{1} + 0S_{2} + 1A_{1} + 1A_{2}

#### Subject to:

1X_{1} + 3X_{2} + 1X_{3} + 1S_{1} + 0S_{2} + 0A_{1} + 0A_{2} = 5

2X_{1} – 1X_{2} + 1X_{3} + 0S_{1} – 1S_{2} + 1A_{1} + 0A_{2} = 2

4X_{1} + 3X_{2} – 2X_{3} + 0S_{1} + 0S_{2} + 0A_{1} + 1A_{2} = 5

X_{1}, X_{2}, X_{3}, S_{1}, S_{2}, A_{1}, A_{2} β₯ 0

#### Initial Table – Phase I

Table 1 | C_{j} |
0 | 0 | 0 | 0 | 0 | 1 | 1 | |
---|---|---|---|---|---|---|---|---|---|

C_{b} |
Base | X_{1} |
X_{2} |
X_{3} |
S_{1} |
S_{2} |
A_{1} |
A_{2} |
R |

0 | S_{1} |
1 | 3 | 1 | 1 | 0 | 0 | 0 | 5 |

1 | A_{1} |
2 | -1 | 1 | 0 | -1 | 1 | 0 | 2 |

1 | A_{2} |
4 | 3 | -2 | 0 | 0 | 0 | 1 | 5 |

Z | 6 | 2 | -1 | 0 | -1 | 0 | 0 | 7 |

Enter the variable **X _{1}** and the variable

**A**leaves the base. The pivot element is

_{1}**2**

#### Iteration 1

Table 2 | C_{j} |
0 | 0 | 0 | 0 | 0 | 1 | 1 | |
---|---|---|---|---|---|---|---|---|---|

C_{b} |
Base | X_{1} |
X_{2} |
X_{3} |
S_{1} |
S_{2} |
A_{1} |
A_{2} |
R |

0 | S_{1} |
0 | 7/2 | 1/2 | 1 | 1/2 | -1/2 | 0 | 4 |

0 | X_{1} |
1 | -1/2 | 1/2 | 0 | -1/2 | 1/2 | 0 | 1 |

1 | A_{2} |
0 | 5 | -4 | 0 | 2 | -2 | 1 | 1 |

Z | 0 | 5 | -4 | 0 | 2 | -3 | 0 | 1 |

Enter the variable **X _{2}** and the variable

**A**leaves the base. The pivot element is

_{2}**5**

#### Iteration 2

Table 3 | C_{j} |
0 | 0 | 0 | 0 | 0 | 1 | 1 | |
---|---|---|---|---|---|---|---|---|---|

C_{b} |
Base | X_{1} |
X_{2} |
X_{3} |
S_{1} |
S_{2} |
A_{1} |
A_{2} |
R |

0 | S_{1} |
0 | 0 | 33/10 | 1 | -9/10 | 9/10 | -7/10 | 33/10 |

0 | X_{1} |
1 | 0 | 1/10 | 0 | -3/10 | 3/10 | 1/10 | 11/10 |

0 | X_{2} |
0 | 1 | -4/5 | 0 | 2/5 | -2/5 | 1/5 | 1/5 |

Z | 0 | 0 | 0 | 0 | 0 | -1 | -1 | 0 |

The iterations of the first phase are finished and there is some possible solution to the problem. We eliminate the artificial variables and go to the second phase:

#### Initial Table – Phase II

Table 1 | C_{j} |
-3 | 1 | -2 | 0 | 0 | |
---|---|---|---|---|---|---|---|

C_{b} |
Base | X_{1} |
X_{2} |
X_{3} |
S_{1} |
S_{2} |
R |

0 | S_{1} |
0 | 0 | 33/10 | 1 | -9/10 | 33/10 |

-3 | X_{1} |
1 | 0 | 1/10 | 0 | -3/10 | 11/10 |

1 | X_{2} |
0 | 1 | -4/5 | 0 | 2/5 | 1/5 |

Z | 0 | 0 | 9/10 | 0 | 13/10 | -31/10 |

Enter the variable **S _{2}** and the variable

**X**leaves the base. The pivot element is

_{2}**2/5**

#### Iteration 1

Table 2 | C_{j} |
-3 | 1 | -2 | 0 | 0 | |
---|---|---|---|---|---|---|---|

C_{b} |
Base | X_{1} |
X_{2} |
X_{3} |
S_{1} |
S_{2} |
R |

0 | S_{1} |
0 | 9/4 | 3/2 | 1 | 0 | 15/4 |

-3 | X_{1} |
1 | 3/4 | -1/2 | 0 | 0 | 5/4 |

0 | S_{2} |
0 | 5/2 | -2 | 0 | 1 | 1/2 |

Z | 0 | -13/4 | 7/2 | 0 | 0 | -15/4 |

Enter the variable **X _{3}** and the variable

**S**leaves the base. The pivot element is

_{1}**3/2**

#### Iteration 2

Table 3 | C_{j} |
-3 | 1 | -2 | 0 | 0 | |
---|---|---|---|---|---|---|---|

C_{b} |
Base | X_{1} |
X_{2} |
X_{3} |
S_{1} |
S_{2} |
R |

-2 | X_{3} |
0 | 3/2 | 1 | 2/3 | 0 | 5/2 |

-3 | X_{1} |
1 | 3/2 | 0 | 1/3 | 0 | 5/2 |

0 | S_{2} |
0 | 11/2 | 0 | 4/3 | 1 | 11/2 |

Z | 0 | -17/2 | 0 | -7/3 | 0 | -25/2 |

The optimal solution is Z = -25/2

X_{1}= 5/2, X_{2}= 0, X_{3}= 5/2, S_{1}= 0, S_{2}= 11/2

## Final reflection

You must remember the objective of this tool is the learning of the simplex method and the application of the **two-phase method**, so the use that you can give it is only under your responsibility. Also, we are not responsible for any errors or inaccuracies in the results.

If you have questions about it or find an error in our application, we will appreciate if you can write to us on our contact page.