You are on page 1of 50

MÉTODOS DE

OPTIMIZACIÓN
EN LA GESTIÓN
EMPRESARIAL
Enrique Parra Iglesias
Prof. Titular de Fundamentos de Análisis Económico. UAH
Ex Director de Control de Gestión. CEPSA
Consultor.

Enrique.Parra@uah.es
Programación lineal (PL)
GRAPHICAL SOLUTION OF LINEAR PROGRAMMING

A MAXIMIZATION EXAMPLE
Example: Shoe Making

A shoemaker specializing in quality handmade shoes wants to allocate time between


production of men's and women's shoes. Each pair of women's shoes takes four hours to
produce, whereas a men's pair requires only three hours.

The shoemaker is prepared to work no more than 40 hours per week.

The shoes are made with a very high-quality leather, but this is available only in limited
quantities of no more than 3 square meters (m2 ) per week. The amount of leather
used in producing a pair of shoes is 0.2 m2 for women's shoes and 0.3 m2 for men's.

Men's shoes can be sold for a profit of $34 per pair, while women's shoes return $36
per pair. How many pairs of men's shoes and how many pairs of women's shoes should be
produced each week if the shoemaker wishes to make the highest possible profit?

Métodos de optimización. E.Parra 2


Programación lineal (PL)
Before graphing this problem we must summarize it mathematically. Here, the decision
variables or activities are the numbers of men's and women's shoes.

The variable W is the number of pairs of women's shoes produced in a week, and M is the
weekly production of pairs of men's shoes.

The objective is to maximize weekly profit (P).

It is necessary to specify separately the contributions of each decision variable to total


weekly profit.

Total profit attributable to women's shoes is $36 times the number of pairs of women's
shoes produced: 36 x W. The contribution of men's shoes to weekly profit is $34 per
pair, so the total is $34 X M. Mathematically, the objective is to maximize P, where

P = 36W + 34M

Métodos de optimización. E.Parra 3


Programación lineal (PL)
This equation is referred to as the objective function. The objective function calculates
the level of the factor that is to be minimized or maximized. For any levels of the factor
that is to be minimized or maximized. For any levels of W and M, this equation calculates
the corresponding value of P.

There are two constraints facing the shoemaker: the amount of time each pair of shoes
takes to produce and the amount of leather each pair requires.

If there are W pairs of women's shoes produced in a week, women's shoes require a total of
4 X W hours per week. For example, if the shoemaker makes five pairs of women's
shoes, each requiring four hours of labor, the total time spent making women's shoes is 4 X
5 = 20 hours. Two pairs of women's shoes require a total of 4 X 2 = 8 hours. In general,
W shoes require a total of 4 x W hours.

Similarly, women's shoes use up 0.2 m2 of leather, so the total leather requirement of
women's shoes is 0.2 X W m 2 . Men's shoes, on the other hand, have total requirements for
3 X M hours of labor and 0.3 x M m2 of leather per week.

Remember that the total time worked on both types of shoe per week cannot exceed 40 hours.

Métodos de optimización. E.Parra 4


Programación lineal (PL)
Mathematically, this can be represented as

4W + 3M ≤ 40

In a similar way, the total usage of leather for women's shoes plus the total usage of leather
for men's shoes cannot exceed 3 m2 per week, so:

0.2W + 0.3 M ≤ 3

These constraints are called inequalities, because they can be true even if the left-hand
sides are not equal to the right-hand sides. Finally, there is a set of constraints that applies
to all LP problems: the variables cannot take negative values:

W ≥ 0; M≥ 0

This requirement may seem obvious, as you clearly cannot produce a negative number of
shoes, but it is essential to bear in mind because in some problems it is not self-evident.

Métodos de optimización. E.Parra 5


Programación lineal (PL)
In summary, Example can be stated as:

Maximize

P = 36W + 34M

subject to

4W + 3M ≤ 40
0.2W + 0.3M ≤ 3
w ≥ 0; M≥0

Métodos de optimización. E.Parra 6


Programación lineal (PL)
Finding an LP solution graphically consists of two stages: finding the set of feasible
solutions, and identifying the best of them.

A feasible solution is one that satisfies all the constraints of the problem.

Start by graphing the non-negativity constraints that limit the solution to positive
values of W and M.

These constraints require that the optimal combination of men's and women's
shoes must be one of the shaded points in Figure 1.

