1 network models. the shortest path model for a given network find the path of minimum distance,...

44
1 Network Network Models Models

Upload: kaitlyn-mcdaniel

Post on 27-Mar-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

1

NetworkNetwork

ModelsModels

Page 2: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

The Shortest Path Model

• For a given network find the path of minimum distance, time, or cost from a starting point,the start node, to a destination, the terminal node.

• Problem definition– There are n nodes, beginning with start node 1 and

ending with terminal node n.– Bi-directional arcs connect connected nodes i and j

with nonnegative distances, dij

– Find the path of minimum total distance that connects node 1 to node n.

2

Page 3: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FAIRWAY VAN LINES

Determine the shortest route from Seattle to El Paso over the following network of highways.

3

Page 4: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

4

8

9

7

11

12

1

43

6

2

10

5

Salt Lake City

El Paso

Seattle

Boise

Portland

Butte

Cheyenne

Bakersfield Las Vegas

Albuquerque

Tucson

Phoenix

599

691497180

432 345440

554621

420

280

432

403

314

893

500

290

116

268

577

CommentIn case some arcs are bi-directional, create two directed arcs in two opposite directions, betweenthe same two nodes.

Page 5: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FAIRWAY VAN LINES – The Linear Programming Model

Decision variables

5

X ij

10 if a truck travels on the highway from city i to city j otherwise

Objective = Minimize dijXij

Page 6: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

6

6

2

Salt Lake City

1

3 4

Seattle

Boise

Portland

599

497180

432 345

Butte

[The number of highways traveled out of Seattle (the start node)] = 1X12 + X13 + X14 = 1

In a similar manner:[The number of highways traveled into El Paso (terminal node)] = 1X9,12 + X10,12 + X11,12 = 1

[The number of highways used to travel into a city] = [The number of highways traveled leaving the city]. For example, in Boise (node 4):X14 + X34 = X46.

Subject to the following constraints:

Non-negativity constraints

Page 7: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FAIRWAY VAN LINES – spreadsheet

7

SOLUTIONTOTAL

DISTANCE= 1731

NODE NAME NODE # FROM TO DISTANCE FROM TO FLOW

Seattle 1 1 2 599 1 2

Butte 2 1 3 180 1 3

Portland 3 1 4 497 1 4 1

Boise 4 2 5 691 2 5

Cheyenne 5 2 6 420 2 6

Salt Lake City 6 3 4 432 3 4

Bakersfield 7 3 7 893 3 7

Las Vegas 8 4 6 345 4 6 1

Albuquerque 9 5 6 440 5 6

Phoenix 10 5 9 554 5 9

Tucson 11 6 8 432 6 8

El Paso 12 6 9 621 6 9 1

7 8 280 7 8

7 10 500 7 10

8 9 577 8 9

8 10 290 8 10

9 12 268 9 12 1

10 11 116 10 11

10 12 403 10 12

11 12 314 11 12

NODE INPUT ARC INPUT

Page 8: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FAIRWAY VAN LINES – The Network Model

The Dijkstra’s algorithm:– Find the shortest distance from the “START” to each

other node, in the order of the closest nodes to the “START”.

– Once the shortest route to the m closest node is determined, the (m+1) closest can be easily determined.

– This algorithm finds the shortest route from the start to all the nodes in the network.

8

Page 9: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

An illustration of the Dijkstra’s algorithm

9

(See mathematical formulation of the algorithm in Supplement CD 5).

Page 10: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

1056

8

9

7

11

12

1

43

6

2

10

5

Salt Lake City

El Paso

Seattle

Boise

Portland

Butte

Cheyenne

Bakersfield Las Vegas

Albuquerque

Tucson

Phoenix

599

691497180

432 345440

554621

420

280

432

403

314

893

500

290

116

268

577

SEAT.SEAT.

BUT599

POR

180

497BOI

599

180

497POR.POR.

BOI432

Bakersville602

+

+

=

=

612

782

BOI

BOIBOISE.BOISE.

345SLC

+ =

842

BUTTEBUTTE

SLC

420

CHY.691

+

+

=

=

1119

1290

SLC.

SLCSLC.

