Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad


The simplex algorithm, Apuntes de Administración de Empresas

Asignatura: Operations Research, Profesor: Cecilio Mar Molinero, Carrera: Administració i Direcció d'Empreses - Anglès, Universidad: UAB

Tipo: Apuntes

2013/2014

Subido el 18/01/2014

eolina93
eolina93 🇪🇸

3.9

(369)

200 documentos

1 / 7

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
THE SIMPLEX ALGORITHM
I have taken the example from the book by Taha (1971) but the narrative is mine.
A firm manufactures three products. The demand for each product is unlimited, but the
resources available are not. Our data can be found in the following table.
Product 1 Product 2 Product 3 Available
Resource 1 1 2 2 10
Resource 2 2 4 3 15
Profit 3 5 -2
Every time that we sell one unit of the first product we make a profit of 3. Every time
we sell one unit of the second product we make a profit of 5. And every time we sell
one unit of the third product we make a loss of 2. It is clear that we should not consider
selling the third product, but this will be useful in order to explore what happens with
negative numbers in the objective function.
We have two resources in limited amounts, which we could identify with labour and
materials. We have 10 units of the first resource, and 15 units of the second resource.
When we manufacture one unit of the first product we consume 1 unit of the first
resource and 2 units of the second resource. When we manufacture one unit of the
second product we consume 2 units of the first resource and 4 units of the third
resource. Finally, when we manufacture one unit of the third product we consume 2
units of the first resource and 3 units of the second resource.
Our objective is to maximise profit without consuming more resources than we have at
our disposal.
This is the most basic LP problem, and it will help us to develop the SIMPLEX
algorithm. We saw in the previous lecture that in LP we explore the corners of the
convex hull. Another name for a convex hull is a SIMPLEX, and this is what gives its
name to the method we will develop here.
First, I want to share with you some of my ideas on problem formulation.
It is very tempting to start with the objective function and this is what LINGO expects
us to do, but I never proceed that way.
The first step when formulating a problem is to start with the decision variables. These
are the things under our control. In this case, there are three decision variables: the
amount of product 1 to make, x1, the amount of product 2 to make, x2, and the amount
of product 3 to make, x3.
Next, we think in terms of non-negativity constraints. In this case it does not make
sense to produce negative amounts of anything, so our constraints will be:
PAGE 8
pf3
pf4
pf5

Vista previa parcial del texto

¡Descarga The simplex algorithm y más Apuntes en PDF de Administración de Empresas solo en Docsity!

THE SIMPLEX ALGORITHM

I have taken the example from the book by Taha (1971) but the narrative is mine.

A firm manufactures three products. The demand for each product is unlimited, but the resources available are not. Our data can be found in the following table.

Product 1 Product 2 Product 3 Available

Resource 1 1 2 2 10

Resource 2 2 4 3 15

Profit 3 5 -

Every time that we sell one unit of the first product we make a profit of 3. Every time we sell one unit of the second product we make a profit of 5. And every time we sell one unit of the third product we make a loss of 2. It is clear that we should not consider selling the third product, but this will be useful in order to explore what happens with negative numbers in the objective function.

We have two resources in limited amounts, which we could identify with labour and materials. We have 10 units of the first resource, and 15 units of the second resource.

When we manufacture one unit of the first product we consume 1 unit of the first resource and 2 units of the second resource. When we manufacture one unit of the second product we consume 2 units of the first resource and 4 units of the third resource. Finally, when we manufacture one unit of the third product we consume 2 units of the first resource and 3 units of the second resource.

Our objective is to maximise profit without consuming more resources than we have at our disposal.

This is the most basic LP problem, and it will help us to develop the SIMPLEX algorithm. We saw in the previous lecture that in LP we explore the corners of the convex hull. Another name for a convex hull is a SIMPLEX, and this is what gives its name to the method we will develop here.

First, I want to share with you some of my ideas on problem formulation.

It is very tempting to start with the objective function and this is what LINGO expects us to do, but I never proceed that way.

The first step when formulating a problem is to start with the decision variables. These are the things under our control. In this case, there are three decision variables: the amount of product 1 to make, x1, the amount of product 2 to make, x (^) 2, and the amount of product 3 to make, x3.

