M02_HELB5053_01_SE_C02

30
5 Learning objectives After finishing this chapter, you should be able to: formulate a linear programming model for a given problem; solve a linear programming model with two decision variables graphically; solve linear programming models using Excel’s Solver; understand the information provided in a sensitivity analysis; and understand how primal and dual problems relate to each other. Typical optimisation problems maximise or minimise the value of a given variable (such as profit, total costs, etc.) when other specified variables (produc- tion capacity, required product quantities, etc.) are constrained. The field of mathematical programming includes a number of optimisation methods, each described by a mathematical model. In such a model, there is one expression – the objective function – that should be maximised or minimised (or in some cases set to a desired value). In addition, the model must include constraints that are described by mathematical expressions. Linear programming 2 Since the late 1940s, linear programming models have been used for many different purposes. Airline companies apply these models to optimise their use of planes and staff. NASA has been using them for many years to optimise their use of limited resourses. Oil companies use them to optimise their refin- ery operations. Small and medium-sized businesses use linear programming to solve a huge variety of problems, often involving resource allocation. Theory in action

description

Paper

Transcript of M02_HELB5053_01_SE_C02

  • 5

    Learning objectives

    After finishing this chapter, you should be able to:

    formulate a linear programming model for a given problem;

    solve a linear programming model with two decision variables graphically;

    solve linear programming models using Excels Solver;

    understand the information provided in a sensitivity analysis; and

    understand how primal and dual problems relate to each other.

    Typical optimisation problems maximise or minimise the value of a given variable (such as profit, total costs, etc.) when other specified variables (produc-tion capacity, required product quantities, etc.) are constrained. The field of mathematical program ming includes a number of optimisation methods, each described by a mathematical model. In such a model, there is one expression the objective function that should be maximised or minimised (or in some cases set to a desired value). In addition, the model must include constraints that are described by mathematical expressions.

    Linear programming2

    Since the late 1940s, linear programming models have been used for many different purposes. Airline companies apply these models to optimise their use of planes and staff. NASA has been using them for many years to optimise their use of limited resourses. Oil companies use them to optimise their refin-ery operations. Small and medium-sized businesses use linear programming to solve a huge variety of problems, often involving resource allocation.

    Theory in action

  • Chapter 2 Linear programming

    6

    The most widely used models include only linear relationships, and belong to the field of linear programming. In such models both the objective function and the constraints are linear mathematical expressions. Lets illustrate this with an example:

    Sygitron, a television manufacturer, has decided to produce and sell two dif-ferent types of TV sets, one small (product 1) and one big (product 2). They assume that product 1 will give a profit of $300 per unit and product 2 a profit of $500 per unit. Sygitron has one production plant with four departments: moulding, soldering, assembly and inspection. Each TV set is processed in sequence through these four departments. Each department has a limited capacity given by a maximum number of working hours per year. We assume Sygitron can sell all the TV sets they are able to produce (the market is not a restriction).

    The problem to be solved is that Sygitron wants to maximise its total profit by finding the optimal use of its limited production capacity. To find out how this should be done, we need to know both how many production hours each TV set uses in each department, and the total capacity of each department. This infor-mation is shown in Table 2.1.

    At this point, with all necessary information provided, we can formulate the prob-lem as a mathematical model. First, we define the decision variables:

    x1 number of product 1 produced per year (small TV sets).

    x2 number of product 2 produced per year (big TV sets).

    Next, we formulate the objective function, which is given the symbol Z. In this case, we need an equation for calculating the total profit per year:

    Z 300x1 500x2

    Total profit per year is (profit per unit of product 1) (number of product 1 pro-duced per year) (profit per unit of product 2) (number of product 2 produced

    Dept. Hours used by one unit of product 1

    Hours used by one unit of product 2

    Capacity in hours per year

    Moulding 1 5 4 000

    Soldering 1 1 1 200

    Assembly 2 1 2 000

    Inspection 2 5 5 000

    Table 2.1 Time consumption and capacity in Sygitron departments

  • 7

    Graphical solution of a maximisation problem

    per year). The objective is to maximise Z without exceeding the capacity of any of the four depart ments. These capacities are formulated as mathematical expres-sions called constraints:

    Moulding

    Soldering

    Assem

    x x

    x x1 2

    1 2

    5 4000

    1200

    +

    +

    bbly

    Inspection

    2 2000

    2 5 50001 2

    1 2

    x x

    x x

    +

    +

    The last equation for the inspection department says that the time used per year, which is (2 hours per unit of product 1) (number of product 1 per year) (5 hours per unit of product 2) (number of product 2 per year), must not exceed the limit of 5 000 hours. In addition, you must remember that the decision variables have their own constraints. Since it is impossible to produce a negative number of products, x1 0 and x2 0 are required. Now the entire mathematical model can be presented:

    Maximise

    :

    Moulding

    Z x x

    x

    = +300 5001 2

    1

    Constraints

    ++

    +

    +

    5 4000

    1200

    2

    2

    1 2

    1 2

    x

    x x

    x x

    Soldering

    Assembly

    +

    2000

    2 5 5000

    01 2

    1 2

    Inspection x x

    x x,

    The objective is to find the maximum value of Z, subject to the given constraints. How should this be done? The answer is by using a computer program. This sub-ject will be discussed in Section 2.3. First, to help you to understand the theory of linear program ming better, we will study a graphical solution of this problem.

    2.1 Graphical solution of a maximisation problem

    When mathematical programming is used to solve genuine problems, models usually contain many variables, sometimes more than fifty. Therefore, computer solutions are the only viable way to go in real life. The problem described by equation 2.2 contains only two variables, x1 and x2. In such a simple example, it is possible to show all equa tions involving x2 as functions of x1 in a coordinate system. If we rewrite the constraints in equation 2.2 as equations, we obtain the following capacity lines:

    (2.1)

    (2.2)

  • Chapter 2 Linear programming

    8

    Moulding

    Soldering

    Assem

    x x

    x x1 2

    1 2

    5 4000

    1200

    + =

    + =

    bbly

    Inspection

    2 2000

    2 5 50001 2

    1 2

    x x

    x x

    + =

    + =

    These equations express the linear combinations of x1 and x2 that occupy the maximum capacities in each of the four departments. The capacity lines are shown in Figure 2.1. The constraints in equation 2.2 tell us that the values of x1 and x2 must lie below all of the capacity lines. These capacity lines, and the constraints x1, x2 0, define a feasible region shown as the shaded area in Figure 2.2. Combinations of x1 and x2 within the fea sible region are the only ones pos-sible. In this case the feasible region is defined by only three capacity lines and x1, x2 0. Note that the inspection departments capacity is not fully used for any combination of x1 and x2.

    Now, the challenge is to find the combina tion of x1 and x2 within the feasible region that maximises the objective function (maximises total profit):

    Z 300x1 500x2

    (2.3)

    1 200

    1 000

    800

    600

    400

    200

    0

    AssemblyMouldingInspectionSoldering

    x2

    x12000

    400

    600

    800

    1 000

    1 200

    Figure 2.1 Capacity lines for Sygitron departments

    1 200

    1 000

    800

    600

    400

    200

    0

    AssemblyFeasible region

    Moulding

    Soldering

    x2

    x12000

    400

    600

    800

    1 000

    1 200

    Figure 2.2 Feasible region for Sygitron

  • 9

    Graphical solution of a maximisation problem

    For a given value of Z, this equation expresses linear combinations of x1 and x2. In our example we may call this a profit line, but the general name is objective function line. In Figure 2.3 the objective function line for Z $200 000 is drawn. The line lies within the feasible region and illustrates all combinations of x1 and x2 that gives a total profit of $200 000. A higher value of Z gives an objective func-tion line at a higher level as shown for Z $300 000.

    The figure shows that objective function lines represent higher values for the objec tive function as the lines are displaced parallel to each other at higher levels. But the optimal solution must be a part of the feasible region. Figure 2.3 shows that as we move the objective function line outwards, the last contact with the feasible region is the cor ner point made up between the two capacity lines for the moulding and the soldering departments. The optimal solution is given by the two equations:

    Moulding

    Soldering

    x x x

    x x x1 2 1

    1 2 2

    5 4000 500

    1200

    + = =

    + =

    == 700}Optimal total profit is calculated from the objective function:

    Z 300 500 500 700 $500 000

    At this point we realise that the optimal solution is dependent both on the feasi-ble region and the objective function. If the slope of the objective function line changes, we may get a new optimal solution. In our example the slope is 3/5:

    Z x x x xZ= + = +300 500 3

    5 5001 2 2 1

    If profit changes to $500 per unit for product 1 and to $200 per unit for product 2, the objective function line changes to:

    Z x x x xZ= + = +500 200 5

    2 2001 2 2 1

    (2.4)

    (2.5)

    (2.6)

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Optimal solution

    Z = $300 000Z = $200 000

    x2

    x1

    Figure 2.3 Optimal solution for Sygitron

  • Chapter 2 Linear programming

    10

    With this slope the optimal solution will be x1 1 000 and x2 0, as indicated by the dot ted line in Figure 2.3. When a computer solves a linear programming problem, it starts somewhere in the feasible region and searches for the optimal solution. For the straight-forward examples in this book, such searches will end up in one of the corner points of the feasible region. The particular corner chosen depends on whether the objective function should be maximised or minimised. We can then solve the problem by calculating Z for the corner points of the feasible region (Figure 2.4). The result will still be corner point 2 with Z $500 000.

    Z

    Z1

    2

    300 0 500 800 400000

    300 500 5

    = + =

    = +

    $ $ $

    $ $ 000 700 500000

    300 800 500 400 4403

    =

    = + =

    $

    $ $ $Z 0000

    300 1000 500 0 300000

    300 04

    5

    Z

    Z

    = + =

    =

    $ $ $

    $ ++ =$ $500 0 0

    2.2 Irregular problems

    Linear programming problems can in some cases show discrepancies. Lets take a look at some of them.

    Multiple optimal solutions

    In Figure 2.3 we saw that the optimal solution was determined by the slope of the objective function line. If this slope is identical to the slope of a constraint line, an interesting situation occurs. Lets assume that profit per unit is $500 for both products. The objective function line can then be written:

    Z x x x xZ= + = +500 500

    5001 2 2 1

    5

    12

    3

    4

    x2

    x1

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Figure 2.4 Corners of the feasible region

    (2.7)

  • 11

    Irregular problems

    The slope is 1. Figure 2.5 shows that when we move the objective function line outwards, the last contact between the feasible region and the objective function line is the line between corner points 2 and 3. This makes sense since the slope of the capacity line for the soldering department is also 1:

    x x x x1 2 2 11200 1200+ = = +

    The conclusion must be that all combinations of x1 and x2 on the line between corner points 2 and 3 are optimal solutions, and give the same maximum value of Z. We come to the same conclusion when applying the method illustrated in Figure 2.4. Corner points 2 and 3 give the same optimal solutions:

    Z2 $500 500 $500 700 $600 000

    Z3 $500 800 $500 400 $600 000

    Redundancy

    If you compare Figure 2.1 and Figure 2.2, you will see that capacity in the inspec-Figure 2.1 and Figure 2.2, you will see that capacity in the inspec- and Figure 2.2, you will see that capacity in the inspec-Figure 2.2, you will see that capacity in the inspec-, you will see that capacity in the inspec-tion department is not a constraint in this problem. As a redundant constraint, it has no influence on the feasible region and can not be part of an optimal solu-tion. Regardless of the optimal solution, the inspection department will always have some free capacity.

    Infeasibility

    Infeasibility occurs when no solution satisfies all of the models constraints. In other words, no feasible region exists. We get such a situation if we add the con-straint x2 1 000 to our Sygitron example. If we look at Figure 2.2, it is obvious that not all the constraints can be satisfied at the same time.

    Moulding2

    3Assembly

    Soldering

    x2

    x1

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Figure 2.5 Multiple optimal solutions

    (2.8)

  • Chapter 2 Linear programming

    12

    Unboundedness

    Some problems might not have enough constraints to define one specific opti-mal solution. Assume the following objective function and constraints:

    Maximise Z x x

    x x

    = +

    +

    10 10

    5 2 2000

    1 2

    1 2

    Constraints:

    xx x

    x x1 2

    1 2

    2 800

    0

    +

    ,

    Figure 2.6 illustrates that since the objective function should be maximised, and the constraints are of the category , Z approaches infinity. This means that no optimal solution exists for this problem. The solution is unbounded.

    2.3 Computer solutions

    Linear programming problems should generally be solved by a computer (Section 2.1 is included solely for pedagogic reasons). Many software manufacturers offer linear programming packages, for instance AIMMS, AMPL, GAMS, LINDO, XA and XPRESS. This book demonstrates examples in Excel only. Computer software solves problems in mathematical programming by apply-ing different algorithms. For a simple linear programming problem, like the example in Section 2.1, a computer would use the simplex method. The various algorithms for mathematical programming problem solving will not be discussed in this book. The example in Section 2.1 could be solved by using a graphical method, since it involved only two decision variables. Imagine a problem with five decision variables. It would be impossible to solve such a problem graphically since it would involve drawing a figure in five dimensions! The only practical alternative is to use a computer.

    (2.9)

    x2

    x1

    Z = 10x1 + 10x

    2

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Figure 2.6 Unbounded problem

  • 13

    Computer solutions

    Let us re-examine the simple example earlier in the chapter and study an Excel solution. The mathematical model and the Excel spreadsheet are shown in Figure 2.7. The cells B5 and C5 are reserved for the values of x1 and x2. In cells B6 and C6 we write the parameters for the objective function (profit per unit). Cell D6 contains a formula for the objective function, B6*B5 C6*C5. Linear programming models usually include more than two decision variables. To avoid unreasonably long formulas, we use the Excel standard function SUMPRODUCT.

    Our intention is to tell Excel to maximise the value in cell D6 by changing the values in cells B5 and C5. Before this can be done, however, the constraints must be included. For the moulding department constraint, we write the param-eters for x1 and x2 in cells B9 and C9 respectively. The formula SUMPRODUCT (B9:C9;$B$5:$C$5) is then written in cell D9. In cell F9 we write 4 000 which is

    Figure 2.7 Excel spreadsheet for a linear programming model

    Maximise Z x x

    x x

    x

    = +

    +

    +

    300 500

    5 4000

    1 2

    1 2

    1

    Constraints:

    xx

    x x

    x x

    x x

    2

    1 2

    1 2

    1 2

    1200

    2 2000

    2 5 5000

    0

    +

    +

    ,

  • Chapter 2 Linear programming

    14

    the right side of the constraint. Constraints for the other three departments are included in a similar manner. (We use the $-sign in this manner in order to copy the formula correctly to the cells D10D12.) We are ready to solve the problem. If you use an old version of Excel, bring down the Tools window from the toolbar and select Solver. In Excel 2007, choose the Data-flag and select Solver. The Solver dialogue box will now appear as shown in Figure 2.8. Cell D6, containing the formula for the objective function, should be defined as the target cell. Then click Max to indicate that the value of the objective function should be maximised. You want Excel to do this by changing cells B5:C5. Insert those references as shown in the figure.

    To include the constraints click Add. A new dialogue box for adding con-straints appears as shown in Figure 2.9. Insert the cell reference for the left side of the constraint under Cell Reference, and the cell reference for the right side of the constraint under Constraint. This can be done one constraint at a time. In this case, where all constraints are of the same type , all cell references can

    Figure 2.8 Solver Parameters dialogue box

    Figure 2.9 Add Constraint dialogue box

  • 15

    Computer solutions

    be put in simultaneously as shown in the figure. Go back to the Solver Parameter dialogue box by clicking OK. Before solving the problem we must activate the options dialogue box by click-ing Options. An options dialogue box like that in Figure 2.10 appears. Click Assume Linear Model and Assume Non-Negative. The second action is made to add the two constraints x1, x2 0. (These constraints can also be added in the constraint adding dialogue box.) Click OK.

    Solver now has all the necessary information to solve the problem. Click Solve in the Solver Parameter dialogue box. The Solver Results dialogue box appears, as shown in Figure 2.11. In this dialogue box you can click and request three different reports. The sensitivity report is the most essential, and will be discussed further in Section 2.6. Click OK to activate.

    Figure 2.10 Solver Options dialogue box

    Figure 2.11 Solver Results dialogue box

  • Chapter 2 Linear programming

    16

    The solution of the problem results in the return of the value 500 in cell B5 and of 700 in cell C5 (see Figure 2.7). This is consistent with the result from Section 2.1.

    2.4 Graphical solution of a minimisation problem

    For some problems the aim is to minimise the value of the objective function. One example is minimisation of total costs. Lets consider the following problem:

    Minimise

    A

    B

    Z x x

    x x

    x x

    = +

    +

    +

    2

    6

    4

    1 2

    1 2

    1 2

    Constraints:

    +

    12

    2 10

    01 2

    1 2

    C x x

    x x,

    The constraints are of the two categories and . This results in the feasible region shown in Figure 2.12.

    In a minimisation problem the objective function lines are displaced parallel to each other at lower levels as Z is minimised. Figure 2.13 shows that as the objective function line is moved inwards, the last contact with the feasible region is corner point 1. The optimal solution is given by the intersection between the constraint lines A and C:

    A

    C

    x x x

    x x x1 2 1

    1 2 2

    6 2

    2 10 4

    + = =

    + = =

    The problem can also be solved by calculating Z for the three corner points of the feasible region. Corner point 1 represents the minimum of the objective function:

    (2.10)

    (2.11)

    8

    6

    4

    2

    00 2 4 6 8 10 12

    x2

    x1

    A

    CFeasible region

    B

    Figure 2.12 Feasible region

    }

  • 17

    Slack variables

    Z1 2 2 4 8Z2 2 4 2 10Z3 2 8 1 17

    2.5 Slack variables

    The graphical solution in Section 2.1 showed that the optimal solution, x1 500 and x2 700, was given by the capacities in the moulding and soldering depart-ments (see Figure 2.3). These constraints are then said to be binding since their capacities are fully utilised. The rest of the constraints are not binding, which means they have unused capacity. Capacity left over in the four departments can be calculated as the difference between available and used capacity:

    Moulding

    Soldering

    4000 500 5 700 0

    1200 500 700

    + ( ) = +(( ) = +( ) =

    0

    2000 2 500 700 300

    5000

    Assembly

    Inspection + ( ) =2 500 5 700 500

    The unused capacity for a particular constraint is often referred to as its slack. The slack of the four constraints in our example can also be read from the answer report shown in Figure 2.14.

    (2.12)

    8

    6

    4

    2

    00 2 4 6 8

    x2

    x1

    1

    23

    z = 16

    z = 12

    z = 8

    Figure 2.13 Optimal solution for a minimisation problem

    Figure 2.14 Answer report

  • Chapter 2 Linear programming

    18

    The unused capacity in a constraint is often referred to as a slack variable. When all the slack variables are symbolised with Si, the mathematical model can be expressed in standard form:

    Maximise 300 500 0 0 0 01 2 1 2 3 4x x S S S S+ + + + +

    Constraints:

    MMoulding

    Soldering

    As

    x x S

    x x S1 2 1

    1 2 2

    5 4000

    1 200

    + + =

    + + =

    ssembly

    Inspection

    2 2000

    2 5 50001 2 3

    1 2 4

    x x S

    x x S

    x

    + + =

    + + =

    11 2 1 2 3 4 0, , , , ,x S S S S

    In the objective function all slack variables are given zero as coefficients, since unused capacity makes no contribution to profit. In the minimisation problem of Section 2.4 the optimal solution was given by constraints A and C (equation 2.10). Constraint B was of the type, a condition that was more than fulfilled. Such constraints are termed surplus variables and are defined as the excess above the minimum requirement. At the optimal solu-tion the left side of the constraint is x1 4x2 2 4 4 18, which is 6 more than the constraint of 12. The value of the surplus variable is then 6. Surplus variables and slack variables must have opposite signs. The minimisation example (equa-tion 2.10) on a standard form will be:

    Minimise

    A

    2 0 0 01 2 1 2 3

    1

    x x S S S

    x x

    + + + +

    +Constraints:

    22 1

    1 2 2

    1 2 3

    1 2 1

    6

    4 12

    2 10

    =

    + =

    + + =

    S

    x x S

    x x S

    x x S S

    B

    C

    , , , 22 3 0,S

    2.6 Sensitivity analysis

    Sensitivity analysis is the study of how changes in model parameters affect the optimal solution. In Excel this information is provided in the sensitivity report. Lets take a closer look at some of the effects of various parameter changes.

    Objective function coefficient ranges

    For our example, we saw in Figure 2.3 that the optimal solution was given by the slope of the objective function line. With the given slope:

    (2.13)

    (2.14)

  • 19

    Sensitivity analysis

    Z x x x xZ= + = +300 500 3

    5 5001 2 2 1

    the solution was determined by the intersection between the two capacity lines for the moulding and soldering departments:

    x x x x

    x x x x

    1 2 2 1

    1 2 2 1

    5 400015

    800

    1200 1200

    + = = +

    + = = +

    As long as the slope for the objective function line lies between the slopes for these two capacity lines, the optimal solution will not change (see Figure 2.15). Assume that the slope of the objective function line is given by the following coefficients and that the objective function line can be formulated as:

    Z C x C x xC

    Cx

    Zx x

    x

    x

    = + = +1 2

    1

    2

    1 2 2 1 500

    If we insist that the slope for the objective function line lies between the slopes for the two capacity lines, the following requirement must be fulfilled:

    1 15

    15

    11

    2

    1

    2

    C

    C

    C

    Cx

    x

    x

    x

    If one coefficient is held constant, lets say Cx2 500, the expression can be written:

    15 500

    1 100 50011

    C

    Cx x

    This means that in the objective function Z Cx1 x1 500 x2, the value Cx1 must be kept between 100 and 500 to keep the optimal solution in corner point 2 (Figure 2.15). If Cx1

    moves outside these limits, a new optimal solution will occur.

    (2.15)

    (2.16)

    (2.17)

    (2.18)

    (2.19)

    12

    3

    x2

    x1

    Feasible region

    MouldingSoldering

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Figure 2.15 Ranges for one objective function coefficient

  • Chapter 2 Linear programming

    20

    If Cx1 100, the optimal solution changes to corner point 1 with x1 0 and x2

    800. If Cx1 500, the optimal solution changes to corner point 3 with x1 800

    and x2 400. If we go through the same procedure for Cx2

    , we find the following limits:

    300 Cx2 1 500

    In Excel, the sensitivity report tells how much the objective function coefficients can change without affecting the optimal solution. As shown in Figure 2.16, the limits for the coefficients are presented as objective coefficients with allowable increases and decreases. The limits for Cx2

    can be calculated as 500 200 300 and 500 1 000 1 500.

    Reduced costs

    The sensitivity report in Figure 2.16 also includes reduced costs for the two objec-Figure 2.16 also includes reduced costs for the two objec-2.16 also includes reduced costs for the two objec-.16 also includes reduced costs for the two objec-16 also includes reduced costs for the two objec- also includes reduced costs for the two objec-tive function coefficients. A reduced cost tells us how much an objective function coefficient must be improved before the corresponding decision variable gets a value different from zero. In our example, x1 and x2 have values different from zero, and both reduced costs are 0. If we change the objective function in our example to:

    Z 80x1 500x2

    then the optimal solution will be x1 0 and x2 800. (Try this yourself.) The sensitivity analysis will then show a reduced cost 20 for the objective coef-ficient of x1. The objective coefficient in this example is profit and is shown as a negative value when presented as a cost. Profit per unit must be increased by $20 for product 1 to make it profitable.

    Figure 2.16 Sensitivity report

  • 21

    Sensitivity analysis

    Shadow prices

    From Figures 2.12.3, it is obvious that capacity changes in the moulding or sol-Figures 2.12.3, it is obvious that capacity changes in the moulding or sol-2.3, it is obvious that capacity changes in the moulding or sol-2.3, it is obvious that capacity changes in the moulding or sol-.3, it is obvious that capacity changes in the moulding or sol-3, it is obvious that capacity changes in the moulding or sol-, it is obvious that capacity changes in the moulding or sol-dering department will result in new optimal solutions. We understand that any increased capacity in one of these departments will increase maximum profit. Let us assume that capacity in the soldering department is increased by 100 hours per year to a total of 1 300 hours per year. The new capacity line for this depart-ment will be:

    x1 x2 1 300

    As indicated in Figure 2.17, the feasible region expands. As the objective function line is moved outwards, a new optimal solution is defined by the two capacity lines for the moulding and soldering departments:

    Moulding

    Soldering

    x x x

    x x x1 2 1

    1 2 2

    5 4000 625

    1300

    + = =

    + =

    == 675}

    Total profit will be:

    Z $300 625 $500 675 $525 000

    This represents an increase of $25 000 compared to a total profit per year of $500 000 using the old capacity in the soldering department. A capacity increase of 100 hours per year in the soldering department results in a total profit increase of $25 000. Profit increase per hour capacity increase is:

    $$

    25 000100

    250 1hours

    hour

    Since one hour capacity increase results in $250 profit increase, we are willing to pay up to $250 for one hour capacity increase in the soldering department. The shadow price for the soldering department is then $250.

    (2.20)

    (2.21)

    x2

    x1

    New optimal solution

    Objective function line

    New capacity line forsoldering department

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Figure 2.17 New optimal solution for Sygitron

  • Chapter 2 Linear programming

    22

    The sensitivity report in Figure 2.16 indicates that shadow prices for the assem-Figure 2.16 indicates that shadow prices for the assem-2.16 indicates that shadow prices for the assem-.16 indicates that shadow prices for the assem-16 indicates that shadow prices for the assem- indicates that shadow prices for the assem-bly and inspection departments are 0. This is obvious, since these constraints are not binding, and the departments have unused capacity. Increased capacity has no value for these departments. Excel defines a shadow price as the amount by which the objective function value changes when the corresponding constraints right side increases by one unit. For the minimisation problem in Section 2.4 shadow prices for the two binding constraints x1 x2 6 and x1 2x2 10 will be 3 and 1, respectively, in the Excel sensitivity report. If the right side of the constraint is increased from 6 to 7, Z moves in the same direction, and increases from 8 to 11. If the right side of the constraint is increased from 10 to 11, Z moves in the opposite direction, and is reduced from 8 to 7. Other software may use other conventions for the signs of shadow prices. Irrespective of software, the following definition should always lead to a proper interpretation. The absolute value of a shadow price indicates the amount by which the objective function will be improved when the corresponding con-straint is lessened by one unit. A constraint is lessened by decreasing its right side, and a constraint is lessened by increasing its right side.

    Constraint quantity value ranges

    As capacity in the soldering department is increased, the capacity line is dis-placed outwards and new optimal solutions occur (Figure 2.17). If this capacity is increased sufficiently, the soldering department will get free capacity (and shadow price 0). As illustrated in Figure 2.18, this constraint will no longer be binding and the optimal solution will be given by the intersection of the capacity lines for the moulding and assembly departments. Another aspect of the sensitiv-ity analysis is to show precisely how much these constraints can change before these new situations arise. The sensitivity report in Figure 2.16 indicates the range for each constraint, telling how much the constraint can be changed in both directions before its

    x2

    x1

    Moulding

    Objective function line

    Soldering

    Assembly

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Figure 2.18 New optimal solution for Sygitron

  • 23

    Duality

    shadow price changes. This is presented as Constraint R.H. Side with Allowable Increase and Allowable Decrease. For the soldering department the range is defined by the two values:

    1 200 400 800 1 200 133 1 333

    The two corner points defined by these two limits are illustrated in Figure 2.19.

    In the original optimal solution (Figure 2.3) the assembly department is not binding. It does not define the optimal solution and has a shadow price 0. The sensitivity report in Figure 2.16 indicates that the range of this constraint is between 1 700 hours and infinity. This is obvious. An increase in capacity will never alter the situation because the assembly department is not binding in the first place. On the other hand, if capacity is reduced to 1 700 hours, the con-straint will become binding.

    Other forms of sensitivity analysis

    Other changes in a model that affect the value of the objective function must be investigated manually in Excel. These include changes of parameter values on the left side of a constraint, additional constraints, additional decision variables, etc. To study these effects, you need to solve the problem again after introducing any changes.

    2.7 Duality

    Every linear programming problem, called a primal problem, can be converted into a dual problem. Lets return to the Sygitron example and denote this as the primal problem:

    x2

    x1

    Moulding

    Objective function line

    Soldering

    Assembly

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Figure 2.19 Constraint quantity value ranges for the soldering department

  • Chapter 2 Linear programming

    24

    Maximise

    Moulding

    Z x x

    x

    = +300 5001 2

    1

    Constraints:

    ++

    +

    +

    5 4000

    1200

    2

    2

    1 2

    1 2

    x

    x x

    x x

    Soldering

    Assembly

    +

    2000

    2 5 5000

    01 2

    1 2

    Inspection x x

    x x,

    This primal problem can be converted into a dual problem. The dual problem appears when we rotate the primal problem a half turn around a diagonal and imaginary axis going upwards to the right. The decision variables in the dual problem are designated by u1, ..., u4.

    Minimise Z u u u u= + + +4000 1200 2000 50001 2 3 4Constraintss:

    Product 1

    Product 2

    u u u u

    u u u1 2 3 4

    1 2 3

    2 2 300

    5

    + + +

    + + ++

    5 500

    04

    1 2 3 4

    u

    u u u u, , ,

    We notice that the values on the right side of the constraints in the primal problem 2.22, turn into parameters in the objective function in the dual problem 2.23. The parameters 1, 1, 2 and 2 before x1 at the left side of the constraints in the primal problem, turns into the left-side parameters for the first constraint in the dual problem. The second constraint in the dual problem is formulated in a similar manner from the parameters before x2 at the left side of the constraints in the primal problem. Since 2.23 is the dual problem of 2.22, then 2.22 is the dual problem of 2.23. The number of decision variables in the dual problem is always equal to the number of constraints in the primal problem, and vice versa. If the primal is a maximisation problem, the dual will be a minimisation problem, and vice versa. The primal problem 2.22 is a maximisation problem with constraints of the type and decision variables that are equal to or greater than zero. Such a problem is said to be in canonical form (standard form). The corresponding dual problem 2.23 is also in canonical form, which results in constraints of the type . We will not explain why this is so, but rather refer to more comprehensive textbooks such as Dantzig and Thapa. If the primal problem has a bounded solution, the dual problem will have a corresponding solution. The value of the objective functions will be the same for the solutions of the primal and the dual problem. For these solutions, the values of the decision variables in the dual problem equals the shadow prices in the primal problem, and vice versa. This means that finding the optimal solution of the dual problem is the same as finding the optimal use of available resources. In

    (2.22)

    (2.23)

  • 25

    Duality

    optimal solutions, slack in constraints in the dual problem equals reduced costs in the decision variables of the primal problem, and vice versa. Sensitivity reports for the primal problem 2.22 and the dual problem 2.23 are given in Figure 2.16 and Figure 2.20 respectively. The two reports are summarised in Table 2.2. In optimal solutions, the decision variables in the dual problem have the same values as the shadow prices in the primal problem, and vice versa. In Figure 2.20, the slack for a constraint is calculated as Constraint R.H. Side minus Final Value. Table 2.2 also shows that slack for constraints in the primal problem equals reduced costs in the dual problem, and vice versa.

    The solution of the primal problem can also be found from the solution and the sensitivity analysis of the dual problem. For the Sygitron example, we see in Figure 2.20 that for the dual problem, only u1 and u2 have values different from zero. This means that the only constraints with shadow prices different

    Figure 2.20 Sensitivity report for the Sygitron dual problem

    Primal problem Dual problem

    Solutions x1 500, x2 700 u1 50, u2 250, u3 0, u4 0

    Shadow prices Moulding 50, Soldering 250, Assembly 0, Inspection 0

    Product 1 500, product 2 700

    Slack Moulding 0, Soldering 0, Assembly 300, Inspection 500

    Product 1 0, product 2 0

    Reduced costs For x1 0, for x2 0 For u1 0, for u2 0,for u3 300, for u4 500

    Table 2.2 Results for the primal and dual problem of the Sygitron example

  • Chapter 2 Linear programming

    26

    from zero, is moulding and soldering. These two constraints define the optimal solution:

    Moulding

    Soldering

    x x x

    x1 2 1

    1

    5 4000 500+ = =

    +

    xx x2 21200 700= =}

    The same values can also be found directly from the shadow prices for the two constraints in the dual problem.

    The dual problem minimises alternative cost

    The values of the decision variables in an optimal solution for a dual problem will always be equal to the shadow prices for the primal problem. In the optimal solution for the Sygitron example, a shadow price equals the reduction of total profit per year when capacity is reduced by one hour per year in a department. If capacity in the soldering department is reduced by one hour, total profit is reduced by $250. In the moulding department, one hour reduced capacity results in $50 of reduced profit. In the assembly department one hour reduced capac-ity doesnt influence profit, since the shadow price is 0. A shadow price can be interpreted as the alternative cost of using one hour of capacity, i.e. the cost of using a limited resource. Minimising the objective function in a dual problem means minimising the total alternative cost of using the limited resources. Thus the available resources are used in an optimal way. The primal problem 2.22 tells us that product 1 contributes with a profit of $300 per unit. In the dual problem 2.23, this value appears as the right side of the first constraint. The parameters before u1, ..., u4 on the left side of the same con-straint, are the same as the parameters before x1 in the constraints for the primal problem. Then the left side of the first constraint in the dual problem represents the value of using the resources to produce something other than product 1. In this case the only alternative is product 2. If the value of this left side exceeds the right side in the optimal solution, the resources should not be applied for producing product 1, since alternative applications result in higher profit. Such an incident, with left side right side for the first constraint in the dual problem, means slack for the constraint. This slack represents reduced cost for product 1. In the Sygitron example, the left side equals the right side in the constraint. Then the resources are used in an optimal way, reduced cost equals 0, and product 1 should be produced. Lets illustrate the same points again by changing the Sygitron example so that product 1 contributes only $80 per unit. The constraints are unchanged, but the objective function changes to:

    Maximise Z 80x1 500x2

    The optimal solution of this primal problem is x1 0 and x2 800, illustrated by point B in Figure 2.21. The sensitivity analysis in Excel shows that reduced costs for x1 and x2 are 20 and 0 respectively.

    (2.24)

  • 27

    Conclusions

    The corresponding solution of the dual problem is u1 100 and u2 u3 u4

    0. In this optimal solution, the two constraints in the dual problem show that:

    Product 1

    Product

    u u u u1 2 3 42 2 80 100 80+ + + 2 5 5 500 500 5001 2 3 4u u u u+ + +

    The first constraint has a slack 100 80 20, equal to minus reduced cost for x1. Lets take a closer look at this point by studying alternative cost. If a product is produced, it is required that revenues costs when we use the resources on this product instead of the alternatives. The optimal solution of the primal problem is point B in Figure 2.21 with x1 0 and x2 800. Here, only the capacity of the moulding department is fully utilised, with a shadow price of $100 per hour. The cost of using the moulding department time resources for producing one unit of product 1, is the time consumed by one unit multiplied by the shadow price: 1 hour $100 hour1 $100. This is more than the profit of $80 per unit. Then the resources should not be used for producing product 1. We see that profit per unit of product 1 must increase by $20 before product 1 should be set into produc-tion. This makes perfect sense since the shadow price of product 1 is $20 in this optimal solution.

    Conclusions

    A problem where all decision variables are linearly related can be solved using linear programming.

    A linear programming model with two decision variables can be solved graphically.

    Excels Solver is an appropriate tool to solve small linear programming models.

    In addition to an optimal solution, Solver can produce a sensitivity report with valuable information about a linear programming model.

    The dual problem in linear programming gives a deeper understanding of the primal problem.

    (2.25)

    BA

    x2

    x1

    Moulding

    Soldering

    Assembly

    1 200

    1 000

    800

    600

    400

    200

    0

    2000

    400

    600

    800

    1 000

    1 200

    Figure 2.21 Feasible region for the Sygitron example

  • Chapter 2 Linear programming

    28

    Problems

    2.1 A manufacturer produces product 1 and 2 giving a profit per unit of $80 and $60 respectively. Both products are processed by the two machines A and B. Each machine has a capacity of 1 200 hours per year. Each unit of product 1 needs 1 hour at machine A and 3 hours at machine B. Each unit of product 2 needs 2 hours at machine A and 1 hour at machine B.

    (a) How many units should the manufacturer produce of product 1 and 2 per year? Solve the problem using both the graphical method and Excel.

    (b) What is the value of increasing the capacity for machine B with one extra hour per year?

    (c) Assume now that the production of each unit of product 2 consumes 3 lbs of a special alloy, and that supply of this alloy is limited to 600 lbs per year. How many units should the manufacturer produce of product 1 and 2 per year?

    (d) Assume that profit of product 2 is reduced by $40 per unit. How many units should the manufacturer produce of product 1 and 2 per year?

    (e) The answer in (d) should be 0 units of product 2. How much must the profit per unit of product 2 increase (from $20) to make it profitable to produce this product?

    2.2 Consider the following linear programming model:

    Maximise Z 20x1 15x2 Constraints:

    A 3x1 4x2 1 200

    B x1 5x2 1 100

    C 3x1 x2 900

    x1, x2 0

    (a) Solve the problem graphically.

    (b) Find the shadow price for constraint A.

    (c) By how much must the parameter before x2 in the objective function increase to give a new optimal solution? (Note: the parameter 20 before x1 is constant.)

    2.3 Consider the following linear programming model:

    Maximise Z 5x1 7x2

    Constraints:

    A 2x1 3x2 6

    B x1 6x2 4

    C 3x1 4x2 6

    D 3x1 2x2 30

    x1, x2 0

  • 29

    Problems

    (a) Solve the problem graphically.

    (b) How much can the parameter 7 before x2 in the objective function be reduced without changing the optimal solution?

    (c) Find the shadow price for constraint A.

    (d) Find the shadow price for constraint D.

    2.4 A company manufactures products X, Y and Z, and all of them are processed on machines A, B and C. Profit per unit (in $), time consumption (in hours) for different products on different machines and machine capacities are given below.

    The company wants to maximise profit. Solve the problem without using a computer.

    2.5 A food supplement is made by mixing two ingredients called 1 and 2. One batch of the supplement should contain a minimum amount of vitamin A, B, C and D according to the table below. Amounts of vitamins in the two ingredients are also given. All amounts are in milligrams:

    The cost of ingredient 1 is twice the cost of ingredient 2. How many kilograms of the two ingredients should be mixed together in each batch to obtain minimum cost? There are 1 000 milligrams in one gram, and 1 000 grams in one kilogram.

    2.6 An investor wants to invest $15 000 000 in a portfolio that may include bonds, certificates, treasury bills and stocks. The expected annual returns are given in the table below. The investor also wants to diversify the investments, and has decided maximum amounts for each security.

    X Y Z Capacity (hours)

    Machine A 1 2 3 12 000

    Machine B 3 1 2 12 000

    Machine C 2 3 1 12 000

    Profit per unit (in $) 10 10 10

    A B C D

    Required amount in one batch of supplement

    0.14 18.0 500 0.30

    Amount in one kg of ingredient 1 0.70 0.0 50 0.08

    Amount in one kg of ingredient 2 0.00 6.0 100 0.02

  • Chapter 2 Linear programming

    30

    In addition, the investor has decided that at least 60% of the investments should be in treasury bills and stocks, and at least 10% in bonds. He has also decided that the sum invested in bonds and certificates must exceed the amount invested in treasury bills. The investor wants a maximum return on his investments. Find the optimal composition of the portfolio.

    2.7 A bank may employ people on a full-time or part-time basis. The opening hours are from 09:00 to 19:00. After some research the bank has found the following need for employees during the day:

    The employees may start their working day at 09:00, 10:00, etc., but they must finish by 19:00. Full-time employees work 4 hours, have 1 hour lunch, and work 3 hours. They do not get paid for the lunch hour. Part-time employees work 4 hours continu-ously. A full-time employee gets paid 18 per hour, and a part-time employee 17 per hour. The bank wants to minimise total cost, and needs to find out how many full-time and part-time employees they should hire. They also want to know how many of them should start at 09:00, at 10:00, etc. Solve the problem using an LP model.

    2.8 We want to carry out a survey and interview at least 5 000 respondents. In addi-tion, the following requirements must also be met:

    At least 2 000 respondents must 30 years old or younger.

    At least 1 200 respondents must be between 31 and 50 years old.

    Expected annual return

    Maximum amount

    Bonds 5% $3 000 000

    Certificates 8% $7 000 000

    Treasury bills 13% $6 000 000

    Stocks 16% $5 000 000

    Time period Number of employees

    09:0010:00 5

    10:0011:00 8

    11:0012:00 5

    12:0013:00 10

    13:0014:00 11

    14:0015:00 7

    15:0016:00 4

    16:0017:00 5

    17:0018:00 8

    18:0019:00 7

  • 31

    Problems

    At least 12% of the respondents must live in Norwich.

    Less than 20% of the respondents who are above 51 years old, must live in Norwich.

    Costs associated with interviewing respondents of different ages in Norwich and outside is (in ):

    The survey should be completed at minimum cost. Solve the problem using Excel.

    2.9 Bestvold Ltd manufactures small electrical motorbikes for children. Each bike is assembled from one motor, two wheels, one frame and one battery. The batteries are bought from an external supplier. The other components can either be bought externally or produced by the company itself. For the next year Bestvold Ltd plans to produce 10 000 bikes.

    Components produced by the company itself will be processed in departments A, B and C. Time consumption (in minutes) for the various components in the different departments and machine capacities per year (in hours) are given below.

    Costs per unit (in $) when buying or producing are:

    (a) The company wants to minimise costs. Solve the problem and find the optimal number of motors, wheels and frames that should be bought and that should be produced by the company itself.

    Age 30 years 31 years Age 50 years

    Age 51 years

    Living in Norwich 1.53 1.38 1.12

    Living outside Norwich 1.40 1.47 1.29

    Time consumption (in minutes) A B C

    One motor 7.8 5.3 8.1

    One wheel 3.8 4.9 7.6

    One frame 2.0 0 4.2

    Capacity per year (in hours) 1 200 1 300 2 200

    Buy Produce

    One motor 15.5 7.35

    One wheel 9.8 2.2

    One frame 5.7 1.15

  • Chapter 2 Linear programming

    32

    (b) Find the time consumption per year in department A, B and C, respectively.

    (c) What is the maximum price the company should pay for one hour increased capacity in department C?

    (d) What is the maximum price the company should pay for one hour increased capacity in department B?

    2.10 ProCruiser Inc. is planning next years production of their LuxCruiser. At the beginning of the first quarter they have an inventory of 70 boats. Expected sales and production capacities are as indicated below.

    Production costs are expected to be $80 000 per boat for the 1st quarter, and will increase with 10% every quarter. Inventory costs are estimated to be $2 000 per boat for the 1st and 2nd quarter, and $2 400 per boat for the 3rd and 4th quarter respec-tively. (Relate these costs to the inventory at the end of each quarter.) ProCruiser has decided to have an inventory of at least 300 boats at the end of quarter 4. Find an optimal production plan for quarters 1 to 4.

    The sensitivity report gives the following information about the capacity constraint limiting production to 1 200 boats for the 3rd quarter:

    Explain these values.

    Expected sales (number)

    Capacity (number)

    1st quarter 1 200 2 200

    2nd quarter 2 000 1 600

    3rd quarter 1 600 1 200

    4th quarter 800 2 100

    Final value

    Shadow price

    Constraints r.h. side

    Allowable increase

    Allowable decrease

    1 200 7 280 1 200 830 270

  • 33

    Problems

    2.11 Which of the following problems can be solved?

    (a) Maximise = 2

    :

    A 3 30

    B

    1 2

    1 2

    1

    Z x x

    x x

    x

    +

    + Constraints

    2 20

    C 20

    , 0

    2

    1 2

    1 2

    x

    x x

    x x

    +

    (b) Maximise

    :

    A

    B

    C

    Z x x

    x

    x

    x

    = +

    1 2

    1

    1

    2

    100

    300

    30

    Constraints

    00

    2 400

    01 2

    1 2

    D x x

    x x

    + ,

    (c) Maximise

    A

    B

    C

    Z x x

    x x

    x x

    = +

    +

    +

    4

    3 2 6

    4

    1 2

    1 2

    1 2

    Constraints:

    33 8

    0

    0

    1 2

    1 2

    1 2

    x x

    x x

    x x

    D

    ,

    (d) Maximise Z x x

    x x

    x x

    = +

    +

    6 2

    2 3 120

    0

    1 2

    1 2

    1 2

    Constraints:

    ,

    2.12 Examine (a)(d) in problem 2.11. If dual problems can be solved, formulate the dual problems. Find the optimal solutions, and verify that these solutions correspond to the shadow prices for the primal problem.

  • Chapter 2 Linear programming

    34

    Further reading

    Bazaraa, M. S., Jarvis, J. J. and Sherali, H. D., Linear Programming and Network Flows, Wiley, 2009.

    Dantzig, G. B. and Thapa, M. N., Linear Programming; 1: Introduction, Springer, 1997.

    Dantzig, G. B. and Thapa, M. N., Linear Programming; 2: Theory and Extensions, Springer, 2003.

    Vaserstein, L. N., Introduction to Linear Programming, Prentice Hall, 2003.