BAKERSVILLEBAKERSVILLE

… and so on until the whole network is covered.

Page 11: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

Dijkstra’s algorithm - continued

• When all the network is covered, the shortest route from START to every other node can be identified.

• Trace the path that leads to each node by backtracking from each node toward node START.

11

Page 12: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

The Maximal Flow Problem

• Problem definition

– There is a source node (labeled 1), from which the network flow emanates.

– There is a terminal node (labeled n), into which all network flow is eventually deposited.

– There are n - 2 intermediate nodes (labeled 2, 3,…,n-1), where the node inflow is equal to the node outflow.

– There are capacities Cij for flow on the arc from node i to node j, and capacities Cji for the opposite direction.

12

Page 13: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

The Maximal Flow Problem Objective

The objective is to find the maximum total flow out of node 1 that can flow into node n without exceeding the capacities on the arcs.

13

Page 14: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

UNITED CHEMICAL COMPANY

• United Chemical produces pesticides and lawn care products.

• Poisonous chemicals needed for the production process are held in a huge drum.

• A network of pipes and valves regulates the chemical flow from the drum to different production areas.

• The safety division must plan a procedure to empty the drum as fast as possible into a safety tub in the disposal area, using a network of pipes and valves.

14

Page 15: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

UNITED CHEMICAL COMPANY

15

The plan must determine:• which valves to open and shut• What is the estimated time for total discharge

Page 16: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

UNITED CHEMICAL COMPANY- Network Presentation

16

Page 17: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

• Data

17

1 7

2

4

6

5

3

Chemical Drum Safe Tub

10

8

10

61

12

1 4

4 2

2 8

3

3

7

2

Maximum flow from 2 to 4 is 8

Maximum flow from 6 to 3 is 4

Page 18: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

UNITED CHEMICAL COMPANY – The Linear Programming Model

• Decision variablesXij - the flow from node i to node j on the arc that

connects these two nodes

• Objective function – Maximize the flow out of node 1: Max X12 + X13

18

Page 19: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

UNITED CHEMICAL COMPANY – The Linear Programming Model

• Constraints– The constraint on each intermediate node is:

Flow out from the node – flow into the node = 0Node 2: X23 +X24 + X26 - X12 - X32 = 0Node 3: X32 +X35 + X36 - X13 - X23 - X63 = 0Node 4: X46 + X47 - X24 - X64 = 0Node 5: X56 + X57 - X35 - X65 = 0Node 6: X63 +X64 +X65 + X67 - X26 - X36 - X46 -X56 = 0

1970

• Data

1 7

2

4

6

5

3

Chemical Drum Safe Tub

10

8

10

61

12

1 4

4 2

2 8

3

3

7

2

Maximum flow from 2 to 4 is 8

Maximum flow from 6 to 3 is 4

2

Page 20: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

UNITED CHEMICAL COMPANY – The Linear Programming Model

• Constraints – continued – Flow cannot exceed arc capacities

X12 10; X13 10; X23 1; X24 8; X26 6; X32 1; X35 15; X36 4; X46 3; X47 7; X56 2; X57 8;

X63 4; X64 3; X65 2; X67 2;

– All Xij 0

20

Page 21: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

UNITED CHEMICAL COMPANY – Spreadsheet

21

SOLUTIONMAXIMUM

FLOW= 17

NODE NAME NODE # FROM TO CAPACITY FROM TO FLOW

SOURCE Chemical Drum 1 1 2 10 1 2 9

SINK Safe Tub 7 1 3 10 1 3 8

Area 2 2 2 3 1 2 3

Area 3 3 2 4 8 2 4 7

Area 4 4 2 6 6 2 6 2

Area 5 5 3 2 1 3 2

Area 6 6 3 5 12 3 5 8

3 6 4 3 6

4 6 3 4 6

4 7 7 4 7 7

5 6 2 5 6

5 7 8 5 7 8

6 3 4 6 3

6 5 2 6 5

6 7 2 6 7 2

ARC INPUTNODE INPUT

8

2

7

9

8

7

8

1 7

42

53

6

2

100/17 = 5,88 minutos

para retirar todo o produto

100.000 galões

17.000 galões/minuto