The shaded region includes the W and M axes.

Métodos de optimización. E.Parra 7


Programación lineal (PL)

Figure 1

Métodos de optimización. E.Parra 8


Programación lineal (PL)
Now consider the time constraint. First graph the combinations of women's
and men's shoes that would require a combined total of exactly 40 hours of labor.
These are the points for which the constraint is satisfied as an equality rather than as
the inequality originally specified. The equality is

4W + 3M = 40

which is the equation for a straight line. We will graph this line without limiting the
graph to whole numbers of shoes. This is most easily done by finding the points at
which the line intersects the axes and joining them with a straight line.

To find the intersection with the W axis, set M equal to zero and solve for W:

4W = 40

So W= 10

Similarly, to find where the line intersects the M axis, set W equal to zero:
3M = 40, so M = 13.33

Métodos de optimización. E.Parra 9


Programación lineal (PL)

Figure 2

Métodos de optimización. E.Parra 10


Programación lineal (PL)
Figure 2 shows the line segment that connects these
two points. It also
shows that above the line

4W + 3M > 40

while below the line

4W + 3M < 40

It is easy to verify that this is true.

Pick any point that is not on the line, determine the


values of W and M, and then calculate 4W + 3M.
The origin (where W = 0 and M = 0) is often
convenient for this purpose (as long as it is not on
the line):

(4 x 0) + (3 x 0) = 0

Métodos de optimización. E.Parra 11


Programación lineal (PL)
The result is less than 40, so all points on the
same side of the constraint as the origin have
labor requirements less than 40, while all
points on the other side of the line require
more than 40 hours of labor.

The reason for doing this is to identify the set


of points that satisfy the labor constraint

4W + 3M ≤ 40

The feasible points for this constraint include


the line and all points below it or to the left.

The set of potential solutions that satisfy this


time constraint as well as the non-negativity
constraints is shown as the shaded region in
Figure 3.

Métodos de optimización. E.Parra 12


Programación lineal (PL)
In a graph of a linear equation
(such as 4W + 3M = 40) it is
always true that for all points on
one side of the line, the left-hand
side of the equation is less than
the right-hand side, and that the
reverse is true on the other side of
the line.

This means that it is only necessary


to test one point to determine
which is the less-than side and Figura 3
which is the greater-than side.

Métodos de optimización. E.Parra 13


Programación lineal (PL)
We can graph the leather constraint in a similar way, giving
Figure 4.

Figure 4

Métodos de optimización. E.Parra 14


Programación lineal (PL)
Now we are interested in the feasible set of points: points where all constraints are
satisfied. Some points that satisfy the time constraint do not satisfy the leather
constraint, and some that satisfy the leather constraint require too much time. The
feasible region for all constraints is the shaded region in Figure 5. It includes the
shaded area and the lines that border it.

Figure 5

Métodos de optimización. E.Parra 15


Programación lineal (PL)
The feasible region has the following
comer points: (W, M) = (0, 0), (10, 0),
(0, 10), (5, 6.67). (The values of W
and M at the last of these points are
found by calculating where the two (5 ; 6,67)
constraints intersect.)

4W + 3M = 40 (1)
0.2W + 0.3M = 3 (2)

4W + 3M = 40 (1)
2W + 3M = 30 (2’)

(1) - (2’): 2W = 10 , W = 5

M = (40 – 4W) / 3 = 20/3

M = 6,67

Métodos de optimización. E.Parra 16


Programación lineal (PL)
Now identify which of the points in this
feasible region is best; which gives the
highest value for profit (P):

P = 36W + 34M
(0 ; 5,55)

If P is set at a particular value, we can


graph all combinations of W and M
that result in that level of profit.

Start by examining a profit level of $200


( 5,88 ; 0 )
per week. Figure 6 shows the feasible
region together with the line

36W + 34M = 200

Same method as with the constarints:


W=0 ; M= 200/34 = 5,88
M=0; W= 200/36 = 5,55

Métodos de optimización. E.Parra 17


Programación lineal (PL)

(0 ; 5,55)

( 5,88 ; 0 )

Figure 6

Métodos de optimización. E.Parra 18


Programación lineal (PL)
Any point on the dashed line Figure 6
corresponds to a weekly profit of $200
and any shaded point is a feasible
solution. The section of the dashed line
that passes through the feasible region
identifies combinations of W and M
that are feasible and result in $200
weekly profit.

