25
Lecture 5 – Integration of Network Flow Programming Models Topics • Min-cost flow problem (general model) • Mathematical formulation and problem characteristics • Pure vs. generalized networks

Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Embed Size (px)

Citation preview

Page 1: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Lecture 5 – Integration of Network Flow Programming Models

Topics

• Min-cost flow problem (general model)

• Mathematical formulation and problem characteristics

• Pure vs. generalized networks

Page 2: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

GAINS

8

ATL

5

NY

6

DAL

4

CHIC

2

AUS

7

LA

3

PHOE

1

(6)

(3)

(5)

(7)

(4)

(2)

(4)

(5)

(5)(6)

(4)

(7)

(6)

(3)

[–150]

[200]

[–300]

[200]

[–200]

[–200]

(2)

(2)

(7)

[–250][700]

[supply / demand](shipping cost)

arc lower bounds = 0 arc upper bounds = 200

Distribution Problem

Page 3: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

•Warehouses store a particular commodity in Phoenix, Austin and Gainesville.

• Customers - Chicago, LA, Dallas, Atlanta, & New York

Supply [ si ] at each warehouse i

Demand [ dj ] of each customer j• Shipping links depicted by arcs, flow on each arc is

limited to 200 units.• Dallas and Atlanta - transshipment hubs• Per unit transportation cost (cij ) for each arc

Problem: Determine optimal shipping plan that minimizes transportation costs

Example: Distribution problem

Min-Cost Flow Problem

Page 4: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

In general:[supply/demand] on nodes(shipping cost per unit) on arcs

In example:all arcs have an upper bound of 200nodes labeled with a number 1,...,8

• Must indicate notation that is included in model:

(cij ) unit flow cost on arc (i, j )

(uij ) capacity (or simple upper bound) on arc (i,

j )

(gij ) gain or loss on arc (i, j )

• All 3 could be included: (cij , uij , gij )

Notation for Min-Cost Flow Problem

Page 5: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

arcname

terminationnode cost gain

originnode

lowerbound

upperbound

xij i j lij

The origin node is the arc’s tail

The termination node is called the head

Supplies are positive and demands are negative

External flow balance: total supply = total demand

i j

uij cij gij

externalflow

si or -di

Spreadsheet Input Data

Page 6: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

And here is the solution ...

Data Entry Using Jensen Network Solver

Network Model Name: Net1 Solver: Excel Solver Ph. 1 Iter. 13

5300 Type: Net Type: Linear Total Iter. 1517 Change Goal: Min Sens.: Yes Comp. Time 00:06

TRUE Cost: 5300 Side: No Status OptimalTRUE SolveTRUE100 Vary

Arc Data and Flows Node Data and Balance ConstraintsNum. Name Flow Origin Term. Upper Cost Red. Cost Num. Name Fixed Balance Dual Values Basis

1 Phoe-Chi 200 1 2 200 6 -3 1 Phoe 700 0 -11 -42 Phoe-LA 200 1 3 200 3 -7 2 Chi -200 0 -2 63 Phoe-Dal 200 1 4 200 3 -2 3 LA -200 0 -1 124 Phoe-Atl 100 1 5 200 7 0 4 Dal -300 0 -6 -75 Dal-LA 0 4 3 200 5 0 5 Atl -150 0 -4 86 Dal-Chi 0 4 2 200 4 0 6 NY -250 0 0 277 Dal-NY 50 4 6 200 6 0 7 Aus 200 0 -8 -138 Dal-Atl 50 4 5 200 2 0 8 Gain 200 0 -8 -169 Atl-NY 0 5 6 200 5 1

10 Atl-Dal 0 5 4 200 2 411 Atl-Chi 0 5 2 200 4 212 Aus-LA 0 7 3 200 7 013 Aus-Dal 200 7 4 200 2 014 Aus-Atl 0 7 5 200 5 115 Gain-Dal 0 8 4 200 6 416 Gain-Atl 0 8 5 200 4 017 Gain-NY 200 8 6 200 7 -1

Page 7: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

GAINS

ATL

NY

DAL

CHIC

AUS

LA

PHOE

(200)

(200)

(200)

(200)

(50)

(200)

[-150]

[200]

[-300]

[200]

[-200]

[-200]

(50)

(100)

[-250]

[700]

[supply / demand] (flow)

Solution to Distribution Problem