Page 22: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

The role of cuts in a maximum flow networkThe value of the maximum flow = the sum of the capacities of the minimum cut.

22

1

2

3

10

10

8

4 8

2

7

7

5

6

4

3

3

2

12

6

2

This is not a minimal cut

This is a minimal cut,and the flow = 17 is maximal

4

1

1Rede com as capacidades nos arcos

Corte: linha sobre os arcos da rede que separa nó fonte do nó destino

Capacidade do Corte: soma das capacidades dos arcos cortados pela linha do corte

Cap = 30

Cap = 17

Page 23: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

The Traveling Salesman Problem

23

• Problem definition

– There are m nodes.– Unit cost Cij is associated with utilizing arc (i,j)– Find the cycle that minimizes the total cost required to

visit all the nodes exactly once.

Page 24: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

The Traveling Salesman Problem

• Importance:– Variety of scheduling application can be solved as a

traveling salesmen problem. – Examples:

• Ordering drill position on a drill press. • School bus routing. • Military bombing sorties.

– The problem has theoretical importance because it represents a class of difficult problems known as NP-hard problems.

24

Page 25: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

The Traveling Salesman Problem

25

• ComplexityBoth writing the mathematical model and solving it are cumbersome (a problem with 20 cities requires over 500,000 linear constraints.)

50 cidades requerem 500 trilhões de restrições lineares

120 cidades requerem 6.000.000.000.000.000.000.000.000.000.000.000.000 restrições lineares !!

Page 26: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

THE FEDERAL EMERGENCY MANAGEMENT AGENCY

• A visit must be made to four local offices of FEMA,

going out from and returning to the same main office in Northridge, Southern California.

• Data (simétrico) Travel time (min) between offices

26

To office2 3 4 Home

F Office 1 25 50 50 30r Office 2 40 40 45o Office 3 35 65m Office 4 80

To office2 3 4 Home

F Office 1 25 50 50 30r Office 2 40 40 45o Office 3 35 65m Office 4 80

Page 27: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FEMA traveling salesman Network representation

27

Page 28: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

28

30

25

40

35

80

6545

50

50

40

Home

1

2 3

4

Tempo de viagem

Page 29: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FEMA - Traveling Salesman

29

• Solution approaches

– Enumeration of all possible cycles.• This results in (m-1)! cycles to enumerate. Se a rede for

simétrica serão (m – 1)!/2 ciclos. • Only small problems can be solved with this approach.

– A combination of the Assignment problem and the Branch and Bound technique.

• Problem with up to m=20 nodes can be efficiently solved with this approach.

Page 30: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FEMA – full enumeration

Possible cyclesCycle Total Cost

1. H-O1-O2-O3-O4-H 210 2. H-O1-O2-O4-O3-H 195 3. H-O1-O3-O2-O3-H 240 4. H-O1-O3-O4-O2-H 200 5. H-O1-O4-O2-O3-H 225 6. H-O1-O4-O3-O2-H 200 7. H-O2-O3-O1-O4-H 265 8. H-O2-O1-O3-O4-H 235 9. H-O2-O4-O1-O3-H 25010. H-O2-O1-O4-O3-H 22011. H-O3-O1-O2-O4-H 26012. H-O3-O1-O2-O4-H 260

30

Minimum

For this problem we have

(5-1)! / 2 = 12 cycles. Symmetrical problemsneed to enumerate only (m-1)! / 2 cycles.

Page 31: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FEMA – optimal solution

31

30

25

40

35

806545

5050

40

Home

1

2 3

4

Tempo total ótimo = 195 minutos

Page 32: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FEMA – The Assignment problem approach

• Refer to the nodes designated “From” as “Workers” nodes.

• Refer to nodes designated by “To” as “Jobs” nodes.

• Assign “Workers” to “Jobs” at minimum cost.

32

Variáveis de Decisão: Xij = número de vezes que o arco do nó i ao nó j é usado no ciclo. Assim,

Xij = 1 (se o arco está no ciclo) ou 0 (arco não está no ciclo).

Restrições no Modelo da Designação: soma dos arcos que saem de um nó tipo “Worker” = 1; soma dos arcos que chegam em em nó tipo “Job” = 1.

