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 = -3x1Β + x2Β – 2x3
Subject to x1Β + 3x2Β + x3Β β€ 5
2x1Β β x2Β + x3Β β₯ 2
4x1Β + 3x2Β – 2x3Β = 5
x1, x2, x3Β β₯ 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 S1.
- Constraint 2: It has a sign “β₯” (greater than or equal) so the excess variable S2 will be subtracted and the artificial variable A1 will be added.
- Constraint 3: It has an “=” sign (equal) so the artificial variable A2 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 = 0X1 + 0X2 + 0X3 + 0S1 + 0S2 + 1A1 + 1A2
Subject to:
1X1 + 3X2 + 1X3 + 1S1 + 0S2 + 0A1 + 0A2 = 5
2X1 – 1X2 + 1X3 + 0S1 – 1S2 + 1A1 + 0A2 = 2
4X1 + 3X2 – 2X3 + 0S1 + 0S2 + 0A1 + 1A2 = 5
X1, X2, X3, S1, S2, A1, A2 β₯ 0
Initial Table – Phase I
Table 1 | Cj | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
---|---|---|---|---|---|---|---|---|---|
Cb | Base | X1 | X2 | X3 | S1 | S2 | A1 | A2 | R |
0 | S1 | 1 | 3 | 1 | 1 | 0 | 0 | 0 | 5 |
1 | A1 | 2 | -1 | 1 | 0 | -1 | 1 | 0 | 2 |
1 | A2 | 4 | 3 | -2 | 0 | 0 | 0 | 1 | 5 |
Z | 6 | 2 | -1 | 0 | -1 | 0 | 0 | 7 |
Enter the variable X1 and the variable A1 leaves the base. The pivot element is 2
Iteration 1
Table 2 | Cj | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
---|---|---|---|---|---|---|---|---|---|
Cb | Base | X1 | X2 | X3 | S1 | S2 | A1 | A2 | R |
0 | S1 | 0 | 7/2 | 1/2 | 1 | 1/2 | -1/2 | 0 | 4 |
0 | X1 | 1 | -1/2 | 1/2 | 0 | -1/2 | 1/2 | 0 | 1 |
1 | A2 | 0 | 5 | -4 | 0 | 2 | -2 | 1 | 1 |
Z | 0 | 5 | -4 | 0 | 2 | -3 | 0 | 1 |
Enter the variable X2 and the variable A2 leaves the base. The pivot element is 5
Iteration 2
Table 3 | Cj | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
---|---|---|---|---|---|---|---|---|---|
Cb | Base | X1 | X2 | X3 | S1 | S2 | A1 | A2 | R |
0 | S1 | 0 | 0 | 33/10 | 1 | -9/10 | 9/10 | -7/10 | 33/10 |
0 | X1 | 1 | 0 | 1/10 | 0 | -3/10 | 3/10 | 1/10 | 11/10 |
0 | X2 | 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 | Cj | -3 | 1 | -2 | 0 | 0 | |
---|---|---|---|---|---|---|---|
Cb | Base | X1 | X2 | X3 | S1 | S2 | R |
0 | S1 | 0 | 0 | 33/10 | 1 | -9/10 | 33/10 |
-3 | X1 | 1 | 0 | 1/10 | 0 | -3/10 | 11/10 |
1 | X2 | 0 | 1 | -4/5 | 0 | 2/5 | 1/5 |
Z | 0 | 0 | 9/10 | 0 | 13/10 | -31/10 |
Enter the variable S2 and the variable X2 leaves the base. The pivot element is 2/5
Iteration 1
Table 2 | Cj | -3 | 1 | -2 | 0 | 0 | |
---|---|---|---|---|---|---|---|
Cb | Base | X1 | X2 | X3 | S1 | S2 | R |
0 | S1 | 0 | 9/4 | 3/2 | 1 | 0 | 15/4 |
-3 | X1 | 1 | 3/4 | -1/2 | 0 | 0 | 5/4 |
0 | S2 | 0 | 5/2 | -2 | 0 | 1 | 1/2 |
Z | 0 | -13/4 | 7/2 | 0 | 0 | -15/4 |
Enter the variable X3 and the variable S1 leaves the base. The pivot element is 3/2
Iteration 2
Table 3 | Cj | -3 | 1 | -2 | 0 | 0 | |
---|---|---|---|---|---|---|---|
Cb | Base | X1 | X2 | X3 | S1 | S2 | R |
-2 | X3 | 0 | 3/2 | 1 | 2/3 | 0 | 5/2 |
-3 | X1 | 1 | 3/2 | 0 | 1/3 | 0 | 5/2 |
0 | S2 | 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
X1= 5/2, X2= 0, X3= 5/2, S1= 0, S2= 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.