mit and james orlin © 2003 1 the minimum cost flow problem note for instructors: this lecture was...

41
MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled Chapter 8

Upload: amanda-brown

Post on 15-Dec-2015

214 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

1

The minimum cost flow problem

Note for instructors: this lecture was developed to follow the two lectures that are labeled Chapter 8

Page 2: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

2

Network Models Networks 1: Introduction to Networks

– Paths, Cycles, Trees– The shortest path problem– Dijkstra’s Algorithm– LP Formulation of Shortest Path Problem

• node arc incidence matrix

Networks 2: CPM and extensions– Arcs as precedence relation– CPM algorithm– LP Formulation of CPM

• Transpose of Node-Arc Matrix

Networks 3: flows on arcs– Large number of diverse applications

Page 3: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

3

Outline of Lecture Shortest Path Problem

The shortest path problem is a special case of something known as the minimum cost flow problem

We’ll introduce it soon, but first a couple of special cases.

A transportation problem.

Assignment Problem

Page 4: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

4

Directed and Undirected Networks

2

34

1

a

b

c

d

e

An Undirected Graph

2

34

1

a

b

c

d

e

A Directed Graph

The field of Network Optimization concernsoptimization problems on networks

Networks are used to transport commodities• physical goods (products, liquids)• communication• electricity, etc.

Page 5: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

5

1

2

3

4

5

6

The constraint matrix is the node arc incidence matrix

1 1 0 00 0 0 0 0 1=

1 1 1-1 00000 0=

1-10 -1 00000 0=

1 -1-10 0 000 0 0=

1 1-1-10 00 0 0 0=

-1 -10 0 0 000 0 -1=

x12 x13 x23 x25x24 x35 x46 x54 x56

The shortest path problem

Page 6: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

6

ApplicationsPhysical analog

of nodes Physical analog

of arcsFlow

Communicationsystems

phone exchanges, computers, transmission

facilities, satellites

Cables, fiber optic links, microwave

relay links

Voice messages, Data,

Video transmissions

Hydraulic systemsPumping stationsReservoirs, Lakes

PipelinesWater, Gas, Oil,Hydraulic fluids

Integrated computer circuits

Gates, registers,processors

Wires Electrical current

Mechanical systems JointsRods, Beams,

SpringsHeat, Energy

Transportationsystems

Intersections, Airports,

Rail yards

Highways,Airline routes

Railbeds

Passengers, freight,

vehicles, operators

Applications of Network Optimization

Page 7: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

7

A Transportation Problem

1

2

3

W

4

5

6

R

6

7

2

4

8

3

0

1

1

0

1

1

1

1

2

•3 warehouses: nodes 1, 2, 3

•3 retailers: nodes 4, 5, 6

•Supplies of goods at the warehouses (6, 7 and 2) : Upper bound on flow

•Demand for goods at the warehouses (4, 8 and 3) Lower bound on flow

•Costs on shipping from each warehouse to each retailer

•Objective: send at most the supply, send at least the demand, and minimize cost.

What is the linear program for this transportation problem?

Page 8: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

8

The constraints for the transportation problem

1

2

3

4

5

6

W R

6

7

2

4

8

3

0

1

1

0

1

1

1

1

21 0 0 0 = 710 0 0 1

0 1 0 0 = 401 0 0 1

0 0 1 0 = 810 1 0 0

x26 x34 x35 x36x25x14 x15 x16 x24

0 0 0 0 = 601 1 1 0

1 0 0 1 = 300 0 1 0

0 1 1 1 = 200 0 0 0

This graph is “bipartite.” That is, the nodes are partitioned into two parts and arcs have one endpoint in each part.

Page 9: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

9

The constraint matrix is a node-arc incidence matrix in disguise

1

2

3

4

5

6

W R

6

7

2

4

8

3

0

1

1

0

1

1

1

1

21 0 0 0 = 710 0 0 1

0 1 0 0 = 401 0 0 1

0 0 1 0 = 810 1 0 0

x26 x34 x35 x36x25x14 x15 x16 x24

0 0 0 0 = 601 1 1 0

1 0 0 1 = 300 0 1 0

0 1 1 1 = 200 0 0 0

Multiply the constraints for nodes 4, 5, 6 by -1