Page 33: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FEMA – The Assignment problem approach

• Data

33

To office1 2 3 4 Home

F Office 1 1000000 25 50 50 30r Office 2 25 1000000 40 40 45o Office 3 50 40 1000000 35 65m Office 4 50 40 35 1000000 80

Home 30 45 65 80 1000000

To office1 2 3 4 Home

F Office 1 1000000 25 50 50 30r Office 2 25 1000000 40 40 45o Office 3 50 40 1000000 35 65m Office 4 50 40 35 1000000 80

Home 30 45 65 80 1000000

Page 34: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FEMA – The assignment solution

34

30

25

40

35

806545

5050

40

Home

1

2 3

4

O3 – O4 – O3Sub-tour

O1 – O2 – H – O1Sub-tour

Page 35: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

FEMA – The assignment solution• We can prevent the situation of sub-tours by adding

certain constraints.

Exemplo: Seja o nó 5 = Home (H), assimX52 + X21 + X15 2 evita que o sub-tour H-O2-O1-H seja

utilizado.X12 + X23 + X34 + X41 3 evita que o sub-tour O1-O2-O3-O4-

O1 seja utilizado.

• This makes the problem extremely large.• Another approach, that combines the Assignment

model with the Branch and Bound solution methodology can efficiently solve problems up to m = 20 nodes.

35

Page 36: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

The Minimal Spanning Tree• This problem arises when all the nodes of a

given network must be connected to one another, without any loop.

• The minimal spanning tree approach is appropriate for problems for which redundancy is expensive, or the flow along the arcs is considered instantaneous.

36

Page 37: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

THE METROPOLITAN TRANSIT DISTRICT

• The City of Vancouver is planning the development of a new light rail transportation system.

• The system should link 8 residential and commercial centers.

• The Metropolitan Transit District needs to select the set of lines that will connect all the centers at a minimum total cost.

37

Page 38: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

METROPOLITAN TRANSIT – Network presentation

• The network describes:– feasible lines that have been drafted– minimum possible cost for taxpayers per line.

38

Page 39: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

39

5

2 6

4

7

81

3

West Side

North Side University

BusinessDistrict

East SideShoppingCenter

South Side

City Center

33

50

30

55

34

28

32

35

39

45

38

43

44

41

3736

40

Page 40: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

NETWORK PRESENTATION

40

5

2 6

4

7

81

3

West Side

North Side University

BusinessDistrict

East SideShoppingCenter

South Side

City Center

33

50

30

55

34

28

32

35

39

45

38

43

44

41

3736

40

Page 41: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

THE METROPOLITAN TRANSIT DISTRICT

• Solution - a network approach (See Supplement CD 5)

• The algorithm that solves this problem is a very trivial greedy procedure. Two versions of the algorithm are described.

• The algorithm – version 1:– Start by selecting the smallest arc, and adding it to a set of

selected arcs (currently contains only the first arc).– At each iteration, add the next smallest arc to the set of

selected arcs, unless it forms a cycle.– Finish when all nodes are connected.

41

Page 42: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

THE METROPOLITAN TRANSIT DISTRICT

• The algorithm – version 2:– Start by selecting the smallest arc creating the set

of connected arcs.– At each iteration add the smallest unselected arc

that has a connection to the connected set, but do not create a cycle.

– Finish when all nodes are connected

• See demonstration of version 2 next

42

Page 43: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

43

ShoppingCenter

Loop

2 6

4

7

8

West Side

North Side

University

BusinessDistrict

East Side

South Side

City Center

50

30

55

34

28

32

35

39

45

38

43

44

41

3736

40

Continuar até conectar todos os nós

Aplicação do Alg 2

5

LoopLoopLoopLoopLoopL

oop

LoopLo

op LoopLoop Loop LoopLoopLoopLoop

1

3

33

28

32

30

33

Page 44: 1 Network Models. The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node,

44

ShoppingCenter

4

7

8

West Side

North Side

University

BusinessDistrict

East Side

South Side

City Center

30

28

32

35

38

3736Total Cost = $236 million

OPTIMAL SOLUTION

53

1

62