Clearly it is feasible for the shoemaker


to make $200 per week, and it can be
done in a number of ways.

However $200 is not the highest profit


that can be made.

¿Would be possible profit $300 ?

Métodos de optimización. E.Parra 19


Programación lineal (PL)
Well:
Figure 7
36W + 34M = 300
W=0 then M = 8,8
M=0 then W= 8,3

Figure 7 shows the line

36W + 34M = 300

which reveals that there are a


number of feasible solutions
giving $300 per week profit.
Notice that the new objective
function is parallel to the old
one, but has been moved
upward and to the right.

Métodos de optimización. E.Parra 20


Programación lineal (PL)
By repeatedly adjusting the profit value and redrawing the objective function we can
identify the highest profit value for which there is at least one feasible solution
(Figure 8).

Figure 8

Métodos de optimización. E.Parra 21


Programación lineal (PL)
The slope of the line depends only on the coefficients of W and M (36 and 34, in this
case). For this reason, when drawing objective function lines for different values of total
profit, the slope is always the same.

As you increase the profit value, the objective function moves in parallel upward and to
the right.

The optimal solution is at one of the corners to the feasible region.

The shoemaker should produce 5 pairs of women's shoes and 6.67 pairs of men's shoes
per week. (You can interpret the fractional part of the men's shoes as having a pair of
shoes partly finished).

The highest weekly profit that can be made is $406.67, which can be calculated as

($36 x 5) + ($34 x 6.6667) = $406.67

Métodos de optimización. E.Parra 22


Programación lineal (PL)
It is clear from this graphical approach that the optimal solution will always be on the
boundary of the feasible region

¡THIS IS VALID ONLY IN LINEAR PROGRAMMING!

The profit achievable at any point within the shaded region can always be bettered by
drawing a higher line that just touches the boundary (i.e., a line that is a "tangent" to
the boundary).

Métodos de optimización. E.Parra 23


Programación lineal (PL)
Most commonly the optimal solution will be a single comer point.

The only exception to this will be where the objective function is exactly parallel to
one of the constraints that forms part of the boundary of the feasible region.

In this case all points along this segment of the boundary will be equally good.

Another principle is that the optimal solution depends on the slope of the
objective function.

This slope is determined by the ratio of objective function coefficients (i.e., profits in
this case) of the two activities. If the activities‘ profits were both halved or both
doubled, the optimal solution would not change.

Métodos de optimización. E.Parra 24


Programación lineal (PL)
On the other hand, if we halved returns from women's shoes only, the optimal
solution would change.

Figure 9 shows the optimal solution for this scenario.

Figure 9

Métodos de optimización. E.Parra 25


Programación lineal (PL)
Reducing the price of women's shoes
reduces the slope of the objective function
line.

As a result, adjusting the profit Figure and


redrawing the objective function identifies a
different optimal solution. The highest
attainable profit would now be reduced to
$340 per week, and to achieve that the
shoemaker would have to produce 10 pairs
of men's shoes and no women's shoes.

If the shoemaker were to persist in


producing 5 pairs of women's shoes and
6.67 men's, profits would be reduced by an
even greater amount. The new profit would
be
($18 x 5) + ($34 x 6.67) = $316.67

Métodos de optimización. E.Parra 26


Programación lineal (PL)
Another point to note is that the feasible region is "convex“. This means that a line
joining any two points in the set would never pass outside the set.

At each comer the angle at which constraints meet is less than 180 degrees when
viewed from within the set. The feasible set of an LP problem must be convex.

It would be impossible, for example, to correctly solve an LP model with the feasible
set shown in Figure 10.

Métodos de optimización. E.Parra 27


Programación lineal (PL)
The line joining points A and B passes outside
the feasible set. This can occur because one of
the angles of the border of the feasible region is
greater than 180 degrees (when viewed from
inside the region). The significance of this
restriction on LP problems is that it allows very
efficient computational methods for solving LP
problems. You need to be aware of the
restriction so that you can recognize problems
that are not suitable for solution by LP.

Figure 10

Métodos de optimización. E.Parra 28