Next, we think in terms of non-negativity constraints. In this case it does not make sense to produce negative amounts of anything, so our constraints will be:

In LP we normally expect our variables to satisfy the non-negativity constraints, but this is not always the case. For example, in Finance we may lend (positive amount) or borrow (negative amount). We could have a decision variable to capture the amount we lend and another decision variable to capture the amount we borrow, in which case they would just be positive. But we can have one single value that will either take a positive or a negative value depending on whether we lend or we borrow. LINGO automatically assumes that all the decision variables are non-negative. If you have decision variables that are “free” in sign, you must tell the program. The instruction in lingo is @FREE(variable_name); We saw an example of an LP with free variables.

Having thought about the variables and their signs, we move on to thinking about the constraints. It is good practice to explain what is going on with each constraint as we introduce them. If we do this, whoever reads our work will be able to follow our logic. Do not expect people to follow your logic just from reading the equations. Not everybody is mathematically minded, and most of us would like to be taken step by step through the formulation.

We, therefore, introduce the constraints in our model. Production is constrained by the amount of resources we have. Since we have two resources, there are two constraints.

We cannot use more of resource 1 than what we have available, although we can use less. This is written mathematically as:

There is also a limited amount of resource 2, which will generate a similar equation:

At this stage I have not written the slack variables, but sometimes the slack variables are associated with a cost or a benefit and enter the objective function. This is why I always leave the objective function until the last moment. In this case there is nothing to worry about slack variables, so I can formulate the objective directly.

I will now write the complete formulation in a compact form:

There is an even more compact way of formulating this problem, using matrix algebra:

The matrix formulation will be needed when dealing with duality, something to be studied later.

Now we concentrate on solving the problem, rather than on talking about it. Remember what we have learned previously.

  1. That solving LP problems is nothing else than solving systems of equations.
  2. (^) That we have developed a systematic way of solving systems of equations, which is so systematic that it can be taught to a machine.
  3. That the solution of an LP problem will be found in a corner of the convex hull, also named SIMPLEX.

The easiest system of equations to solve is xo, S1, S2 different from zero, all other (x (^) 1, x (^) 2, and x3) equal to zero. This says that we do not sell the first product, we do not sell the second product, and we do not sell the third product. This is not a very sensible strategy but it can be done, it is a feasible solution. The system of equations collapses to:

We can see the solution directly: if we sell nothing, we have 10 units slack in the first resource, 15 units slack in the second resource, and we do not make any profit.

Rather than produce reduced versions of the system of equations, I am going to write in red the variables that are assumed to take the value zero. I will also write the system of equations in the form of a table, or tableau. To remind myself which variables are non- zero, I add a column named “basis”. The value of the variables in the basis column can be found under the column headed “solution”. The variables that are not listed under the column “basis” take the value zero. This is never to be forgotten.

Basis X 0 X 1 X 2 X 3 S 1 S 2 Solution

X 0 1 -3 -5 2 0 0 0 E

S 1 0 1 2 2 1 0 10 E

S 2 0 2 4 3 0 1 15 E

As said above, the columns that I have written in red are associated with variables that take the value zero. If we ignore the red part we have a system of three equations with three unknowns. We see that the variables that are non-zero are associated with a unit matrix: in each column there is a single 1, all other values being zero. The same happens in the rows.

The current solution is not very good. We will now look for an improvement. We will return to the objective function.

I do not know how to add colours in the equation processor, but all three variables (x1, x2, and x3) take the value zero. Remember that we are contemplating not to produce anything! What happens if one of these variables increases in one unit?

If x 1 changes from 0 to 1, x 0 increases in 3 units. If x 2 changes from 0 to 1, x 0 increases in 5 units. If x 3 changes from 0 to 1, x 0 decreases in 2 units. In this equation positive signs are associated with increases and negative signs are associated with decreases. But if we write the system of equations with variables on one side and numbers on the other, the signs change:

This is the equation that I have written in the first row of the tableau. I can now proclaim the “optimality condition”. If I am looking for improvements, I look through the coefficients of the first row of the tableau (ignoring the coefficient of x 0 which will always be 1), any negative number will be associated with an improvement in the solution, and any positive number will be associated with a worsening in the solution.