0 -1 0 0 = -40-1 0 0 -1

0 0 -1 0 = -8-10 -1 0 0

-1 0 0 -1 = -300 0 -1 0

The matrix becomes a node-arc incidence matrix

Page 10: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

10

Features of this transportation problem

The constraint matrix is (or can be made to be) the node arc incidence matrix of the network

If supplies/demands are integral, then the flows are also integral.

If the total supply is equal to the total demand, then all supply and demand constraints hold with equality

Very efficient special purpose solution techniques exist

Applications to shipment of goods

Transportation Problem

Page 11: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

11

On the integrality Property The fact that solutions to the transportation

problem are integral is an amazing property.

In general, solutions to IP are fractional.

Consider x + y = 1, x – y = 0. Unique solution (.5, .5)

But solutions to this transportation problem are integral.

In general, if there is at most one 1 and at most one –1 in any column of the constraint matrix, then every basic feasible solution is integer (so long as RHS is integral.)

For many applications, we want to restrict variables to be integer valued.

Transportation Problem

Page 12: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

12

A special case: supplies and demands are all 1.

1

1

1

1

2

3

4

5

6

W R

1

1

1

0

1

1

0

1

1

1

1

2

Note the special structure of the integral solutions.

W R

11 41 1

There will be three arcs with 1 unit of flow.

2

6

1

1

1

3

5

1

1

1

A solution may be viewed as an “Assignment”

Page 13: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

13

A special case: supplies and demands are all 1.

1

2

3

4

5

6

W R

1

1

1

1

1

1

0

1

1

0

1

1

1

1

2

W R

11 41 1

Every feasible integral solution has three arcs with a flow of 1. And the LP produces integral solutions.

21 1 5 1

6 1311

Each node on the left is “assigned” to a node on the right

Page 14: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

14

The Assignment Problem

1

2

3

P

4

5

6

T

1

1

1

1

1

1

1

0

1

1

0

1

1

1

2

Formulate this as an Integer Program. (Require all variables to be integer).

•3 persons: nodes 1, 2, 3

•3 tasks: nodes 4, 5, 6

•Each person must be assigned to a task

•Each task has a person assigned

•Utility of assigning a person to a task

•Objective: meet constraints while maximizing total utility

Assignment Problem

Page 15: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

15

Assignment Problem

Suppose that n persons (labeled 1 to n) are assigned to n tasks (also labeled 1 to n)

Let xij = 1 if person i is assigned to task j

Let xij = 0 if person i is not assigned to task j

Let uij be the utility of assigning person i to task j

Formulate the assignment problem

Page 16: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

16

The Assignment Problem

In general the LP formulation is given as

Minimize 1 1

1

1

1 1

1 1

0

, , ,

, , ,

or 1,

n n

ij iji j

n

ijj

n

iji

ij

c x

x i n

x j n

x ij

Each supply is 1

Each demand is 1

Page 17: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

17

The Transportation Problem

In general the LP formulation is given as

Minimize 1 1

1

1

1

1

0

, , ,

, , ,

,

m n

ij iji j

n

ij ij

m

ij ji

ij

c x

x a i m

x b j n

x ij

S: Supply nodes

D: Demand nodes

All arcs are from a node in S to a node in D, and uncapacitated.

Page 18: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

18

Comments on the Assignment Problem

The Air Force has used this for assigning thousands of people to jobs.

This is a classical problem. Research on the assignment problem predates research on LPs.

Very efficient special purpose solution techniques exist. – 10 years ago, Yusin Lee and J. Orlin solved a problem

with 2 million nodes and 40 million arcs in ½ hour.

Page 19: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

19

Some More on the Assignment Problem

There are 6! different assignments.

There are n! different assignments in an n x n assignment problem.

1 7

2 8

3 9

4 10

5 11

6 12

There are n! different assignments in an n x n assignment problem.

Diverse applications.

Page 20: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

20

An Application of the Assignment Problem

Suppose that there are moving targets in space.

You can identify each target as a pixel on a radar screen.

Given two successive pictures, identify how the targets have moved.

This may be the most efficient way of tracking items.

Page 21: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

21

The minimum cost flow problem Assignment problem, transportation problem,