Programación lineal (PL)
The fact that the optimal solution always includes a comer (a so-called extreme
point) greatly reduces the number of combinations of possible solutions that needs
to be considered. In a small problem, a quick way to find the optimum without using
a computer is to calculate the objective function value the profit in this example) at
each extreme point.

Table 2.1 shows profit calculated at each extreme point for the shoemaker example. It
confirms that the profit-maximizing strategy is to produce 5 women's pairs and 6.67
men's pairs per week.

Métodos de optimización. E.Parra 29


Programación lineal (PL)
Having set up the problem, it is easy to include additional constraints.

For example, suppose that the shoemaker prefers making women's shoes and would
not be prepared to produce more than eight pairs of men's shoes per week, even if it
meant sacrificing some profit. This new constraint can be stated as

1M ≤ 8

or for convenience

M≤8

Note that the W variable does not appear in the constraint. This can be
interpreted as W having a zero coefficient. If desired the constraint could be
written
0W + 1M ≤ 8

Métodos de optimización. E.Parra 30


Programación lineal (PL)
Adding this constraint to the existing problem reduces the feasible area (see
Figure 11).

Figure 11

Métodos de optimización. E.Parra 31


Programación lineal (PL)
However, assuming the price of
women's shoes stays at $36, the
optimal solution does not change; the
highest objective function still passes
through the point (W, M) = (5, 6.67).

This illustrates that if an optimal


solution is still feasible after the
addition of a new constraint, then it is
also still optimal (as long as the
objective function coefficients have not
changed). There is no way that
removing part of a feasible set can
change the optimal solution unless the
original optimal solution is one of the
points removed.

Métodos de optimización. E.Parra 32


Programación lineal (PL)
To illustrate further, suppose Figure 12
the shoemaker becomes even
more negative about
producing men's shoes and
decides to set a maximum
level of five pairs per week.

The set of feasible solutions


now no longer includes the
previous optimum (see
Figure 12).

The new optimal solution is to produce 5 pairs of men's shoes and 6.25 of women's, giving
weekly profits of ($36 x 6.25) + ($34 x 5) = $395. Without this constraint on men's shoes,
the maximum profit was $406.67 per week, so meeting the shoemaker's preference for
making women's shoes requires a sacrifice of $11.67 profit per week.

Métodos de optimización. E.Parra 33


Programación lineal (PL)
A MINIMIZATION EXAMPLE
Example 2: Feeding Pigs

A farmer wishes to minimize the daily cost of


feeding 50 pigs.

There are two feeds available: lupins at $0.20 per


kilogram (kg) and wheat at $0.15/kg.

Each pig must receive at least 70 megajoules (MJ)


of energy and 1000 grams of protein each day.

The available wheat grain contains 11 percent


protein and 13 MJ/kg energy, while lupins contain
28 percent protein and 14 MJ/kg energy.

Find the cheapest combination of these feeds that


meets the pigs' nutritional requirements

Métodos de optimización. E.Parra 34


Programación lineal (PL)
In this problem there are two activities: feeding a kilogram of wheat (W ) and a kilogram
of lupins (L). There are also two constraints: a minimum level of protein and a minimum
level of energy.

Each kilogram of wheat provides 110 g of protein, while a kilogram of lupins provides
280 g. The total minimum requirement for protein is 50 pigs x 1000 g/pig = 50,000 g.
Thus the protein constraint is

110W + 280L ≥ 50,000

which states that the total amount of protein provided by wheat plus the amount
provided by lupins must be at least 50,000. Wheat and lupins, respectively, provide 13 and
14 MJ/kg of energy, and the total minimum requirement is 50 pigs X 70 MJ/pig = 3500
MJ. The energy constraint is

13W + 14L ≥ 3500

which represents the requirement that total energy provided by wheat and lupins
must be at least 3500.

Métodos de optimización. E.Parra 35


Programación lineal (PL)
Remembering the additional constraints that W ≥ 0 and L ≥ 0, the feasible
region is shown in Figure 13.

Métodos de optimización. E.Parra 36


Programación lineal (PL)
In this example, the objective is to minimize costs (C), which consist of
$0.15 per kilogram of wheat and $0.20/kg of lupins

C = 0.15W + 0.20L

The method of solving a minimization problem is similar to that for a maximization


problem.

Figure 14 shows the process of trying out various cost levels to find the lowest cost
solution that is feasible.

Métodos de optimización. E.Parra 37


Programación lineal (PL)