Page 8: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Sensitivity Report for Distribution Problem

123456789

10111213141516171819202122232425262728293031323334

A B C D E F G HMicrosoft Excel 11.4 Sensitivity Report

Adjustable CellsFinal Reduced Objective Allowable Allowable

Cell Name Value Cost Coefficient Increase Decrease$E$11 Phoe-Chi Flow 200 0 6 2.999999974 1E+30$E$12 Phoe-LA Flow 200 -7.000000003 3 7.000000003 1E+30$E$13 Phoe-Dal Flow 200 -2 3 2 1E+30$E$14 Phoe-Atl Flow 100 0 7 13.00800361 2$E$15 Dal-LA Flow 0 0 5.000000056 1E+30 0$E$16 Dal-Chi Flow 0 2.999999975 3.99999999 1E+30 2.999999975$E$17 Dal-NY Flow 50 0 6 1.000000054 0.999999989$E$18 Dal-Atl Flow 50 0 2 0.999999989 1.000000054$E$19 Atl-NY Flow 0 1.000000054 5.000000056 1E+30 1.000000054$E$20 Atl-Dal Flow 0 3.999999964 1.999999949 1E+30 3.999999964$E$21 Atl-Chi Flow 0 4.99999999 3.99999999 1E+30 4.99999999$E$22 Aus-LA Flow 0 0 7.000000005 0 7.000000005$E$23 Aus-Dal Flow 200 0 2 1.000000054 0$E$24 Aus-Atl Flow 0 1.000000054 5.000000056 1E+30 1.000000054$E$25 Gain-Dal Flow 0 4.000000055 6.00000003 1E+30 4.000000055$E$26 Gain-Atl Flow 0 0 3.99999999 4.000000055 0.999999989$E$27 Gain-NY Flow 200 -0.999999989 7 0.999999989 1E+30

ConstraintsFinal Shadow Constraint Allowable Allowable

Cell Name Value Price R.H. Side Increase Decrease$N$11 Phoe Balance 0 0 0 0 1E+30$N$12 Chi Balance 0 -6 0 200 0$N$13 LA Balance 0 -10 0 0 0$N$14 Dal Balance 0 -5 0 100 0$N$15 Atl Balance 0 -7 0 100 0$N$16 NY Balance 0 -11 0 50 0$N$17 Aus Balance 0 -3 0 0 0$N$18 Gain Balance 0 -3.000000011 0 100 0

Page 9: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Conservation of flow at nodes. At each node flow in = flow out. At supply nodes there is an external inflow (positive)At demand nodes there is an external outflow (negative).

Flows on arcs must obey the arc bounds; i.e., lower bound & upper bound (capacity)

Each arc has a per unit cost & the goal is to minimize total cost.

Characteristics of Network Flow Problems

Page 10: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Distribution Network Used in Formulation

8

5

6

4

2

7

3

1

(6)

(3)

(5)

(7)

(4)

(2)

(4)(5)

(5) (6)(4)

(7)

(6)

(3)

[-150]

[200]

[-300]

[200]

[-200]

[-200]

(2)

(2)

(7)

[-250]

[700]

[external flow] (cost)

lower = 0, upper = 200

Notation

Page 11: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

G = (N, A) network with node set N and arc set A

Indices i, j N denote nodes and (i, j ) A denote arcs

Originating set of arcs for node i (tails are i ) is the forward star of i

FS(i ) = { (i, j ) : (i, j ) A }

Terminating set of arcs for node i is the reverse star of i

RS(i ) = { (j,i ) : (j,i ) A }.

Pure Minimum Cost Flow Problem

Page 12: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

FS(1) = { (1,2), (1,3), (1,4), (1, 5) }

RS(1) = Ø

FS(4) = { (4,2), (4,3), (4,5), (4,6) }

RS(4) = { (1,4), (5, 4), (7,4), (8,4) }

xij – xji = bi

(i, j )FS(i )

where bi = positive for supply node i= negative for demand node i= 0 otherwise

(j,i )RS(i )

Flow balance equation for node i :

In our example:

Page 13: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Indices/setsi, j N nodes

arcsforward star of ireverse star of i

(i, j ) A

FS(i )RS(i )

Data cij unit cost of flow on (i, j )

lower bound on flow (i, j )

upper bound on flow (i, j )

external flow at node i

lijuij

bi

Pure Min-Cost Flow Model

