OD Linear Programming 2010

download OD Linear Programming 2010

of 38

Transcript of OD Linear Programming 2010

  • 7/24/2019 OD Linear Programming 2010

    1/38

    1

    LINEAR PROGRAMMING

    Introduction

    Development of linear programming was among the

    most important scientific advances of mid-20th cent.

    Most common type of applications: allocate limited

    resourcesto compet ing act ivit iesin an optimal way.

    Very large and wide range of applications from local to

    very global ones.

    Linear programming uses a mathematical model.

    Linear because it requires linear functions.

    Programming as synonymous ofplanning.

    31

  • 7/24/2019 OD Linear Programming 2010

    2/38

    2

    Introduction

    Besides allocate resources to activities, anyproblem

    described by a mathematical model can be solved.

    Very efficient solution procedure: simplex method.

    This method will be described next as well as the

    interior-point algorithmfor larger problems.

    Besides these algorithms, we will also discuss

    sensit ivit y analysis.

    32

    Prototype example

    Wyndor Glass Co. produces glass products, including

    windows and glass doors.

    Plant 1 produces aluminum frames, Plant 2 produces

    wood frames and Plant 3 produces glass and

    assembles.

    Two new products:

    Glass door with aluminum framing (Plant 1 and 3)

    New wood-framed glass window (Plant 2 and 3)

    As the products compete for Plant 3, the most

    profitable mixof the two products is needed.

    33

  • 7/24/2019 OD Linear Programming 2010

    3/38

    3

    Data for Wyndor Glass Co.

    34

    Wyndor Glass Co. Produ ct-Mix Probl em

    Doors Windows

    Profit Per Batch $3.000 $5.000

    (Batches of 20)

    Hours available

    per week

    Plant 1 1 0 4

    Plant 2 0 2 12

    Plant 3 3 2 18

    Hours Used Per Batch Produced

    Formulation of the LP problem

    x1 = number of batches of product 1 produced per week

    x2 = number of batches of product 2 produced per week

    Z= total profit per week (in thousands)

    35

    1 2maximize 3 5Z x x

    1

    2

    1 2

    subject to 4

    2 12

    3 2 18

    x

    x

    x x

    1 2and 0, 0.x x

  • 7/24/2019 OD Linear Programming 2010

    4/38

    4

    Graphical solution

    Trial-and-error: Z = 10, 20, 36

    Slope of the line is 3/5:

    36

    1 2maximize 3 5Z x x

    1

    2

    1 2

    subject to 42 12

    3 2 18

    xx

    x x

    1 2and 0, 0.x x

    2 1

    3 1

    5 5x x Z

    Feasible region:

    satisfiesall

    constraints

    Solution (using Excel)

    37

    Wyndo r Glass Co. Produ ct-Mix Problem

    Doors Windows Range Name Cel ls

    Profit Per Batch $3.000 $5.000 BatchesProduced C12:D12

    Hours Hours HoursAvailable G7:G9

    Used Available HoursUsed E7:E9

    Plant 1 1 0 2

  • 7/24/2019 OD Linear Programming 2010

    5/38

  • 7/24/2019 OD Linear Programming 2010

    6/38

    6

    Standard form

    40

    1 1 2 2maximize n nZ c x c x c x

    11 1 12 2 1 1

    21 1 22 2 2 2

    1 1 2 2

    subject to

    n n

    n n

    m m mn n m

    a x a x a x b

    a x a x a x b

    a x a x a x b

    1 2and 0, 0, , 0.

    nx x x

    Other possible forms

    Minimizing rather then maximizing

    Some functional constraints are greater-than-or-equal

    Some functional constraints in equation form

    Deleting the non-negativity constraints for some vars

    41

    1 1 2 2minimize n nZ c x c x c x

    1 1 2 2 , for some values ofi i in n ia x a x a x b i

    1 1 2 2, for some values of

    i i in n ia x a x a x b i

    unestricted in sign for some values ofj

    x i

  • 7/24/2019 OD Linear Programming 2010

    7/38

    7

    Allocation of resources to activities

    42

    Resource

    Resource Usage per Unit of Activity

    Amount of

    Resource

    available

    Activity

    1 2 n

    1 a11 a12 a1n b1

    2 a21 a22 a2n b2

    m am1 am2 amn bm

    Contribution

    toZper unitof activity

    c1 c2 cn

    Terminology for solutions

    Solution: any specification of values for the decision

    variables (x1,x2,,xn).

    Feasible solution: solution for which allthe constraints

    are satisfied.

    Infeasible solution: solution for which at least one

    constraint is violated.

    Feasible region

    No feasible solution: no solution satisfies all

    constraints.

    43

  • 7/24/2019 OD Linear Programming 2010

    8/38

    8

    Example: no feasible solution

    If in the Wyndor Glass Co. problem the profit should

    be above $50000 per week:

    44

    Terminology for solutions

    Optimal solution: solution with the most favorable

    value.

    Most favorable value: largest valueifmaximizingor

    smallest value ifminimizing.

    No optimal solutions: (1) no feasible solutions or,

    (2) unbounded Z(see next slide).

    More than one solution: see next slide.

    45

  • 7/24/2019 OD Linear Programming 2010

    9/38

    9

    Examples of solutions

    More than one solution Unbounded cost function

    46

    Corner-point feasible solution

    Lies in a corner. Corners must have at least one

    optimal solution.

    47

  • 7/24/2019 OD Linear Programming 2010

    10/38

    10

    Assumptions of linear programming

    Proportionality: value of objective function Z is

    proportional to level of activity xj.

    Violations: 1) Setup costs

    48

    Violations of proportionality

    2) Increase of marginal returndue to economy of

    scale (longer production runs, quantity discounts,

    learning-curve effect, etc.)

    49

  • 7/24/2019 OD Linear Programming 2010

    11/38

    11

    Violations of proportionality

    3) Decrease of marginal returndue to e.g. marketing

    costs: to sell more the advertisement grows

    exponentially.

    50

    Assumptions of linear programming

    Additivity: everyfunction in a linear programming

    model is the sum of the individual contributions.

    Divisibility: decision variables can have any values.

    If values are limited to integer values, the problem

    needs an integer programmingmodel.

    Certainty: parameters of the model cj,aij andbi are

    assumed to be known constant s.

    In real applications parameters have always some

    degree of uncertainty, and sensitivity analysis must be

    conducted.

    51

  • 7/24/2019 OD Linear Programming 2010

    12/38

    12

    Conclusions

    Linear programming models can be solved using:

    Spreadsheet as Excel Solver for relatively simple

    problems

    Problems with thousands (or even millions!) of decision

    variables and/or functional constraints must use

    modeling languages such as: CPLEX/MDL or

    LINGO/LINDO

    Matlab Optimization Toolbox

    Linear programming solves many problems.

    However, when one or more assumptions are violated

    seriously, other programming techniques are needed.

    52

    SIMPLEX METHOD

  • 7/24/2019 OD Linear Programming 2010

    13/38

    13

    Simplex method

    Algebraic procedure with underlying geometric

    concepts.

    Definitions:

    Constraint boundary: line of boundary of the

    constraint.

    Corner-point solution

    Corner-point feasible solution (CFP solution)

    CFP solutions are adjacent if they share n 1 constraint

    boundaries.

    The line segment between two CFP solutions is an edge.

    54

    Example revisited

    Wyndor Glass Co.

    55

  • 7/24/2019 OD Linear Programming 2010

    14/38

  • 7/24/2019 OD Linear Programming 2010

    15/38

    15

    Steps of simplex algorithm

    Sequence of CFP solutions:

    58

    Setting up the simplex method

    Original form Augmented form

    59

    1 2maximize 3 5Z x x

    1

    2

    1 2

    subject to 4

    2 12

    3 2 18

    x

    x

    x x

    1 2and 0, 0.x x

    1 2maximize 3 5Z x x

    3

    4

    5

    1

    2

    1 2

    subject to

    (1) 4

    (2) 2 12

    (3) 3 2 18

    x

    x

    x

    xx

    x

    x

    and 0, 1,2,3,4,5.j

    x j

    Convert functional inequality constraintsto equivalent

    equality constraintsusing slack variables.

  • 7/24/2019 OD Linear Programming 2010

    16/38

  • 7/24/2019 OD Linear Programming 2010

    17/38

    17

    Properties of a basic solution

    Each variable is basic or nonbasic.

    Number of basic variables is equal to number of

    functional constraints (equations).

    The nonbasic variables are set to zero.

    Values ofbasic variables are solving system of

    equations (functional constraints in augmented

    form).

    Set of basic variables are called the basis. If basic variables satisfy the nonnegativity constraints

    basic solution is a BF solution.

    62

    Final form

    63

    maximize Z

    1 2

    1 3

    2 4

    1 2 5

    subject to

    (0) 3 5 0

    (1) 4

    (2) 2 12

    (3) 3 2 18

    Z x x

    x x

    x x

    x x x

    and 0, 1, ,5.j

    x j

  • 7/24/2019 OD Linear Programming 2010

    18/38

    18

    Tabular form (simplex tableau)

    64

    a) Algebraic form b) Tabular Form

    Basic

    variable

    Eq.

    Coefficient of:

    Right

    side

    x

    1

    x

    2

    x

    3

    x

    4

    x

    5

    (0) 3x1 5x2 = 0 Z (0) 1 -3 -5 0 0 0 0

    (1) x1 +x3 = 4 x3 (1) 0 1 0 1 0 0 4

    (2) 2x

    2 +x

    4 =12 x

    4 (2) 0 0 2 0 1 0 12

    (3) 3x1+ 2x2 +x5 =18 x5 (3) 0 3 2 0 0 1 18

    Simplex method in tabular form

    Initialization. Introduce slack variables. Select decision

    variables to be initial nonbasic variables and slack

    variables to be initial basic variables.

    Initial solution of example: (0, 0, 4, 12, 18)

    Optimality test. Current BF solution is optimal if every

    coefficient in row zero is nonnegative. If yes, stop.

    Example: coefficients ofx1 andx2 are 3 and 5.

    65

  • 7/24/2019 OD Linear Programming 2010

    19/38

  • 7/24/2019 OD Linear Programming 2010

    20/38

  • 7/24/2019 OD Linear Programming 2010

    21/38

    21

    Complete set of simplex tableau

    70

    Iteration Basic variable Eq.

    Coefficient of:

    Right side

    x

    1

    x

    2

    x

    3

    x

    4

    x

    5

    Z (0) 1 -3 -5 0 0 0 0

    0 x3 (1) 0 1 0 1 0 0 4

    x4 (2) 0 0 2 0 1 0 12

    x5 (3) 0 3 2 0 0 1 18

    Z (0) 1 -3 0 0 2.5 0 30

    1 x3 (1) 0 1 0 1 0 0 4

    x2 (2) 0 0 1 0 0.5 0 6

    x5 (3) 0 3 0 0 -1 1 6Z (0) 1 0 0 0 1.5 1 36

    2 x3 (1) 0 0 0 1 1/3 -1/3 2

    x2 (2) 0 0 1 0 0.5 0 6

    x1 (3) 0 1 0 0 -1/3 1/3 2

    Other model forms

    Equality constraints

    In this case, artificial variables are used. The Big M

    method is used.

    Functional constraints in form

    Surplus variables are used.

    Minimization

    Maximize Z.

    Big M method can have two phases: 1) all artificial

    variables driven to zero; 2) compute BF solutions.

    71

  • 7/24/2019 OD Linear Programming 2010

    22/38

    22

    Postoptimality analysis

    Reoptimization: when the problem changes slightly,

    new solution is derived from thefinalsimplex tableau.

    Shadow price for resource i(denoted yi*) is the

    marginal value ofi.

    i.e. the rate at whichZcan be increased by slightly

    increasing the amount of this resource bi.

    Example: recall bivalues ofWyndor Glass problem.

    The final tableau gives:

    y1* = 0, y2

    * = 1.5, y3* = 1.

    72

    Graphical check

    Increasing b2 in 1 unit, the new profit is 37.5

    73

  • 7/24/2019 OD Linear Programming 2010

    23/38

    23

    Shadow prices

    Increasing b2 in 1 unit increases the profit in $1500.

    Should this be done? Depends on the marginal

    profitability of other products using that hour time.

    Shadow prices are part of the sensit ivit y analysis.

    Constraint on resource 1 is not bindingthe optimal

    solution. Resources as this are free goods.

    Constraints on resources 2 and 3 are binding

    constraints. Resources are scarce goods.

    74

    Sensitivity analysis

    Identify sensitive parameters (those that cannot be

    changed without changing optimal solution).

    Parameters bican be analyzed using shadow prices.

    Parameters ci for Wyndor example (see figure in next

    slide).

    Parameters aijcan also be analyzed graphically.

    For problems with a large number of variables usually

    only biand ciare analyzed, because aijare determined

    by the technology being used.

    75

  • 7/24/2019 OD Linear Programming 2010

    24/38

    24

    Sensitivity analysis of parameters ci

    Graphical analysis of

    Wyndor example:

    c1 = 3 can have values in

    [0, 7.5] without changing

    optimal

    c2 = 5 can have any value

    greater than 2 without

    changing optimal

    76

    Interior-point approach

    Discovery made in 1984 by Narendra Karmarkar.

    Used in hugelinear programming problems, beyond

    the scope of the simplex method.

    Starts by identifying a feasible t rial solution, moving a

    better one until it reaches the optimal trial solution.

    Trial solutions are interior points.

    Interior-point or barrier algorithms (each constraint

    boundary is treated as a barrier).

    77

  • 7/24/2019 OD Linear Programming 2010

    25/38

  • 7/24/2019 OD Linear Programming 2010

    26/38

    26

    Augmented form

    80

    1 1 1 1maximize n n n n n m n mZ c x c x c x c x

    11 1 12 2 1 1 1

    21 1 22 2 2 2 2

    1 1 2 2

    subject to

    n n n

    n n n

    m m mn n n m m

    a x a x a x x b

    a x a x a x x b

    a x a x a x x b

    and 0, 1,2, , .j

    x j m

    Matrix form (standard form)

    81

    maximize Zcx

    subject to

    and Ax b x 0

    1 2[ , , , ],nc c cc

    1

    2,

    n

    x

    x

    x

    x

    1

    2,

    m

    b

    b

    b

    b

    0

    0,

    0

    0

    11 12 1

    21 22 2

    1 2

    .

    n

    n

    m m mn

    a a a

    a a a

    a a a

    A

  • 7/24/2019 OD Linear Programming 2010

    27/38

  • 7/24/2019 OD Linear Programming 2010

    28/38

    28

    Revised simplex method

    1. Initialization: (as original) Introduce slack variables xs.

    Decision variables are initial nonbasic variables.

    2. Iteration:

    Step 1: (as original) Determine entering basic variable

    (nonbasic variable with the largest negative

    coefficient).

    Step 2: Determine leaving basic variable. As original,

    but computations are simplified.

    Step 3: Determine new BF solution: set xB = B1b.

    3. Optimality test: solution is optimal if every

    coefficient inZis 0. Computations are simplified.

    84

    DUALITY THEORY ANDSENSITIVITY ANALYSIS

  • 7/24/2019 OD Linear Programming 2010

    29/38

    29

    Duality theory

    Every linear programming problem (primal) has a dual

    problem.

    Most problem parameters are estimates, others (as

    resource amounts) represent managerial decisions.

    The choice of parameter values is made based on a

    sensit ivit y analysis.

    Interpretation and implementation of sensitivity

    analysis are key uses of duality theory.

    86

    Primal and dual problems

    87

    1

    maximizen

    j j

    j

    Z c x

    1

    subject to

    , for 1,2, ,n

    ij j i

    j

    a x b i m

    and 0 for 1,2, , .j

    x j n

    Primal problem

    1

    minimizem

    i i

    i

    W b y

    1

    subject to

    , for 1,2, ,m

    ij i j

    j

    a y c j n

    and 0 for 1,2, , .i

    y i m

    Dual problem

  • 7/24/2019 OD Linear Programming 2010

    30/38

    30

    Duality theory

    Relations between parameters:

    The coefficients of the objective functions of the primal

    are the right-hand sides of the functional constraints in

    the dual.

    The right-hand side of the functional constraints in the

    primal are coefficients of the objective functions in the

    dual.

    The coefficients of a variable in the functional

    constraints of the primal are the coefficients in thefunctional constraints of the dual.

    88

    Primal-dual table

    89

    Primal problem

    Coefficient of: Right

    side

    x

    1

    x

    2

    xn

    C

    c

    e

    o

    y

    1

    a11 a12 a1n b1C

    c

    e

    s

    o

    o

    e

    v

    u

    o

    m

    n

    m

    z

    e

    D

    p

    o

    e

    m

    y

    2

    a21 a22 a2n b2

    y

    an1 an2 amn bmR

    g

    s

    d

    c1 c2 cn

    Coefficients of objective function(maximize)

  • 7/24/2019 OD Linear Programming 2010

    31/38

    31

    Example: Wyndor Glass Co.

    90

    1

    2

    3 5 ,x

    Maximize Zx

    1

    2

    subject to

    1 0 4

    0 2 12

    3 2 18

    x

    x

    1

    2

    0and .

    0

    x

    x

    Primal problem Dual problem

    1 2 3

    4

    Minimize 12 ,

    18

    Z y y y

    1 2 3

    subject to

    1 0

    0 2 3 5

    3 2

    y y y

    1 2 3and 0 0 0 .y y y

    Example: Wyndor Glass Co.

    Tableau representation

    91

    x

    1

    x

    2

    y1 1 0 4

    y2 0 2 12

    y3 3 2 18

    3 5

  • 7/24/2019 OD Linear Programming 2010

    32/38

    32

    Primal-dual relationships

    Weak duality property: Ifx is a feasible solution for

    the primal problem andy is a feasible solution for the

    dual problem, then

    cxyb

    Strong duality property: Ifx* is an optimal solution for

    the primal problem andy* is an optimal solution for

    the dual problem, then

    cx

    *

    =y*

    b

    92

    Primal-dual relationships

    Complementary solutions property: At each iteration,

    the simplex method identifies a CFP solutionx for the

    primal problem and a complementary solution for the

    dual problem, where

    cx =yb

    Ifx is not optimalfor the primal problem, theny is not

    feasiblefor the dual problem.

    93

  • 7/24/2019 OD Linear Programming 2010

    33/38

    33

    Primal-dual relationships

    Complementary optimal solutions property: At the

    final iteration, the simplex method identifies an

    optimal solutionx* for the primal problem and a

    complementary optimal solutiony* for the dual

    problem, where

    cx* =y*b

    Theyi* are the shadow prices for the primal problem.

    94

    Primal-dual relationships

    Symmetry property: For anyprimal problem and its

    dual problem, all relationships between them must be

    symmetricbecause the dual of this dual problem is

    this primal problem.

    Duality theorem: The following are the only possible

    relationships between the primal and dual problems:

    95

  • 7/24/2019 OD Linear Programming 2010

    34/38

  • 7/24/2019 OD Linear Programming 2010

    35/38

    35

    Primal-dual relationships

    98

    Applications of duality theory

    If the number of functional constraints m is bigger than

    the number of variablesn, applying simplex directly to

    the dual problem will achieve a substantial reduction

    in computational effort.

    Evaluating a proposed solution for the primal

    problem. i) ifcx =yb,x andy must be optimal even

    without applying simplex; ii) ifcx

  • 7/24/2019 OD Linear Programming 2010

    36/38

    36

    Duality theory in sensitivity analysis

    Sensitivity analysis investigate the effect of changing

    parameters aij,bi,cj in the optimal solution.

    Can be easier to study these effects in the dual

    problem

    Optimal solution of the dual problem are the shadow

    prices of the primal problem.

    Changes in coefficients of a nonbasic variab le. Only

    changes one constraint in the dual problem. If this

    constraint is satisfied the solution is still optimal.

    Introducing a new variable in the object ive function.

    Only introduces a new const raintin the dual problem. If

    the dual problem is still feasible, solution is still optimal.

    100

    Essence of sensitivity analysis

    LP assumes that all the parameters of the model (aij,biandcj) are known constants.

    Actually:

    The parameters values used are just estimates based on

    a prediction of future conditions;

    The data may represent deliberate overestimates or

    underestimates to protect the interests of the

    estimators.

    An optimal solution is optimal only with respect to

    the specific model being used to represent the realproblem sensit ivit y analysisis crucial!

    101

  • 7/24/2019 OD Linear Programming 2010

    37/38

    37

    Simplex tableau with parameter changes

    What changes in the simplex tableau if changes aremade in the model parameters, namely b ,c ,

    A ?

    102

    A

    b c

    Coefficientof:

    Right side

    q. Z Original variables Slack variables

    New initialtableau

    (0) 1 0 0

    (1,2,,m) 0 I

    Revisedfinal tableau

    (0) 1 y*

    (1,2,,m) 0 S*

    c

    A b

    * *Z y b

    * *b S b

    * * z c y A c

    * *A S A

    Applying sensitivity analysis

    Changes inb:

    Allowable range: range of values for which the current

    optimal BF solution remains feasible (find range ofbisuch that , assuming this is the only change

    in the model). The shadow price for bi remains valid ifbi

    stays within this interval. The 100% rule for simult aneous changes in right-hand

    side: the shadow prices remain valid as long as the

    changes are not too large. If the sum of the % changes

    does not exceed 100%, the shadow prices will still be

    valid.

    103

    * * b S b 0

  • 7/24/2019 OD Linear Programming 2010

    38/38

    Applying sensitivity analysis

    Changes in coefficients of nonbasic variable:

    Allowable range to stay optimal: range of values over

    which the current optimal solution remains optimal

    (find , assuming this is the only change in the

    model).

    The 100% rule for simult aneous changes in object ive

    funct ion coeff icients: if the sum of the % changes does

    notexceed 100%, the original optimal solution will still

    be valid. Introduction of a new variable:

    Same as above.

    104

    *j j

    c y A

    Other simplex algorithms

    Dual simplex method

    Modification useful for sensitivity analysis

    Parametric linear programming

    Extension for systematic sensitivity analysis

    Upper bound technique A simplex version for dealing with decision variables

    having upper bounds:xj uj, where uj is the maximumfeasible value ofxj.

    105