The cheapest ration in this example is to feed 133.33 kg of wheat and 126.2 kg of
lupins at a cost of

($0.15 x 133.33) + ($0.20 x 126.2) = $45.24

Métodos de optimización. E.Parra 38


Programación lineal (PL)
There are many other feasible solutions but they all cost more than this one, and the
objective is to minimize cost.

There are potential solutions costing less than $45.24; the lowest dashed line in Figure
14 shows the set of wheat and lupin levels costing $20.00.

However, none of these solutions provides adequate levels of the nutrients; they are
cheap but not feasible.

A minimization problem like this is similar to a maximization problem in that the


optimal solution will always be at a comer (or possibly will span two corners) of the
feasible set. This allows us to use the same simple approach of calculating the
objective function value at each of the comer points in order to identify the optimal
solution. Table 2.2 shows the results of these calculations for Example 2.2,
confirming that 133.33 kg of wheat and 126.2 kg of lupins is the cheapest possible
ration

Métodos de optimización. E.Parra 39


Programación lineal (PL)

Métodos de optimización. E.Parra 40


Programación lineal (PL)
Matrix Formulation
ALL models can be written in a matrix form:
1) Shoes
Maximize P = 36W + 34M ;
s.t. 4W + 3M ≤ 40
0.2W + 0.3M ≤ 3
Matrix form:
Max P = 36 34
𝑊
𝑀
= cTx ,
c: coefficients vector, x variables vector
s.t.
4 3 𝑊 40
≤ or Ax ≤b
0.2 0.3 𝑀 3
W ≥ 0; M≥0
Where
𝑊 4 3 40
cT = 36 34 ; x= ; A= b=
𝑀 0.2 0.3 3

Métodos de optimización. E.Parra 41


Programación lineal (PL)
Matrix Formulation
2) Pigs
Min C = 0.15W + 0.20L
s.t. 110W + 280L ≥ 50000
13W + 14L ≥ 3500
W ≥ 0; M≥0

Matrix form: Min C = cTx


s.t. Ax ≥ b
W ≥ 0; M≥0
Where
𝑊 110 280 50000
cT = 0.15 0.20 ; x= ; A= b=
𝐿 13 14 3500

Métodos de optimización. E.Parra 42


Programación lineal (PL)
LIMITATIONS OF THE GRAPHICAL APPROACH

To conclude this chapter it should be noted that while the graphical approach is useful in
coming to understand LP, it is not useful for solving practical problems.

The graphical approach can only be used for problems with two (or, at most, three)
decision variables, whereas all realistic problems have tens, hundreds, or even thousands
of variables, so the only practical way to solve them is on a computer.

We will learn how to solve by computer.

Métodos de optimización. E.Parra 43


Programación lineal (PL)
KEY POINTS

• Solving an LP problem graphically involves two stages: (a) graphing the feasible
region and (b) identifying the feasible point that is optimal.

• The feasible region is always convex.

• The optimal solution (LINEAR PROGRAMMING) is always at a comer (an


extreme point) of the feasible region.

• The graphical approach can only be applied easily to problems with two variables.

Métodos de optimización. E.Parra 44


Programación lineal (PL)
Exercises

In each of the following exercises you should:

• plot all constraints and identify the feasible region by shading.


• calculate the values of X and Y at each comer of the feasible region.
• draw one or more objective functions to identify the optimal point of the feasible
region.
• calculate the value of the objective function at each comer of the feasible region to
confirm that the point you selected graphically is, in fact, optimal.

Métodos de optimización. E.Parra 45


Programación lineal (PL)
Problem 1

Métodos de optimización. E.Parra 46


Programación lineal (PL)
Problem 2

Calculate the objective function value at the following non extreme points for the
problem in Exercise 2: (X, Y) (25, 0), (15, 5), (10, 10), (12, 12). Compare the values
at these points with those at the extreme points.

Métodos de optimización. E.Parra 47


Programación lineal (PL)
Problem 3

Métodos de optimización. E.Parra 48


Programación lineal (PL)
Problem 4

Suppose the objective function in Exercíse changes to Minimize


P = 7X + 6Y
Regraph the objective function to test whether the optimal solution
changes.

Métodos de optimización. E.Parra 49


Programación lineal (PL)
Problem 5

Métodos de optimización. E.Parra 50

You might also like