J02 LinAlg and LPs Rev

download J02 LinAlg and LPs Rev

of 28

Transcript of J02 LinAlg and LPs Rev

  • 8/3/2019 J02 LinAlg and LPs Rev

    1/28

    MIT and James Orlin 2003

    1

    A brief review of Linear Algebra and

    Linear Programming Models

    Developed by James Orlin

  • 8/3/2019 J02 LinAlg and LPs Rev

    2/28

    MIT and James Orlin 2003

    2

    Review of Linear Algebra

    Some elementary facts about vectors andmatrices.

    The Gauss-Jordan method for solvingsystems of equations.

    Bases and basic solutions and pivoting.

  • 8/3/2019 J02 LinAlg and LPs Rev

    3/28

    MIT and James Orlin 2003

    3

    Elementary Facts about Vectors

    ? A1 2 3 4v v v v v! is called a row vector.

    1

    2

    3

    4

    ! -

    t

    v

    v

    v

    v

    v

    The transpose ofv is a column vector.

    ? A1 2 3 4w w w w w! is another row vector.

    The inner productof vectors w and v is

    given by:1 1 2 2 3 3 4 4

    v w v w v w v w v w! $

  • 8/3/2019 J02 LinAlg and LPs Rev

    4/28

    MIT and James Orlin 2003

    4

    Matrix Multiplication

    ( )!ij

    A a ( )!ij

    B b ( )! ! vij

    C c A B

    1!! k kjn

    ikji a bc

    Suppose that A has n columns and B has n rows.

  • 8/3/2019 J02 LinAlg and LPs Rev

    5/28

    MIT and James Orlin 2003

    5

    Multiplying Matrices

    Let C = (cij) = AB. Then cij is the innerproductof row iofA and column jofB.

    21 22 23

    11 12 13

    31 32 33

    a a a

    A

    a a a

    a a a

    ! -

    13

    23

    11 12

    21 22

    31 3332

    b

    b

    b

    b b

    B b b

    b b

    ! -

    For example, what is c23?

    23 21 13 22 23 23 33c a b a b a b!

  • 8/3/2019 J02 LinAlg and LPs Rev

    6/28

    MIT and James Orlin 2003

    6

    Multiplying Matrices

    Let C = (cij) = A v B. Then each column ofC is obtained by adding multiples of

    columns of A.

    1 2 3 100 123

    4 5 6 10 456

    7 8 9 1 789

    v !

    - - -

    1 2 3

    100 4 10 5 6

    7 8 9

    !

    - - -

    Similarly, eachrow of C is

    obtained byadding multiplesof rows of B.

  • 8/3/2019 J02 LinAlg and LPs Rev

    7/28

    Elementary Facts about Solving

    Equations

    1 2 3

    1 2 4 0

    2 1 1 6 x x x

    ! - - - -

    Find a linearcombination ofthe columns of

    A that equals b.

    Solve forAx= b, where

    2v1

    1 2 4

    2 1 1A

    ! -

    1

    2

    3

    x

    x

    x

    x

    -

    !0

    6b

    !

    -

    2v3 3v1

    1 2 3

    1 2 3

    2 4 0

    2 6

    x x x

    x x x

    !

    !

  • 8/3/2019 J02 LinAlg and LPs Rev

    8/28

    MIT and James Orlin 2003

    8

    Solving a

    System of Equations

    To solve a system of equations, use Gauss-Jordan

    elimination.

    x1 x2 x3 x4

    1 2 4 1 = 0

    2 1 -1 -1 = 6-1 1 2 2 = -3

  • 8/3/2019 J02 LinAlg and LPs Rev

    9/28

    MIT and James Orlin 2003

    9

    To solve the system of equations:

    1

    2

    -1

    2

    1

    1

    4

    -1

    2

    1

    -1

    2

    =

    =

    =

    0

    6

    -3

    x1

    x2 x3 x4

    Go to the animation

  • 8/3/2019 J02 LinAlg and LPs Rev

    10/28

    MIT and James Orlin 2003

    10

    b1

    b2

    b3

    =

    =

    =

    a12

    a22

    a32

    a14

    a24

    a34

    a11

    a21

    a31

    a13

    a23

    a33

    The fundamental operation: pivoting

    Pivot on a23

    x1 x2 x3 x4

    =

    =

    =

  • 8/3/2019 J02 LinAlg and LPs Rev

    11/28

    MIT and James Orlin 2003

    11

    b1

    b2

    b3

    =

    =

    =

    a12

    a22

    a32

    a14

    a24

    a34

    a11

    a21

    a31

    a13

    a23

    a33

    Pivot on a23

    What will be the next coefficient of b1?

    a32? of aij for i {2?

    x1 x2 x3 x4

    =

    =

    =

    a22/a23 a24/a23a21/a23 1 b2/a23

    Da11

    Da11

    =a11a13(a21/a23)

    0

    0

  • 8/3/2019 J02 LinAlg and LPs Rev

    12/28

    MIT and James Orlin 2003

    12

    -1

    1

    2

    1

    0

    00

    1

    0

    -1

    1

    0

    =

    =

    =

    1

    0

    0

    Jordan Canonical Form

    for an m x n matrix

    The remaining variable(s) are called non-basic.

    0

    1

    -1

    x2x1 x3 x4

    There are m columns that have been transformedinto unit vectors, one for each row. The variablesin these columns are called basic.

  • 8/3/2019 J02 LinAlg and LPs Rev

    13/28

    MIT and James Orlin 2003

    13

    -1

    1

    2

    1

    0

    00

    1

    0

    -1

    1

    0

    =

    =

    =

    1

    0

    0

    Jordan Canonical Form

    for an m x n matrix

    In the basic solution, the non-basic variables areset to 0.

    0

    1

    -1

    x2x1 x3 x4

    The basic solution is: x1 = 2, x2 = 1, x3 = -1, x4 = 0

  • 8/3/2019 J02 LinAlg and LPs Rev

    14/28

    MIT and James Orlin 2003

    14

    -1

    1

    0

    4

    -2

    3

    =

    =

    =

    There is an easily determined solution

    for every choice of non-basic variables.

    If we set x4 = 2, what solution do we get?

    0 -1

    1 1

    -1 2

    x2x1 x3 x4

    If we set x4 =

    (, what solution do we get?

    1

    0

    00

    1

    0

    1

    0

    0

    We get a feasible solution to the system of equations forevery choice of values for non-basic variables.

  • 8/3/2019 J02 LinAlg and LPs Rev

    15/28

    MIT and James Orlin 20031

    5

    1

    1

    0

    -1

    1

    0

    4

    -2

    3

    =

    =

    =

    0

    0

    -2

    3

    -3

    Another Jordan Canonical Form for

    the same system of equations

    What are the basicvariables?

    1 0 -1

    0 0 3

    0 1 1

    x2x1 x3 x4

    1

    What is the basic solution?

  • 8/3/2019 J02 LinAlg and LPs Rev

    16/28

    MIT and James Orlin 20031

    6

    Applications

    A Financial Model

    an investment model over multiple time

    periods goal: optimize the total revenues at the end of

    the time horizon

  • 8/3/2019 J02 LinAlg and LPs Rev

    17/28

    MIT and James Orlin 20031

    7

    A Financial Problem

    Sarah has $1.1 million to invest in five differentprojects for her firm.

    Goal: maximize the amount of money that isavailable at the beginning of 2006.

    (Returns on investments are on the next slide).

    At most $500,000 in any investment, except forCDs.

    Can invest in CDs, at 5% per year.

  • 8/3/2019 J02 LinAlg and LPs Rev

    18/28

    MIT and James Orlin 20031

    8

    Return on investments

    (undiscounted dollars)

    A B C D E

    Jan.2003

    -1 - -1 -1 -

    Jan.2004

    .4 -1 1.2 - -

    Jan.2005 .8 .4 - - -1

    Jan.2006

    - .8 - 1.5 1.2

  • 8/3/2019 J02 LinAlg and LPs Rev

    19/28

    MIT and James Orlin 20031

    9

    FormulateS

    arahs problem as an LP

    Payback for A: for every dollar invested inJanuary of 2003, Sarah receives $.40 in Januaryof 2004 and $.80 in January of 2005.

    FORMULATION.

    STEP 1. Choose the decision variables

    Let xA denote the amount in millions of dollars investedin A.

    Define xB, xC, xD, and xE similarly. Let x3 denote the amount put in a CD in 2003. (Define x4

    and x5 similarly)

  • 8/3/2019 J02 LinAlg and LPs Rev

    20/28

    MIT and James Orlin 200320

    Formulating the model

    With your partner formulate the LP model.

    Step 2. Formulate the objective function

    put the objective function in words first. E.G.

    we are minimizing cost or maximizingutility

    Step 3. Formulate the constraints

    Put the constraints in words first

  • 8/3/2019 J02 LinAlg and LPs Rev

    21/28

    MIT and James Orlin 200321

    The model

    Max z= .8 xB

    + 1.5 xD

    + 1.2 xE

    + 1.05 x5

    Subject to xA + xC + xD + x3 = 1.1 (Year 2003)

    .4 xA - xB + 1.2 xC + 1.05 x3 - x4 = 0 (Year 2004)

    .8 xA + .4 xB - xE + 1.05 x4 - x5 = 0 (Year 2005)

    0 e xj e .5 for j = A, B, C, D, E, 3, 4, 5

    Excel Solution

  • 8/3/2019 J02 LinAlg and LPs Rev

    22/28

    MIT and James Orlin 200322

    FAQ. Do the units matter? How does

    one choose the units?

    The units do not matter so long as one iscareful to use units correctly. It would be

    possible to have xA be in $ millions and forxB to be in dollars.

    But some choices of units are morenatural than others, and easier to use and

    to communicate.

  • 8/3/2019 J02 LinAlg and LPs Rev

    23/28

    MIT and James Orlin 200323

    Addressing Problems in Practice

    Understanding the model:

    know the purpose of the model

    vary numbers and assess the impact (sensitivityanalysis)

    discuss ways of enhancing the model

    Financial Problems in practice are much larger,involving lots of potential investments, and more

    time periods. Data is often stored in a database.

    Other (to be addressed soon)

  • 8/3/2019 J02 LinAlg and LPs Rev

    24/28

    MIT and James Orlin 200324

    Understanding the model

    How might management use this model inpractice?

    Lets vary some of the data and see if we

    can obtain insights: How will the return vary with the initial

    investment?

    How will the return vary with the CD rate ofreturn?

    Use SolverTable or usual sensitivity analysis

    Excel Solution

  • 8/3/2019 J02 LinAlg and LPs Rev

    25/28

    MIT and James Orlin 2003

    25

    Scaling up: dealing with large problems

    n investments, over m time periods. Total budget B to invest in period 1.

    The payback of $1 of investment j in period i is pij.If investment j starts in period i, then pij = -1,indicating that $1 is invested in that period.

    Everything is reinvested.

    Maximum of uj in investment j.

    Maximize the total return in period m.

    Work with your partner on formulating thegeneralization.

    Let xj be the amount put into investment j

  • 8/3/2019 J02 LinAlg and LPs Rev

    26/28

    MIT and James Orlin 2003

    26

    The model

    1

    n

    mj jjz p x

    !! Maximize

    11

    n

    j jjp x B

    !! subject to

    10

    n

    ij jjp x

    !! for i = 2 to m-1

    0j j

    x ue e for j = 1 to n

  • 8/3/2019 J02 LinAlg and LPs Rev

    27/28

    MIT and James Orlin 2003

    27

    Enrichments of the model

    Finance concentrators: have we madeassumptions that you would like to challenge?

    Can we deal with a more realistic model?

  • 8/3/2019 J02 LinAlg and LPs Rev

    28/28

    MIT and James Orlin 2003

    28

    Summary

    Gauss-Jordan solving of equations andother background in linear algebra

    A financial problem

    Note: Modeling in practice is an art form.It requires finding the right simplificationsof reality for a given situation.