Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

Linear Programming Basics

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Linear Programming Basics

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

IES442

t
PN-477-E

os
June 2011

rP
Linear Programming Basics

Linear programming (LP) is a mathematical optimization tool that can help managers plan
and execute operations more efficiently through a better use of resources. The range of

yo
problems that can be treated with LP is wide. This note reviews the basics of the technique,
explains how to use it with a spreadsheet solver and discusses two typical cases where it is
useful.

1. Setting up the Problem


op
“Programming" literally refers to setting up an algorithm or sequence of actions that can be
executed by a machine (e.g., a computer). The word has become synonymous with “planning":
indeed, programming is about deciding what to do, when and how to do it. Programming
hence requires optimizing a series of available choices. LP is one particular technique among
many others, e.g., convex optimization, integer programming, dynamic programming, etc. The
history of LP can be traced back to the 1940s, when enemy losses were to be maximized given
tC

budget constraints during World War II. One of the fathers of LP was George B. Dantzig who
devised the simplex method in 1947, a first solution technique that is still being used
nowadays. In 1984, Narendra Karmarkar developed an interior point method to solve LP
quickly (in technical terms, the problem can be solved in polynomial time).

In order to use LP, three main elements need to be identified. First, the decision variables
must be clearly defined. These are the drivers that the decision-maker can change, e.g., how
No

much quantity of a given product needs to be produced, how much raw material consumed,
how many tons need to be transported from point A to point B, etc. Second, the constraints
on these variables have to be stated explicitly. Typically, these constraints appear as a
physical limitation of the system, e.g., production quantities cannot be negative, cannot exceed
Do

This technical note was prepared by Professor Víctor Martínez de Albéniz. June 2011.

Copyright © 2011 IESE. To order copies contact IESE Publishing via www.iesep.com. Alternatively, write to iesep@iesep.com
or call +34 932 536 558.
No part of this publication may be reproduced, stored in a retrieval system, used in a spreadsheet, or transmitted in any
form or by any means – electronic, mechanical, photocopying, recording, or otherwise – without the permission of IESE.

Last edited: 4/3/18


1

This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
PN-477-E Linear Programming Basics

t
os
the capacity of the plant, etc. Some other times, the constraints may come from decisions of
the firm, such as not producing more than the potential demand (to avoid left-over inventory
that may become obsolete or to avoid pressures on price). The region in which the decision
variables satisfy all the constraints is called the feasible region. This is where the decision-
maker can freely move the decision variables. Third, the objective function must be identified.

rP
This function is a relationship between the decision variables and the target that the
decision-maker wants to minimize or maximize. For example, the objective can be the total
cost incurred by the firm, to be minimized, or the total profit, to be maximized; sometimes,
instead of a monetary value, the objective can be a service indicator to be maximized under
cost constraints.

A characteristic of LP is that the decision variables are continuous (as opposed to integer

min  ci xi

I
I

i 1
yo
numbers) and that both constraints and objective are linear (as opposed to nonlinear).

The standard way of writing a linear program is as follows:

s.t. aij xi  b j
op
j  1,  , J
i 1

In this formulation, the decision variables are represented by a vector of dimension I,


denoted x1 , , xI  . The feasible region is coded by a set of J linear inequality
constraints 1 that depend on any parameters aij and b j . Finally, the objective function is a
tC

weighted sum of the decision variables, with weights cj. The objective must be minimized2
here.

The most difficult part in LP is to formulate the problem. That is, to translate a managerial
problem into a quantitative mathematical model. In this process, one must be able to relate
actual decisions with variables, and physical limitations with constraint inequalities. Above
all, one needs to ensure that the problem is indeed linear, which can be problematic if the
No

objective is coded in a spreadsheet with hidden relationships. Although usually the user will
be notified when attempting to solve a LP when there is a nonlinear relationship present, it is

a good practice to input all the external parameters aij , b j , ci separately, perhaps color- 
coding them, and to make sure that they are unrelated to any of the decision variables.
Do

1 Sometimes, the constraints could be equalities as well. Note that to code an equality constraint in the above formulation one
can include two inequalities in the opposite direction. For example to code x1  x2  1, we can use the two inequalities
x1  x 2  1 and  x1  x 2  1.

 
I 1
2 If one wants to maximize the objective  c x , the problem can be transformed into minimizing   c x .
i i i i
i 1 i 1

2 IESE Business School-University of Navarra


This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Linear Programming Basics PN-477-E

t
os
2. Solving a Linear Program and Interpreting the Results
Consider the following problem. There are two decision variables x1 and x2 . There are five
constraints: x1  0 , x2  0 , x1  5 , x2  3 and x1  2 x2  7 . The objective is to maximize
x1  x2 . Although this is a mathematical formulation already, one could interpret it for