and the shortest path problem.– All are efficiently solvable– All have constraint matrices that are the node-arc

incidence matrix (or are equivalent)– All have integer value solutions when solved by simplex

We next consider the minimum cost flow problem– includes assignment, transportation, and shortest path

as special cases– Has a constraint matrix that is the node arc incidence

matrix– Has integer valued solutions when solved by simplex

Page 22: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

22

The Minimum Cost Flow Problem

1

2

3

4

-$3,

$8, $7,

$3,

$2,

3

4

-5

-2

A network with costs, capacities, supplies, demands

Supply/demand bi for node i.

• e.g. b1 = 4 (supply)

• b3 = -5 (demand)

Network G = (N, A)

Node set N = {1, 2, 3, 4}

Arc set A = {(1,2), (1,3), (2,3), (2,4), (3,4)} Capacities uij on arc (i,j)

•e.g., u12 = 6

Cost cij on arc (i,j)

•e.g., c12 = $3

6

5 2

4

7

Send flow in each arcSatisfy “supply/demand” constraints”Satisfy flow bound constraintsMinimize cost

Page 23: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

23

The Minimum Cost Flow Problem

1

2

3

4

-$3,

$8, $7,

$3,

$2,

3

4

-5

-2

A network with costs, capacities, supplies, demands

6

5 2

4

7

Min z = the cost of sending flow

s.t. Flow out of i - Flow into i = bi for each i

0 xij uij for all arcs (i,j) in A

Let xij be the flow on arc (i,j).

Page 24: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

24The constraint matrix is the node arc incidence matrix

0 x12 6, 0 x13 5, 0 x23 2,

0 x24 4, 0 x34 7,

Supply/Demand constraints

Lower and upper bounds on variables

The LP Formulation

1 1 0 0 0 = 40

-1 0 1 1 0 = 30

0 -1 -1 0 1 = -50

0 0 0 -1 -1 = -20

x12 x13 x23 x24 x34-z

-3 8 7 3 2 = 01

1

2

3

4

-$3,

$8, $7,

$3,

$2,

3

4

-5

-2

6

5 2

4

7

Page 25: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

25

On Network Flow Problems

If the constraint matrix is a node-arc incidence matrix, then the LP is a network flow problem.**

The solution values are all integer valued.

** Upper bound constraints on variables may be treated similarly to lower bound constraints, and are not viewed as part of the constraint matrix.

Page 26: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

26

The Minimum Cost Flow ProblemLet xij be the flow on arc (i,j).

Minimize the cost of sending flows.t. Flow out of i - Flow into i = bi

0 xij uij

0 xij uij for all (i,j)

( , )ij ij

i j A

c x

Minimize

1 1

for all n n

ij ki ij k

x x b i

s.t.

Page 27: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

27

Some Information on the Min Cost Flow Problem Reference text: Network Flows: Theory,

Algorithms, and Applications by Ahuja, Magnanti, and Orlin

This is one of the few problems for which there is a provably efficient implementation of the simplex algorithm (Orlin [1997])

Basic feasible solutions of a minimum cost flow problem are integer valued (assuming that the data is integer valued)

Very efficient solution techniques in practice

15.082J/6.885J: Network Optimization

Page 28: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

28

Baseball Elimination Problem

Bos Chi Atl. Den.

Bos

Chi

Atl.

Den.

-- 1 7 1

1 -- 0 3

7 0 -- 1

1 3 1 0

Bos

Chi

Atl.

Denver

82

79

77

76

Games Won

Games Left

9

4

8

5

Has Chicago already been eliminated from winning in this hypothetical season finale? Has Atlanta?

http://riot.ieor.berkeley.edu/~basket/

Page 29: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

29

Modeling as an optimization problem

Bos Chi Atl. Den.

Bos

Chi

Atl.

Den.

-- 1 7 1

1 -- 0 3

7 0 -- 1

1 3 1 0

xAB = number of wins by Atlanta over Boston

xAD = number of wins by Atlanta over Denver

xBC = …

xBD = …

xCD = …

7- xAB = number of wins by Boston over Atlanta

1- xAD = number of wins by Denver over Atlanta

7

7 1

1

Page 30: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

30