If we apply the optimality condition we see that it is better to manufacture product 1 than not to manufacture it (per unit improvement is 3), that it is better to manufacture product 2 than not to do it (per unit improvement is 5), and that it is worst to manufacture product 3 than not to do it (per unit loss is 2).

When we apply SIMPLEX we take one thing at a time. Here there are two promising decisions: to manufacture product 1, and to manufacture product 2. But at every step we only introduce one new variable. We choose either to manufacture product 1 or to manufacture product 2. A short-sighted, or “greedy” policy would be to go for product 2, since it gives the highest per unit improvement, although the total improvement depends on the number of units and not only on the per unit improvement. Since we are lazy, we go for the easy option and say that we will consider manufacturing product 2 because it is associated with the largest negative value in the top row of the tableau. In mathematical terms, our decision is equivalent to saying that x 2 will be different from zero. It loses the red colour in our equations. Ignoring the variables that took a value zero and will continue to take a value zero, the system of equations now reads:

Not everything is rosy. What about Dantzig? Dantzig’s theorem only allowed us three non-zero variables (if we count x0) and the above system contains four non-zero variables. We have one variable too many. Either S 1 or S 2 will have to take the value zero. Which one?

Think. The second equation says that the value of x 2 increases (we manufacture more

product 2), the slack in the first process decreases (we use more resource and have less to spare). Since manufacturing the second product is a good thing, we are prepared to manufacture as much as we can, i.e., until we drive the slack S 1 to zero. We see that if we set S 1 to zero, x 2 can increase up to 10/2. But if x 2 becomes 5 we see in the third

equation that S 2 has to be negative: we do not have enough of the second resource to manufacture 5 units of the second product.

Consider now the third equation. This tells us that if we increase the value of x (^) 2, we have to decrease the value of S2. The maximum increase in x 2 that the third equation allows takes place when S 2 is zero, in which case x2 is equal to 15/4. The third equation is more restrictive than the second one. The second equation would allow us to increase production of the second product to 10/2, while the third equation only allows a production of 15/4, which is less. We bend to circumstances and accept that the maximum amount of product 2 that can be produced is 15/4, and that this is done by reducing slack in the second process to zero.

This takes us to the “feasibility condition”: divide the numbers on the solution column by the numbers on the column of the variable that becomes non-zero, the variable to leave the solution is the one associated with the smallest positive ratio. Negative ratios are to be ignored. A little thought will make you see that they are not constraints.

S 2 becomes zero, leaves the basis (because we only have non-zero valued variables in the basis), and is replaced by x2. I have also changed the red colours that indicate which variables are no longer taking part in the solution.

Our employer may be unhappy, she will say that if we do not manufacture the second product, we will lose market share to the competitors. But we are now in a condition to tell her the cost of taking the less than optimal decision of producing one unit of product

  1. To do this, we write the equations in an algebraic form.

Basis X 0 X 1 X 2 X 3 S 1 S 2 Solution

X 0 1 0 1 13/2 0 1/4 90/4 E7 = E4+(1/2) E

S 1 0 0 0 1/2 1 -1/2 5/2 E8 = E

X 1 0 1 2 3/2 0 1/2 15/2 E9 = 2 E

Right now, x 2 is zero. If x 2 was equal to 1, there would be 1 in the objective function that would move to the left hand side with a negative sign, making the profit decline by 1 unit. We also see, in the third equation, that if x2 was to increase to 1, x1 would have to decrease by 2 units.

This is the SIMPLEX algorithm in its most elementary form.

Exercise (from Taha)

Use simplex to solve the following problem:

Another exercise (from Daellenbach and Bell, 1970)

A firm makes two types of furniture: posh, and tatty. There are various processes that need to be followed in order to make the furniture: cutting, gluing, sanding, y varnishing. The details are in the following table:

Furniture cut glue sand varnish Unit profit Posh 0,2 1 1/3 8/3 15 Tatty 0,6 1,5 1 2 15 Capacity 8 15 8 32

Formulate the problema, make a graphical representation, and solve it using SIMPLEX.