rP
instance as a production problem: a firm can produce products A and B, with identical
contribution margins, for which there is a potential demand of 5 and 3 respectively, and both
products must consume a shared input in different proportions (1 for A, 2 for B), of which
there are 7 units available; the objective is to maximize the total margin.

A graphical representation can be made. We can build a two-dimensional graph where the
value of x1 is in the x-axis, and the value of x2 in the y-axis. The constraints show what

yo
decisions are acceptable and delimit the feasible region, a five-sided polyhedron. It is shown
in Figure 1. Finally, consider the value of the objective within the feasible region: it increases
as one moves towards the top-right corner following a 45º line. One can see from the graph
that the objective is at its maximum when x1  5, x2  1 .

Figure 1
Graphical representation of the feasible region
op
x2
x2  3
tC

x1  2 x 2  7

x1  0
No

x2  0
x1
x1  5

In this simple case, one can solve the problem graphically because only two variables are
involved. In general, one must resort to numerical optimization, a function which is readily
available in standard spreadsheets (e.g., through the Solver function in Microsoft Office Excel).
Do

An example of coding is shown in Figure 2. The second line in the table contains the values of
x1 and x2 (1 and 1 currently). The fifth line contains the objective parameters c1 and c2 , and the
value of the objective in grey ( c1 x1  c2 x2  2 currently). In lines 8 to 12, the constraints are
depicted, with the values of aij on the left, the value of a1 j x1  a 2 j x2 in grey in the middle, and
the value of b j on the right. We can see that they are all satisfied currently.

IESE Business School-University of Navarra 3

This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
PN-477-E Linear Programming Basics

t
os
Figure 2
Coding in Excel

rP
yo
op
Using this coding, we can call a numerical LP solver. In Excel, the Solver add-in provides the
interface shown in Figure 3.

Figure 3
tC

Excel Solver interface


No
Do

Note that by clicking on the Options button, shown in Figure 4, we must specify that we are
dealing with LP. One can also state that the decision variables are non-negative, which
would allow us to eliminate the first two constraints.

4 IESE Business School-University of Navarra


This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Linear Programming Basics PN-477-E

t
os
Figure 4
Excel Solver options

rP
yo
op
After we are finished setting up the problem, we can proceed to obtain the output. We can
choose to see several reports, to be chosen in the interface of Figure 5. These reports provide
valuable information.
tC

Figure 5
Excel Solver has completed the optimization. Three reports can be chosen
No

The “Answer" report shows the following data, depicted in Figure 6.


Do

IESE Business School-University of Navarra 5

This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
PN-477-E Linear Programming Basics

t
os
Figure 6
“Answer” report

rP
yo
op
We see that the objective is maximized at a value of 6, which is attained by setting x1 to 5 and x2
to 1. Three of the constraints are not binding or inactive, suggesting that one could remove them
without modifying the result of the optimization. Finally, constraints x1  5 and x1  2 x2  7 are
tC

binding or active, which means that one could increase the objective if we could remove these
constraints. Further information is shown in the “Sensitivity" report, see Figure 7.
Figure 7
“Sensitivity” report
No
Do

6 IESE Business School-University of Navarra


This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Linear Programming Basics PN-477-E

t
os
Let us discuss the “Sensitivity" report in Figure 7 first. It shows the final value of each
constraint with respect to the right-hand side. The “Shadow Price" determines how the value
of the objective would vary if the right-hand side of the constraint is raised by a small
amount, within the “Allowable Increase" and “Allowable Decrease" ranges. For example, take
the third constraint x1  5 : if the right-hand side increased by 2 (less than 4 imposed by the

rP
allowable increase), to 7, the objective would increase by 2 times 0.5, or 1. Similarly, if the
right-hand side was decreased by 1, to 4, then the objective would decrease by 0.5. For other
constraints, the shadow price may be zero, which occurs when the constraint is not binding.
Again, this is true within the allowable increase/decrease: for instance, if the right-hand side
of the fourth constraint is decreased by 2.5, higher than the allowable decrease of 2, then the
optimal solution changes and the objective value does as well. This information is quite
valuable because it tells the decision-maker how much one should be willing to pay to

yo
modify the constraint. It usually provides useful information to make the right investments
in capacity, market development, etc.

The “Answer" report in Figure 6 shows the value of the “Allowable Increase" and “Allowable
Decrease." This performs a sensitivity analysis on coefficients c1 and c 2 . Here, c1 could
increase or decrease up to 0.5 without changing the optimal combination of x1 and x 2 . Hence,
if c1  0.7, x1  5, x2  1 would still be optimal, but not if c1  0.3 . Similarly, c 2 could
op
decrease or increase up to 0.5 without changing the optimal combination of x1 and x 2 .

