# Service for Solving Linear Programming Problems

Let good people see good solutions
Русский

## Example №2. Solving the Linear Programming Problem Using the Simplex Method.Finding a Minimum Value of the Function

This solution has been done by the calculator presented on the site.
Problem:

Find the minimum value of the function
 F = - x1 - x2
subject to the constraints: x1 + x2 ≤ 60 2 x1 + x2 ≤ 80 x2 ≤ 20
x1 ≥ 0    x2 ≥ 0

Solution:

1.This is a necessary condition for solving the problem:
the numbers on the right parts of the constraint system must be non-negative.
This condition is done.

2. This is a necessary condition for solving the problem:
all constraints must be equations. x1 + x2 ≤ 60 2 x1 + x2 ≤ 80 x2 ≤ 20 x1 + x2 + S1 = 60 2 x1 + x2 + S2 = 80 x2 + S3 = 20
S1 ≥ 0, S2 ≥ 0, S3 ≥ 0.   The entered variables S1, S2, S3, are called slack variables.

3. Finding the initial basis and the value of the function F which corresponds to the found initial basis.

What is a basis?
A variable is called a basic variable for an equation if it enters into this equation with a coefficient of one and does not enter into other equations system (provided that there is a non-negative number on the right side of the equation).
If each equation has a basic variable, then they say that the system has a basis.
Variables that are not basic are called non-basic.

What is the idea of the simplex method?
Each basis is corresponded to one function value. One of them is the minimum value of the function F.
We will move from one basis to another.
The next basis will be chosen in such a way that the value of the function F will be no more than we have now.
Obviously, the number of possible bases for any problem is not very large.

How will we move from one basis to another?
It is more convenient to record the solution in the form of tables. Each row of the table is equivalent to a system equation. The highlighted row consists of the coefficients of the function (see the table below). This allows us not to rewrite variables every time. It saves time.
In the highlighted row, select a maximum negative coefficient (we can select any negative coefficient).
This is necessary in order to get a value of the function F no more than we have.
Column is selected.
For the positive coefficients of the selected column, we count the coefficient Θ and select the minimum value.
This is necessary in order to get non-negative numbers in the right part of the equations after moving to another basis.
Row is selected.
An element is found that will be basic. Next, we will need to calculate.

Does our system have a basis? x1 + x2 + S1 = 60 2 x1 + x2 + S2 = 80 x2 + S3 = 20
There is a basis in our system. We can begin to solve our problem.
 F = - x1 - x2
Non-basic variables are zero. In the mind, we can find the values of the basic variables. (see system)
Function F contains only non-basic variables. Therefore, the value of the function F for this basis can be found in the mind.
 x1 = 0   x2 = 0   S1 = 60   S2 = 80   S3 = 20 => F = 0
The initial basis was found. The value of the function F corresponding to the initial basis was found.

4. Finding a minimum value of the function F.

Step №1
 x1 x2 S1 S2 S3 const. Θ 1 1 1 0 0 60 60 : 1 = 60 2 1 0 1 0 80 80 : 2 = 40 0 1 0 0 1 20 -1 -1 0 0 0 F - 0 1 1 1 0 0 60 1 1/2 0 1/2 0 40 0 1 0 0 1 20 -1 -1 0 0 0 F - 0 0 1/2 1 -1/2 0 20 1 1/2 0 1/2 0 40 0 1 0 0 1 20 0 -1/2 0 1/2 0 F + 40
Non-basic variables are zero. In the mind, we can find the values of the basic variables. (see table)
Function F contains only non-basic variables. Therefore, the value of the function F for this basis can be found in the mind. (see the highlighted row in the table)
 x2 = 0   S2 = 0   x1 = 40   S1 = 20   S3 = 20 => F + 40 = 0   => F = -40

Step №2
 x1 x2 S1 S2 S3 const. Θ 0 1/2 1 -1/2 0 20 20 : 1/2 = 40 1 1/2 0 1/2 0 40 40 : 1/2 = 80 0 1 0 0 1 20 20 : 1 = 20 0 -1/2 0 1/2 0 F + 40 0 0 1 -1/2 -1/2 10 1 0 0 1/2 -1/2 30 0 1 0 0 1 20 0 0 0 1/2 1/2 F + 50
Non-basic variables are zero. In the mind, we can find the values of the basic variables. (see table)
Function F contains only non-basic variables. Therefore, the value of the function F for this basis can be found in the mind. (see the highlighted row in the table)
 S2 = 0   S3 = 0   x1 = 30   x2 = 20   S1 = 10 => F + 50 = 0   => F = -50
There are not any negative coefficients in the highlighted row. Therefore, the minimum value of the function F was found.
Result:

## Fmin = -50

It is interesting:
At each step, the function value is changed by a value equal to the product of the selected coefficient of the highlighted row by Θmin.
If the numbers allow you to count in the mind, then you can check it yourself.