02 - network flows

Upload: goekhan-kof

Post on 04-Jun-2018

229 views

Category:

Documents


2 download

TRANSCRIPT

  • 8/13/2019 02 - Network Flows

    1/32

    IE252Networkflows 1

    NETWORK FLOWS

    TRANSPORTATION PROBLEM

    Supply Demand

    xcz ij

    N

    j ij

    M

    i

    Min

    11

    S.t.

    a) Supply:

    Sx iijN

    j

    1

    i=1,..,M

    b)Demand

    Dx jijN

    j

    1

    j=1,..,N

    c) Nonnegativity: 0xij i=1,..,M; j=1,..,N

    1

    i

    N

    1

    M

    cijxij

    Si Dj

  • 8/13/2019 02 - Network Flows

    2/32

    IE252Networkflows 2

    UNIMODULARITY PROPERTY: For the Transportation

    problem if all RHS values (i.e. Siand Dj) are INTEGERS for

    any OPTIMAL solution all VARIABLES (xij) are INTEGERS

    ASSIGNMENT PROBLEM

    Supply Demand

    xcz ijN

    jij

    M

    i

    Min

    11

    S.t.

    a) Supply:

    1

    1

    N

    ijj

    x

    i=1,..,M

    b)Demand

    1

    1

    N

    ijj

    x

    j=1,..,M

    c) 0 /1ijx i=1,..,M; j=1,..,M

    1

    i

    M

    1

    M

    cijxij

    Si=1 Dj=1

  • 8/13/2019 02 - Network Flows

    3/32

    IE252Networkflows 3

    Number of Supply points (M) = Number of Demand Points (N)

    Si =1 and Dj=1 i(j)=1,,M

    xij=0/1 i(j)=1,,M

    Special type of Transportation Problem

    Solve by TP algorithm

    Find the initial solution by Min. Cost method:

    JOBS

    1 2 3 4 S

    14 5 8 7

    1

    1 1

    2 12 6 5

    2

    1 1

    MC 7 8 3 93

    1 1

    2 4 6 10

    4

    1 1

    D 1 1 1 1

    How many basic variables?

  • 8/13/2019 02 - Network Flows

    4/32

    IE252Networkflows 4

    2M-1 7

    JOBS

    1 2 3 4 S u

    14 5 8 7

    1

    1 0 0 1 0

    2 12 6 5

    2

    1 1 -2

    MC 7 8 3 9

    3

    1 1 -5

    2 4 6 10

    4

    1 0 1 -1

    D 1 1 1 1

    v 3 4 8 7

    Z=15

    Find uiand vj

    compute reduced cost coefficients for nonbasic cells

    If may improve the current solution.

    x43enters the basis

    which of the current basic variable will leave the basis?

  • 8/13/2019 02 - Network Flows

    5/32

  • 8/13/2019 02 - Network Flows

    6/32

    IE252Networkflows 6

    Step1-1 : (Row Reduction) Find the minimum element of each

    row i (ui) of the cost matrix and subtract it from every element

    of that row.

    {} for all i=1,..,M

    for all i/j=1,..,M

    Step1-2 : (Column Reduction) Find the minimum element of

    each column of the reduced cost matrix (vj) and subtract it

    from every element of that row.

    {} for all j=1,..,M

    for all i/j=1,..,M

    Step 2: Draw minimum number of horizontal or vertical lines

    to cover zero cost elements of the reduced matrix. If the

    number of such lines equal to M stop, optimal assignments are

    found.

    Otherwise go to step 3.

    Step 3: Find the smallest uncoverd nonzero element (call its

    value k).

    Subract k from each uncovered element

    Add k to each twice covered element.

    Go to Step 2.

  • 8/13/2019 02 - Network Flows

    7/32

    IE252Networkflows 7

    U

    14 5 8 7 5

    2 12 6 5 2

    7 8 3 9 3

    2 4 6 10 2

    9 0 3 2

    0 10 4 3

    4 5 0 6

    0 2 4 8

    v 0 0 0 2

  • 8/13/2019 02 - Network Flows

    8/32

    IE252Networkflows 8

    9 0 3 0

    0 10 4 1

    4 5 0 4

    0 2 4 6

    u+v=14 =W

    Minimization:

    Obj. Funct. value of :

    dual feasibleoptimal primal feasible

    W=14 Z* Z=15

    Draw minimum number of lines to cover zero cells:

    9 0 3 0

    0 10 4 1

    4 5 0 4

    0 2 4 6

  • 8/13/2019 02 - Network Flows

    9/32

    IE252Networkflows 9

    k=1

    10 0 3 0

    0 9 3 0

    5 5 0 4

    0 1 3 5

    10 0 3 0

    0 9 3 0

    5 5 0 4

    0 1 3 5

    4 lines =M

  • 8/13/2019 02 - Network Flows

    10/32

    IE252Networkflows 10

    10 0 3 0

    0 9 3 0

    5 5 0 4

    0 1 3 5

    x41= x12 + x24+ x33=1

    Z= 15

    W= u+v+k =15 =Z

  • 8/13/2019 02 - Network Flows

    11/32

    IE252Networkflows 11

    TRANSSHIPMENT PROBLEM

    Supply Transshipment Demand

    1

    i

    N

    1

    M

    ctjxtj

    Si Dj

    t

    t

    1

    cityit

  • 8/13/2019 02 - Network Flows

    12/32

    IE252Networkflows 12

    xcycz tjN

    jtj

    t

    tit

    T

    tij

    M

    i

    Min

    1111

    '

    S.t.a) Supply:

    Sy iitN

    j

    1

    i=1,..,M

    b) Transshipment:

    1 1

    M N

    tjiti j

    y x

    for all t=,1..,T

    c)Demand:

    Dx jtjT

    t

    1

    j=1,..,N

    yit 0 and xtj0 i=1,..,M; t=1,..,T; j=1,..,N

    S

    D

    ST

    T

    DD

    S

    T

  • 8/13/2019 02 - Network Flows

    13/32

    IE252Networkflows 13

    A GRAPH or NETWORK: is defined by two symbols:

    NODES (VERTICES) and ARCS

    An ARC consists of an ordered pair of NODES (vertices) andrepresents a possible direction of FLOW (motion)

    i j

    Arc (i,j) - directed

    i j

    i j

    Arc (i,j) - undirected

  • 8/13/2019 02 - Network Flows

    14/32

    IE252Networkflows 14

    CHAIN: A sequence of arcs such that every arc has exactly one

    vertex (node) in common with the previous

    PATH: is a chain in which the terminal node of each arc is

    identical to the initial node of the next arc (directed chain)

    CHAIN:

    (1,3)(4,3)(4,5)

    13456PATH:

    (1,2)(2,6)(6,5)(5,4)

    12654Directed chain

    1

    4

    5

    3

    6

    2

  • 8/13/2019 02 - Network Flows

    15/32

    IE252Networkflows 15

    MINIMUM COST NETWORK FLOW PROBLEMS

    (MCNFP)

    N = number of nodes

    D.V.s:

    xij : amount of units sent from node i to node j, flow on arc (i,j)

    Parameters:

    Si : amount of supply at node i

    Di : amount of demand at node i

    Cij: unit cost of transportinf from i to j

    Lij: lower bound on flow from i to j

    Uij: upper bound on flow from i to j

    BALANCE OF FLOW AT EACH NODE:

    ik j

    Si

    Di

    INFLOW OUTFLOW

    +v+v

  • 8/13/2019 02 - Network Flows

    16/32

    IE252Networkflows 16

    INFLOW(available) = OUTFLOW (use)

    xkiN

    k

    1

    +Si= xijN

    j

    1

    +Di for all i=,1..,N

    xkiN

    k

    1

    - xijN

    j

    1

    = Di - Si

    xijN

    j

    1

    - xkiN

    k

    1

    = Si - Di = bi

    bxx ikiN

    kij

    N

    j 11 for all i=,1..,N

    bi= Si-Di= Net supply or demand at node i

    Si>Di Net supplier node (Si-Di >0)

    bi= {Si=Di Transhipment node (Si-Di =0)Si< Di Net supplier node (Si-Di

  • 8/13/2019 02 - Network Flows

    17/32

    IE252Networkflows 17

    GrainCO supplies corn from three silos to three poultry farms.

    Supply amounts 100, 200, and 50 x1000 tons and demand at

    the three farms are 150, 80, and 120 x1000 tons.

    OUTFLOWINFLOW = b

    x12 + x13+ x14 =100

    x23 + x25- x11 =200

    x34 + x35x13x23 =50

    x45x14x34 =-150

    x56x25x35 =-80

    x46x56 =-120

    x14 80 x46 100

    1

    3

    2 5

    6

    4

    S1=100

    D5=80

    D4=150

    D6=120

    S2=200

    $3

    $4

    $6

    $4 U=80

    $1

    $2 U=100

    $2

    $4

    S3=50

  • 8/13/2019 02 - Network Flows

    18/32

    IE252Networkflows 18

    UNIMODULARITY PROPERTY: For the MCNFP if all

    RHS values (i.e. bi) are INTEGERS for any OPTIMAL

    solution all VARIABLES (xij) are INTEGERS

    So as:

    - TRANSPORTATION- ASSIGNMENT- TRANSSHIPMENT- SHORTEST PATH- MAXIMUM FLOW- Which are all special type of MCNFP

    SHORTEST PATH PROBLEM

    1

    42

    53

    6

    c12=4

    2

    3

    2

    2

    3

    3

    City 1

    City 6

    b1= 1 b2= b3= b4= b5= 0 b6= -1

  • 8/13/2019 02 - Network Flows

    19/32

    IE252Networkflows 19

    1 if node i is ORIGIN

    bi= {0 if node i is Transhipment-1 if node i is DESTINATION

    xcz ijN

    jij

    N

    i

    Min

    11

    s.t.:

    bxx ikiN

    k

    ij

    N

    j

    11

    for all i=,1..,N

    xij= 0/1 i=1,..,N; j=1,..,N

    Purchase car at time 0 for $12.000

    Age Annual

    maintanence cost

    ($)

    Trade-in price-

    salvage value($)

    0 2000 7000

    1 4000 6000

    2 5000 2000

    3 9000 1000

    4 12000 0

    What to do next 5 years?

  • 8/13/2019 02 - Network Flows

    20/32

    IE252Networkflows 20

    cij= total cost between years ij if car is bought at the beginingof year i and sold at the begining of year j

    (at the end of year j-1)

    c12= 12+2-7=7c13= 12+6-6=12

    c14= 12+11-2=21

    c15= 12+20-1=31

    c16= 12+220=44

    c23= 12+2-7=7

    c24= 12+6-6=12

    c25= 12+11-2=21

    c26= 12+20-1=31

    c34= 12+2-7=7

    c35= 12+6-6=12

    c36= 12+11-2=21

    c45= 7 c56= 7

    c46= 12

    1 2 3 4 5 6

    Year 1 Year 2 Year 3 Year 4 Year 5

  • 8/13/2019 02 - Network Flows

    21/32

    IE252Networkflows 21

    Shorest Path Network

    1 32 4 5 7 7777

    1212

    12

    21

    21

    12

    21

    31

    31

    44

  • 8/13/2019 02 - Network Flows

    22/32

    IE252Networkflows 22

    SHORTEST PATH PROBLEM

    SOLVED AS A TRANSPORTATION PROBLEM

    i/j 2 3 4 5 6 Supply

    1 4 3 M M M 1

    2 0 M 3 2 M 1

    3 M 0 M 3 M 1

    4 M M 0 M 2 1

    5 M M M 0 2 1

    Demand 1 1 1 1 1 1

    1

    42

    53

    6

    c12=4

    2

    3

    2

    2

    3

    3

  • 8/13/2019 02 - Network Flows

    23/32

    IE252Networkflows 23

    i/j 2 3 4 5 6 Supply

    1 4

    1

    3 M M M 1

    2 0 M 3 2

    1

    M 1

    3 M 0

    1

    M 3 M 1

    4 M M 0

    1

    M 2 1

    5 M M M 0 2

    1

    1

    Demand 1 1 1 1 1 1

    PROBLEM :?

    DEGENERACY!!!

    CYCLING

  • 8/13/2019 02 - Network Flows

    24/32

    IE252Networkflows 24

    DIJKSTRAs ALGORITHM

    s -------------------------------> t

    STEP 0. assign temporary label to all nodes, permanent

    label to s.

    Set p=s

    STEP 1. Set

    l(i) = Minimum { l(i) , l(p) +cpi}

    for all i with temporary label.

    Let

    l(k) = Minimum { l(i) }iT

    Make k permanent, let

    p=k

    STEP 2.

    If node t is temporary go to STEP 1.

    Otherwise STOP l(t) is the shortest path. (Backtract)

  • 8/13/2019 02 - Network Flows

    25/32

    IE252Networkflows 25

    p=1 l(1)=0

    1 2 3 4 5 6

    0*

    0* 4 3*

    0* 4* 3* 6

    0* 4* 3* 7 6*

    0* 4* 3* 7* 6* 8

    1

    42

    53

    6

    4

    2

    3

    2

    2

    3

    3

  • 8/13/2019 02 - Network Flows

    26/32

    IE252Networkflows 26

    Alternative shortest paths

    1

    42

    53

    6

    4

    2

    3

    2

    2

    3

    3

  • 8/13/2019 02 - Network Flows

    27/32

    IE252Networkflows 27

    MAXIMUM FLOW PROBLEM

    Uij= capacity of arc (i,j)

    1 ----------------------------------------NOrigin Destination

    MAXIMUM AMOUNT OF FLOW =?

    bi = F if node i is Origin

    bi= -F if node i is Destination

    bi= 0 other nodes

    1

    3

    42 5

    U12=5U24=1

    U14=3

    U35=4

    U23=2

    U45=3

  • 8/13/2019 02 - Network Flows

    28/32

    IE252Networkflows 28

    Max Z = F

    s.t.:

    Fxx kiN

    kij

    N

    j

    11

    if i is Origin

    0

    11

    xx kiN

    kij

    N

    j if i is other

    Fxx kiN

    kij

    N

    j

    11

    if i is Destination

    0 xijUij i=1,..,N; j=1,..,N

  • 8/13/2019 02 - Network Flows

    29/32

    IE252Networkflows 29

    MINIMUM SPANNING TREE

    5 COMPUTERS

    SPANNING TREE:

    For a network of N nodes spanning tree is a group of N-1 arcs

    - that connects all nodes to each other- contains no loops

    A spanning tree of minimum length is a

    MINIMUM SPANNING TREE

    4

    1

    5

    3

    2

    6

    5

    24

    2

    4

    3

    C12=1

    2

  • 8/13/2019 02 - Network Flows

    30/32

    IE252Networkflows 30

    MINIMUM SPANNING TREE (MST)

    ALGORITHM

    (GREEDY)

    Let:

    C : set of connected nodes

    C : set of unconnected nodes

    C U C = N

    STEP 1 :

    Choose any j N

    C = {j} C = N {j}

    STEP 2:

    Let dkr= Minimum { dij}iC ; jC

    STEP 3:

    C C + { r } C C - { r }

    If C = STOP otherwise

    GO TO STEP 2.

  • 8/13/2019 02 - Network Flows

    31/32

    IE252Networkflows 31

    C={1} C={2,3,4,5}

    r=2 12C= {1,2} C={3,4,5}

    r=5 15

    C= {1,2,5} C={34}

    r=3 53

    C= {1,2,5} C={4}

    r=4 45

    C= {1,2,3,4,5} C=

    4

    1

    5

    3

    2

    6

    5

    24

    2

    4

    3

    C12=1

    2

  • 8/13/2019 02 - Network Flows

    32/32

    4

    1

    5

    3

    2

    6

    5

    24

    2

    4

    3

    1

    2