Furthermore, if the optimal value of the variable was x1  0 or x 2  0, the “Reduced Cost"
would determine how the objective would increase for every infinitesimal increase of the
corresponding variable (in other words, this is the “Shadow Price" of the non-negativity
tC

constraint).

Finally, the report “Limits" shows in Figure 8 the minimum and maximum values for the
objective within the feasible region.
Figure 8
“Limits” report
No
Do

IESE Business School-University of Navarra 7

This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
PN-477-E Linear Programming Basics

t
os
3. Examples
Two examples of LP in different settings are shown below.

3.1. Aggregate Planning

rP
A beverage-can supplier based in Spain is preparing its production plan for the next year.
Sales are highly seasonal, with important sales peaks in the summer. Figure 9 illustrates the
sales forecast.
Figure 9
Forecast of beverage sales

yo
op
tC

Currently, there are 150 employees working full-time in the factory. Each worker can
produce up to one million cans per month (with the help of machines, of course). The
maximum number of workers that the factory can handle is 300, which is equivalent to a
production of 300 million cans per month. The monthly cost of a worker is 1000€. One can
hire or fire workers, at a cost of 2000€ per firing, and 0€ for hiring (per worker). One should
be careful about the intangible costs of firing too. The cost of inventory is 1000€ per million
cans, per month. At the beginning of the year there is no inventory. What is the best staffing
No

and production plan? A solution is provided in Appendix 1.

3.2. Production-Distribution Planning


A steel manufacturer has three plants in Spain. The plants are in A Coruña, Barcelona and
Cádiz. Each plant produces the full product range and has historically served the local market
to minimize logistics costs. However, variations in productivity and transportation charges
have led the company to question whether this is a good strategy.
Do

The productivity and variable costs of each plant are different: in A Coruña they are
2600 tons/day and 381 €/ton; in Barcelona, 2800 tons/day and 342 €/ton; and in Cádiz,
1800 tons/day and 268 €/ton. Furthermore, the transportation costs increases with
distance, as shown in Figure 10.

8 IESE Business School-University of Navarra


This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Linear Programming Basics PN-477-E

t
os
Figure 10
Logistics costs of steel

rP
yo
op
What would the best production-distribution plan for this manufacturer? A solution is
provided in Appendix 2.
tC
No
Do

IESE Business School-University of Navarra 9

This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
PN-477-E Linear Programming Basics

t
os
Appendix 1
One can define the following decision variables for months 1, ..., 12: Hiring, Firing and
Production. One can then build auxiliary variables: Employeest = Employeest + Hiringt -
Firingt; and Inventoryt = Inventoryt-1 + Productiont - Demandt. We can then calculate the

rP
total number of employee-months (for salaries), firing-months (for firing penalties) and
inventory-months (for inventory charges), and define the objective function. The optimal
solution is represented in Figure 11.
Figure 11
Optimal staffing and production plan

yo
op
tC
No

The “Sensitivity" report is as follows. We observe that the employee limitation of 300 is
binding from April to August, during the demand peak. The shadow price associated with the
limitation is highest in August (6,000€/employee), because not being able to hire one
additional worker in August means that inventory needs to be built and carried from
February until August.
Do

10 IESE Business School-University of Navarra


This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Linear Programming Basics PN-477-E

t
os
Appendix 1 (Continued)
Figure 12
“Sensitivity” report

rP
yo
op
tC
No
Do

IESE Business School-University of Navarra 11

This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
PN-477-E Linear Programming Basics

t
os
Appendix 2
Here is a possible analysis of the problem. The optimal solution is shown in Figure 13.
Figure 13

rP
Optimal production-distribution plan

yo
op
tC

Interestingly, Barcelona and Cádiz are producing at full capacity, while A Coruña is at half
capacity. The total cost is 62.6 million €/month.
No
Do

12 IESE Business School-University of Navarra


This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860
Linear Programming Basics PN-477-E

t
os
Appendix 2 (Continued)
The “Sensitivity" report is worth examining in Figure 14.
Figure 14
“Sensitivity” report

rP
yo
op
tC

The shadow price for every market can be interpreted as the landed cost of serving that
market given the current capacity levels. The shadow price for every plant can be interpreted
as the cost savings that one could achieve by being able to increase the capacity by one.
Notice that A Coruña is not producing to capacity, hence its shadow price is zero.
No
Do

IESE Business School-University of Navarra 13

This document is authorized for educator review use only by Oscar Gamonal, Universidad San Ignacio de Loyola (USIL) until Jan 2024. Copying or posting is an infringement of copyright.
Permissions@hbsp.harvard.edu or 617.783.7860

You might also like