Determining whether Chicago can win the championship, assuming Chicago wins all of its games, and thus has 83 wins.

AB AD BD . RHS

Bos 7-xAB+ +xBD 1

Chi -- -- -- -- --

Atl. xAB +xAD 6

Den. 1-xAD + 1 - xBD 7

Bos

Chi

Atl.

Denver

82

79

77

76

Games Won

Games Left

9

4

8

5

8

0

6

7

and also upper and lower bound constraints.

Page 31: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

31

The constraint matrix is a node-arc incidence matrix

AB AD BD

Bos

Atl.

Den.

7-xAB+ +xBD

xAB +xAD

1-xAD + 1 - xBD

.

RHS

1

6

7

xAB xAD xBD . RHS

Bos -1 0 +1 -6

Atl. 1 1 0 6

Den. 0 -1 -1 5

The baseball elimination problem is a minimum cost flow problem in disguise.

Page 32: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

Another Application of the Minimum Cost Flow Problem

Customers

6

7

400

180

Demands

200

300

100

Supplies

Ship from suppliers to customers, possibly through warehouses, at minimum cost to meet demands.

Plants

2222

3333

11111

Warehouses

5

4

Page 33: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

33

Matrix Fill In

? ? ? 1

1 ? ? ?

? 2 5 1

1 3 ? ?

5 1 ? 1

2

1

?

1

?

Is it possible to fill in the missing data with non-negative integers and have the row sums and column sums as specified? If so, how large or small can be the element in position 2,3?

16

11

20

6

16

Row sums

19 13 17 713Column sums

How is this a transportation problem?

?

Page 34: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

34

Matrix Fill In

19 13 17 7

16

13

20

6

? ? ? 1

1 ? ? ?

? 2 5 1

1 3 ? ?

165 1 ? 1

13

2

1

?

1

?

Rows Columns

13

11

12

1

9

12 7 12 49

1

1

2 5 1

1 3

5 1 1

2

1

1

9

Determine the row and column sums for unknown entries.

Formulate a transportation problem

entry in (i,j) is “flow”

Minimize entry (2,3)

13

9

12

9

1

12

7

12

9

4

1

2

3

4

5

1

2

3

4

5

Transportation Problem

Page 35: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

35

Conclusions. Advantages of the transportation problem

and the minimum cost flow problem– Integer solutions– Very fast solution methods– Extremely common in modeling

Page 36: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

36

Multicommodity Flows: a brief glimpse at an important problem

1

2

3

4

5

63 3

5 5$5, 4

$2, 4

$6, 4

$0, 8 $0, 8

$0, 8$0, 8

Send 6 units of commodity 1 from node 1 to node 4.

The costs and capacities are given.

What is the minimum cost multicommodity flow?

Send 3 units of commodity 2 from node 3 to node 6.

Two minimum cost flows on a shared network

Page 37: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

37

Multicommodity Flows

1

2

3

4

5

63 3

6 6$5, 4

$2, 4

$6, 4

$0, 8 $0, 8

$0, 8$0, 8

Send 5 units of commodity 1 from node 1 to node 4.

Send 3 units of commodity 2 from node 3 to node 6.

4

2

1

2

The shared arc capacities make the problem much more complex. Optimum flows may be fractional.

Page 38: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

38

Multicommodity flow Problems can be large Consider a communication network with

1000 nodes, and 10,000 arcs.

Suppose each node wants to send a different message to each other node.

1,000,000 messages. 1,000,000 commodities

10 billion variables. (10,000 variables per commodity)

Page 39: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

39

Multicommodity Flow Problems are important in practice

Manufacturing Networks Road and Rail Transportation Networks Air Transportation Networks Communication Networks

Page 40: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

40

Final comments on multicommodity flows

We mention them because they are important extensions of the minimum cost flow problem

Much harder to solve in practice Lots of applications Lots of Research at MIT

– Cynthia Barnhart– Jim Orlin

Page 41: MIT and James Orlin © 2003 1 The minimum cost flow problem Note for instructors: this lecture was developed to follow the two lectures that are labeled

MIT and James Orlin © 2003

41

Summary

Minimum Cost Flows– shortest paths– transportation problem– assignment problem– plus more– important subproblem of many optimization

problems, including multicommodity flows