1 1. LP Problems 1.1 Definition Linear programming is the ...
-
Upload
khangminh22 -
Category
Documents
-
view
2 -
download
0
Transcript of 1 1. LP Problems 1.1 Definition Linear programming is the ...
1
Lecture 2: Using IT as a decision supporting tool
Topic 3: Linear Programming (LP) with Excel
1. LP Problems
1.1 Definition
Linear programming is the process of taking various linear inequalities relating to some
situations, and finding the "best" value obtainable under those conditions. A typical example
would be determining the "best" production levels for maximal profits under the limitations of
materials and labor.
1.2 Characteristics
(1) LP problems seek to maximize or minimize some quantity (usually profit or cost) expressed
as an objective function.
(2) The presence of restrictions, or constraints, limits the degree to which we can pursue our
objective.
(3) The objective and constraints in linear programming problems must be expressed in terms
of linear equations or inequalities.
1.3 LP Formulation
(1) Define your unknowns (decision variables that you can control as a decision maker).
(2) Express the objective function and the constraints using decision variables.
Example 1: Product Mix Problem
The company Shader produces two different products:
- Shader Walkman, a portable CD/DVD player
- Shader Watch-TV, a wristwatch-size Internet-connected color TV.
The following table shows the labor hours required in the electronic and assembly departments
to produce one unit of each product for a given resource availability.
Hours required/ unit Available hours / week
Department Walkman Watch-TV
Electronic 4 3 240
Assembly 2 1 100
If the profit is $7 per Walkman and $5 per Watch TV, how many units of each should be
produced per week to maximize profits? Formulate the LP problem.
2
Answer:
(1) Define your unknowns (Decision variables)
x = number of Walkmans to be produced
y = number of Watch-TVs to be produced
(2) Express the objective and the constraints.
Objective Function:
Profit = $7x + $5y
Constraint 1: hours of electronic time used ≤ electronic time available
4x+3y ≤ 240
Constraint 2: hours of assembly time used ≤ assembly time available
2x+1y ≤ 100
and of course the implied non-negative constraints
x≥ 0 and y ≥ 0
3
2. Finding Solutions
2.1 Graph the constraints and feasible region.
(1) Plot the constraint equations at their limits by converting each equation to equality and find
the intercepts
Intercepts
x (when y = 0) y (when x = 0)
Electronic 4x+3y ≤ 240 -> 4x+3y = 240 240/4 = 60 240 / 3 = 80
Assembly 2x+1y ≤ 100 -> 2x+1y = 100 100/2 = 50 100
(2) Next, decide which side of the line is the side that contains solutions to the inequality.
Pick a point which is not on the line. In this case the origin (0, 0) is the simplest such point with
which to work. Does the origin satisfy this constraint? At the origin, no products are produced.
Does the company have enough resources (either electronic or assemble) for this? The answer is
yes. Shade in all of the points in the upper right quadrant which are on the same side of the line
as the origin. This is the "feasible region" that meets all the constraints. Note that the company
can produce any product mix that resides in the feasible region given the resource constraints.
Now the question is which product mix can maximize the company's profit function (i.e.,
objective function).
4
2.2 Create an iso-profit line based on the objective function
Recall the objective function is given as
Profit = $7x + $5y
and the company wants to maximize the profit. We start by letting arbitrary profits equal to $210
(i.e., you can choose any number). This is a profit level that can easily be obtained without
violating either of the two constraints. The possible product mix that enables the company to
make the profit of $210 is given by the following equation:
$210 = $7x + $5y
that is called a" iso-profict function" that gives you the same profits $210. For example, if the
company produces x = 30 walkmans and y=0 watch TV, then it will make the profits of $210.
There exist many other combinations of x and y that satisfies this iso-profit function (e.g., x =0, y
= 42 as well) and we can illustrate all these combinations using a iso-profit line that represents
all combinations of (x, y) that will yield a total profit of $210.
To plot the profit line, we proceed exactly as we did to plot a constraint line, solving the above
iso-profit function for the axis intercepts of the function and connecting these two points with a
straight line.
x = 30 (when y = 0)
y = 42 (when x = 0)
5
Note that all points on this iso-profit line represent feasible solutions that produce the same profit
of $210.
We see, however, that the iso-profit line for $210 does not produce the highest possible profit to
the firm. For example, we try graphing two more lines, each yielding a higher profit $280 and
$350 as shown below.
The iso-profit functions with profit = $280
$280 = $7x + $5y
and that with profit = $350
$350 = $7x + $5y.
NOTE:
6
The farther we move from the 0 origin, the higher our profit will be.
Another important point to note is that these iso-profit lines are parallel (i.e., the slope of
all these lines are same). Therefore, we can draw a series of parallel profit lines by
moving our ruler in a plane parallel to the first profit line).
The highest profit line that will touches some point of the feasible region will pinpoint
the optimal solution. Notice that the fourth line ($420) in the above figure is too high to
count because it does not touch the feasible region.
2.3 Decide the optimal solution
The highest possible iso-profit line is illustrated above. It touches the tip of the feasible region at
the corner point where
x = 30
y= 40
and yields a profit of $410. See below to find more details about how to get this corner point that
is the intersection of two constraint lines.
7
3. Corner-Point Solution Method
Instead of moving a iso-profit line considering the constrains, we can adopt the following
property to find the optimal solution:
The optimal value will always be at a corner point of the feasible region, and we can evaluate
the objective function value at each corner point and choose the one with the highest profit.
For instance, in the above example, we can find four different corner points as shown below.
Point 1: ( x = 0, y = 0 )
Profit = $7 (0) + $5 (0) = $0.
Point 2: (x = 0, y = 80 )
Profit = $7 (0) + $5 (80) = $400.
Point 3: (x = 30, y = 40) [The note below shows how to find this intersection]
Profit = $7 (30) + $5 (40) = $410.
Point 4: (x = 50, y = 0 )
Profit = $7 (50) + $5 (0) = $350.
Because point 3 produces the highest profit of any corner point, the product mix of x= 30
Walkmans and y = 40 Watch-TVs is the optimal solution.
This solution yield a profit of $410 per production period.
8
NOTE:
How to find the intersection of two lines? (Corner point 3 above).
As you may recall from algebra, we can apply the method of simultaneous equations to the two
constraint equations.
4x+3y = 240 .......(a)
2x+1y = 100 .......(b)
To solve these equations simultaneously, we multiply Equation (b) by -2 (to eliminate one
variable that is x in this solution):
(-2) [2x+1y = 100]
-4x - 2y = - 200 ........(c).
and then add Equation (c) to Equation (a)
4x+3y = 240 .......(a)
-4x - 2y = - 200 ........(c).
------------------------------------------
0 x + 1 y = 40.
So, y = 40. We can now substitute 40 for y in either of the original equations and solve for x. Let
us use Equation (a). Then,
4x+3 (40) = 240 and
x = 30. Thus the corner point 3 has the coordinates (x = 30, y = 40).
9
4. Using the Excel Solver
4.1. Set up the Solver
To use Excel to solve LP problems the Solver add-in must be included. Typically this feature is
not installed by default when Excel is first setup on your hard disk. To add this facility to your
Tools menu you need to carry out the following steps (once-only):
Select the “Excel Options” by clicking the MS Office Icon on top.
Select Add-Ins and Click Go butto
10
From the dialogue box presented check the box for Solver Add-In.
On clicking OK, you will then be able to access the Solver option from the Data menu
11
4.2. Solving LP problem
(1) The above problem is formulated as the following LP program:
Max z = 7x + 5y
Subject to:
4x + 3y ≤ 240
2x + 1y ≤ 100
x ≥ 0
y ≥ 0
(2) Entering the problem into Excel
The best approach to entering the problem into Excel is first to list in a column the names of the
objective function, decision variables and constraints. You can then enter some arbitrary starting
values in the cells for the decision variables, usually zero (we use 1 in this example), shown in
the below screen shot. Excel will vary the values of the cells as it determines the optimal
solutions. Having assigned the decision variables with some arbitrary starting values you can
then use these cell references explicitly in writing the formulae for the objective function and
constraints, remembering to start each formula with an '=' .
12
Entering the formulae for the objective and constraints, the objective function in D7 will be
given by :
=B7*$B$2+C7*$B$3
Note: $ is used to fix the location of decision variables when you copy the formula. It may not be
necessary.
The constraints will be given by
D10 =B10*$B$2+C10*$B$3
D11 =B11*$B$2+C11*$B$3
D12 =B12*$B$2+C12*$B$3
D13 =B13*$B$2+C13*$B$3
You are now ready to use Solver.
(3) Solve the problem
On selecting the menu option Data | Solver the dialogue box shown in Figure Two is
revealed, and if you select the objective cell before invoking Solver the correct Target
Cell will be identified. This is the value Solver will attempt either to maximize or
minimize.
13
You enter the range of cells you want Solver to vary, the decision variables. Click on the
white box and select cells B2 & B3, or alternatively type them in.
You can now enter the constraints by first clicking the 'Add ..' button. This reveals the
dialogue box shown below. The cell reference is to the cell containing your constraint
formula, so for the first constraint you enter $D$10. By default <= is selected but you can
change this by clicking on the drop down arrow to reveal a list of other constraint types.
In the right hand white box you enter the cell reference to the cell containing the
boundary value, which for the first constraint is cell $E$10. You then click 'Add' to add
the rest of the constraints, remembering to include the non-negativity constraints.
Having added all the constraints, click 'OK' and the Solver dialogue box should look like
that shown below.
14
Click “Solve” button. You can use the Solver Results dialogue box to generate three
reports. To select all three at once, either hold down CTRL and click each one in turn or
drag the mouse over all three.
The Answer Report gives details of the solutions (in this case, profit is maximized at 410
with the product mix of x= 30 Walkmans and y = 40 Watch-TVs) and information
concerning the status of each constraint with accompanying slack/surplus values is
provided. The Sensitivity Report for the problem, which provides information about how
sensitive your solution is to changes in the constraints. We will skip how to interpret
sensitivity in detail.
Microsoft Excel 12.0 Answer Report
Worksheet: [Book1]Sheet1
Report Created: 2/12/2011 11:20:48 AM
Target Cell (Max)
Cell Name Original Value Final Value
$D$7 Profit function 12 410
Adjustable Cells
Cell Name Original Value Final Value
$B$2 x 1 30
$B$3 y 1 40
Constraints
Cell Name Cell Value Formula Status Slack
$D$10 Constraint Equation 240 $D$10<=$E$10 Binding 0
$D$11 Constraint Equation 100 $D$11<=$E$11 Binding 0
$D$12 Constraint Equation 30 $D$12>=$E$12 Not Binding 30
$D$13 Constraint Equation 40 $D$13>=$E$13 Not Binding 40