Total supply = total demand: i bi = 0

Page 14: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Decision variables

xij = flow on arc (i, j )

Formulation for pure min-cost flow model

Min cijxij(i, j )A

s.t. xij xji = bi, i N (i, j )FS(i ) (j, i )RS(i )

lij xij uij, (i, j ) A

Page 15: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Decision variables are the flow variables xij

By examining the flow balance constraints we see that xij appears in exactly two of them:

xij 0. . . 0

+1 node i

( or in the other order if i

> j )

0 . . . 0 1 node j0 . . . 0

i j

This structure is called total unimodularity and guarantees integer solutions

Page 16: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

• If we add the constraints we obtain zero on the left-hand side so the right-hand side must also be zero for feasibility.

• In particular, this meanssum of supplies = sum of demands.

• Mathematically, we have one redundant constraint.

• Must be careful in interpreting shadow prices on the flow balance constraints.

• Cannot change only a supply or demand and have model make sense.

Observations from LP Model

Page 17: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

• Only oneone modification to “pure” formulation

a possible gain (or loss) on each arc, denoted by gij

• If gij = 0.95 then 100 units of flow leaves node i and

95 units arrive at node j

Generalized Minimum Cost Network Flow Model

Page 18: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Min cijxij(i, j )A

s.t.

lij xij uij, (i, j )A

Note that if gij =1 (i, j ) A, then we obtain the “pure” model

xij gjixji = bi, i N(i, j )FS(i ) (j, i )RS(i )

Generalized Formulation

Page 19: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

• Might experience 5% spoilage of a perishable good during

transportation on a particular arc.

gij = 0.95 for the associated arc (i,j).

• In production of manufacturing formulations we might incur losses due to production defects.

• In financial examples we can have gains due to currency exchange or gains due to returns on investments.

US $

Swissfrancs

Year 1 Year 2

Currencyexchange

15% returnon investment

Gain = 1.78

Gain = 1.15

Gains and Losses

Page 20: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Fact: If bi, lij and uij are integer-valued then all

extreme points of the feasible region for a

pure network flow problem give integer

values for xij. (Same cannot be said for generalized network models.)

This integer property means that if we use the

simplex method to solve a pure network flow

problem then we are guaranteed that xij will be

integer at optimality.

Pure Network Problems vs. General Network Problems

Page 21: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

This is critical when we formulate the assignment, shortest path problems, and other network problems.

Special cases of the pure min-cost flow model:

• Transportation problem

• Assignment problem

• Shortest path problem

• Maximum flow problem

Page 22: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

US $ Yen(100) CHF D-Mark Brit £

1 US $ 1 1.05 1.45 1.72 .682 Yen(100) .95 1 1.41 1.64 .643 CHF .69 .71 1 1.14 .484 D-Mark .58 .61 0.88 1 .395 Brit £ 1.50 1.56 2.08 2.08 1

• The table is to be read as follows:

The 1.45 in row 1 column 3 means that $1 US will purchase 1.45 Swiss Francs (CHF).

• In addition, there is a 1% fee that is charged on each exchange.

Checking for Arbitrage Opportunities

Page 23: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

Each arc has a gain of gij. For example,g12 = (1.05)(0.99)g35 = (0.48)(0.99)

5

43

2

1

[-1]

Brit £

US $

D-MarkCHF

Yen

Arc costs:cij = $ equivalent

(first column of table)

For example:c12 = 1.05, c35 = 0.48

Arbitrage Network: Generalized Min-Cost Flow Problem

Page 24: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

1

4

5

3

30.473

0.674

34.986

Start with 13.801 £ 34.986 D-Mark 30.473 CHF 14.475 £

Remove 0.674 £ $1 leaving 13.801 £

Brit £

US $

CHF

D-Mark13

.801

g54 = 2.535

g43 = 0.871

g35 = 0.475

Note (£ $):g51 = 1.485

Arc gains in optimal cycle:

Total cycle gain: = 1.0488= 4.88%

Solution to Arbitrage Network

Page 25: Lecture 5 – Integration of Network Flow Programming Models Topics Min-cost flow problem (general model) Mathematical formulation and problem characteristics

What You Should Known About General Network Flow Problems

• How to view flow on an arch with a gain or loss.

• How to formulate a general network flow problem as a linear program.

• What the implications are for a network flow problem with gains.

• How to solve general network flow problems using the Excel add-ins.