Sie sind auf Seite 1von 12

1

Network Models
Based on: Operations Research: Applications and Algorithms
by Wayne L. Winston
Basic Definitions
A graph or network is defined by two sets of
symbols: nodes and arcs.
A set (call it V) of points, or vertices. The
vertices of a graph or network are also called
nodes
2
nodes.
An arc consists of an ordered pair of vertices
and represents a possible direction of motion
that may occur between vertices.
A sequence of arcs such that every arc has
exactly one vertex in common with the
previous are is called a chain.
A path is a chain in which the terminal node of
each arc is identical to the initial node of next
arc.
For example in the figure below:
(1 2) (2 3) (4 3) i h i b t t th
3
(1,2)-(2,3)-(4,3) is a chain but not a path;
(1,2)-(2,3)-(3,4) is a chain and a path, which
represents a way to travel from node 1 to node 4.
2 3
1 4
Shortest Path Problems
Assume that each arc in the network has a
length associated with it.
The problem of finding the shortest path from
node 1 to any other node in the network is
called a shortest path problem
4
called a shortest path problem.
Assuming that all arc lengths are non-negative,
Dijkstras algorithm, can be used to find the
shortest path from a node.
Finding the shortest path between node i and
node j in a network may be viewed as a
5
node j in a network may be viewed as a
transshipment problem.
The transshipment problem can then easily be
solved by using LINGO.
Shortest Path Problem
Consider the following flow network:
1
2
3
d
12
6
d
23
d
26
d
36
d
d
13
6
1 3
4 5
The objective is to find the shortest path fromnode 1 to node n.
The distance fromnode i to j, d
ij
does not have to equal the
distance fromnode j to i, d
ji
.
d
14
d
35
d
45
d
56
d
34
2
Dijkstras labeling algorithm:
1
2
3
3
6
2
9
6
3
3
7
Shortest Path Problem
7
4 5
Summary: Nodes are
permanently labeled or
temporarily labeled. All nodes that can beimmediately reached from
permanently labeled nodes aretemporarily labeled. Thelabel is theminimum
of thesumof thedistancefromnode1 to thepermanent nodeplus thedistance
to thetemporary node. Start with node1 as theonly permanently labeled
node. Find thetemporarily labeled nodewith minimumdistance. Makethis
nodepermanent. Repeat this process until all nodes arepermanently labeled.
4
3
3
1
Dijkstras labeling algorithm:
1
[0]
2
(3,1)
3
(71)
3
6
2
9
6
3
7
) (
Shortest Path Problem
8
[0] (7,1)
4
(4,1)
5
[ ] permanent label
(d,f) temporary label; d distance, f - fromnode
L(0) =[0, 3, 7, 4, inf., inf.] choose node 2
*
4
3
3
1
) (
Dijkstras labeling algorithm:
1
[0]
2
[3,1]
3
(52)
3
6
(12,2)
2
9
6
3
7
Shortest Path Problem
9
[0] (5,2)
4
(4,1)
5
L(1) =[0, 3, 5, 4, inf., 12] choose node 4
* *
4
3
3
1
) (
Dijkstras labeling algorithm:
1
[0]
2
[3,1]
3
(52)
3
6
(12,2)
2
9
6
3
7
Shortest Path Problem
10
[0] (5,2)
4
[4,1]
5
(7,4)
L(2) =[0, 3, 5, 4, 7, 12] choose node 3
* * *
4
3
3
1
Dijkstras labeling algorithm:
1
[0]
2
[3,1]
3
[52]
3
6
(11,3)
2
9
6
3
7
Shortest Path Problem
11
[0] [5,2]
4
[4,1]
5
(7,4)
L(3) =[0, 3, 5, 4, 7, 11] choose node 5
* * * *
4
3
3
1
Dijkstras labeling algorithm:
1
[0]
2
[3,1]
3
[52]
3
6
(10,5)
2
9
6
3
7
Shortest Path Problem
12
[0] [5,2]
4
[4,1]
5
[7,4]
L(4) =[0, 3, 5, 4, 7, 10] choose node 6
* * * * *
4
3
3
1
3
Dijkstras labeling algorithm:
1
[0]
2
[3,1]
3
[52]
3
6
[10,5]
2
9
6
3
7
Shortest Path Problem
13
[0] [5,2]
4
[4,1]
5
[7,4]
L(5) =[0, 3, 5, 4, 7, 10] done
* * * * * *
Shortest Path: 1-4-5-6
4
3
3
1
Shortest Path Problem
Cost Example
d
14
d
Equipment Replacement Problem:
d
15

+ =
i j
t
t i j i ij
c S K d
1
14
where K
i
is purchase price in year i , S
i
is salvage value
after i years in service, and c
t
is maintenance cost after t
years of service.
1 5
d
12
d
35
d
45
d
13
2 3 4
d
23
d
34
Example 1: Equipment Replacement
Assume that a new car (or machine) has been
purchased for $12,000 at time 0.
The cost of maintaining the car during a year
depends on the age of the car at the beginning
of the year as given in the table below
15
of the year, as given in the table below.
Age of Car
(Years)
Annual
Maintenance
cost
Age of Car
(Years)
Trade-in Price
0 $2,000 1 $7,000
1 $4,000 2 $6,000
2 $5,000 3 $2,000
3 $9,000 4 $1,000
4 $12,000 5 $0
Example 1 - continued
In order to avoid the high maintenance cost
associated with an older car, we may trade in
the car and purchase a new car.
To simplify the computations we assume that
at any time it costs $12 000 to purchase a new
16
at any time it costs $12,000 to purchase a new
car.
The goal is to minimize the net cost incurred
during the next five years.
Example 1: Solution
This problem should be formulated as a
shortest path problem.
The network will have six nodes.
Node i is the beginning of year i and for i<j, an arc
(i j) corresponds to purchasing a new car at the
17
(i,j) corresponds to purchasing a new car at the
beginning of year i and keeping it until the beginning
of year j.
The length of arc (i,j) (call it c
ij
) is the total net
cost incurred from year i to j.
c
ij
= maintenance cost incurred during years i,i+1,,j-1
+ cost of purchasing a car at the beginning of year i
- trade-in value received at the beginning of year j
Ex. 1 Solution continued
Applying this formula to the information the
problem yields
c
12
=2+12-7=7
c
13
=2+4+12-6=12
c
14
=2+4+5+12-2=21
c
15
=2+4+5+9+12-1=31
c
16
=2+4+5+9+12+12-0=44
c
23
=2+12-7=7
c
24
=2+4+12-6=12
c 2+4+5+12 2 21
18
15
c
25
=2+4+5+12-2=21
c
26
=2+4+5+9+12-1=31
c
34
=2+12-7=7
c
35
=2+4+12-6=12
c
36
=2+4+5+12-2=21
c
45
=2+12-7=7
c
46
=2+4+12-6=12
c
56
=2+12-7=7
4
Ex. 1 Solution continued
From the figure below we can see that both
path 1-3-5-6 and 1-2-4-6 will give us the
shortest path with a value of 31.
44
19
1 6 5 4 3 2
7 7 7 7 7
21
12
12
21
31
12
21
31
44
12
Example-2
A company sells seven types of boxes, ranging in volume from
17 to 33 cubic feet. The demand and size of each box is given
below
Box type: 1 2 3 4 5 6 7
Size: 33 30 26 24 19 18 17
20
Demand: 400 300 500 700 200 400 200
The variable cost (in Rupees) of producing each box is equal to
the boxs volume. A fixed cost of Rs. 1000 is incurred to
produce any of a particular box. If the company desires,
demand for a box may be satisfied by a box of larger size.
Formulate and solve a shortest-path problem whose solution
will minimize the cost of meeting the demand for boxes.
Maximum Flow Problems
Many situations can be modeled by a network
in which the arcs may be thought of as having
a capacity that limits the quantity of a product
that may be shipped through the arc.
In these situations it is often desired to
21
In these situations, it is often desired to
transport the maximum amount of flow from a
starting point (called the source) to a terminal
point (called the sink).
These types of problems are called maximum
flow problems.
Maximal Flow Problem
The maximal flow problem is concerned with
determining the maximal volume of flow from
one node (called the source) to another node
(called the sink).
In the maximal flow problem each arc has a
22
In the maximal flow problem, each arc has a
maximum arc flow capacity which limits the
flow through the arc.
Example: Maximal Flow
Network Model
22 55
44
33
22
33
44
2
33
33
Sink Sink Source Source
23
11 44 77
33 66
44
33
44
33
33
11
55
5555 11
66
33
Sink Sink Source Source
Example: Maximal Flow
A capacitated transshipment model can be
developed for the maximal flow problem.
We will add an arc from node 7 back to node 1
to represent the total flow through the
network
24
network.
There is no capacity on the newly added 7-1
arc.
We want to maximize the flow over the 7-1
arc.
5
Example: Maximal Flow
Modified Network Model
22 55
44
33
22
33
44
2
33
33
Sink Sink Source Source
25
11 44 77
33 66
44
33
44
33
33
11
55
5555 11
66
33
Sink Sink Source Source
Maximal Flow Problem
LP Formulation
(as Capacitated Transshipment Problem)
There is a variable for every arc.
There is a constraint for every node; the flow out
l h fl
26
must equal the flow in.
There is a constraint for every arc (except the added
sink-to-source arc); arc capacity cannot be exceeded.
The objective is to maximize the flow over the added,
sink-to-source arc.
Maximal Flow Problem
LP Formulation
(as Capacitated Transshipment Problem)
Max x
k1
(k is sink node, 1 is source node)
27
s.t. Ex
ij
- Ex
ji
= 0 (conservation of flow)
i j
x
ij
< c
ij
(c
ij
is capacity of ij arc)
x
ij
> 0, for all i and j (non-negativity)
(x
ij
represents the flow from node i to node j)
Example: Maximal Flow
LP Formulation
18 variables (for 17 original arcs and 1 added arc)
24 constraints
7 node flow-conservation constraints
28
17 arc capacity constraints (for original arcs)
Example: Maximal Flow
LP Formulation
Objective Function
Max x
71
Node Flow-Conservation Constraints
29
x
71
- x
12
- x
13
- x
14
= 0 (flow in & out of node 1)
x
12
+ x
42
+ x
52
x
24
- x
25
= 0 (node 2)
x
13
+ x
43
x
34
x
36
= 0 (etc.)
x
14
+ x
24
+ x
34
+ x
54
+ x
64
x
42
- x
43
- x
45
- x
46
- x
47
= 0
x
25
+ x
45
x
52
x
54
- x
57
= 0
x
36
+ x
46
- x
64
- x
67
= 0
x
47
+ x
57
+ x
67
- x
71
= 0
Example: Maximal Flow
LP Formulation (continued)
Arc Capacity Constraints
x
12
< 4 x
13
< 3 x
14
< 4
x
24
< 2 x
25
< 3
30
x
24
< 2 x
25
< 3
x
34
< 3 x
36
< 6
x
42
< 3 x
43
< 5 x
45
< 3 x
46
< 1 x
47
< 3
x
52
< 5 x
54
< 5 x
57
< 5
x
64
< 5 x
67
< 5
6
Example: Maximal Flow
Optimal Solution
22 55
33
22
11
2
S k S k SS
31
11 44 77
33 66
44
33
33
11
11
5555
44
Sink Sink Source Source
10 10
Example 3: Maximum Flow
Sunco Oil wants to ship the maximum possible
amount of oil (per hour) via pipeline from node
s
o
to node s
i
.
(0)3
a0(2)
Arc Capacity
(so,1) 2
(so 2) 3
32
The various arcs represent pipelines of different
diameters.
The maximum number of barrels of oil that can
be pumped through each arc the arc capacity.
so si 2 1
(2)2 (2)3 (2)2
(0)3
3 (0)4
(0)1
(so,2) 3
(1,2) 3
(1,3) 4
(3,si) 1
(2,si) 2
Continued
Formulate an LP that can be used to determine
the maximum number of barrels of oil per hour
that can be send from so to si.
33
Ex. 3 Solution continued
Let x
0
be the flow through the artificial arc, the
conservation of flow implies that x
0
= total amount of oil
entering the sink.
Suncos goal is to maximize x
0
.
Max Z= X0
S t Xso 1<=2 (Arc Capacity constraints)
34
One optimal solution to this LP is Z=3, x
so,1
=2, x
13
=1,
x
12
=1, x
so,2
=1, x
3,si
=1, x
2,si
=2, x
o
=3.
S.t. Xso,1<=2 (Arc Capacity constraints)
Xso,2<=3
X12<=3
X2,si<=2
X13<=4
X3,si<=1
X0=Xso,1+Xso,2 (Node so flow constraints)
Xso,1=X12+X13 (Node 1 flow constraints)
Xso,2+X12=X2,si (Node 2 flow constraints)
X13+X3,si (Node 3 flow constraints)
X3,si+X2,si=X0 (Node si flow constraints)
Xij>=0
The maximum flow in a network can be found
using LINDO, but LINGO greatly lessens the
effort needed to communicate the necessary
information to the computer.
Important questions Ford-Fulkerson Method
35
po ta t quest o s o d u e so et od
Given a feasible flow, how can we tell if it an optimal
flow (that is maximizes x0)?
If a feasible flow is nonoptimal, how can we modify
the flow to obtain a new feasible flow that has a
larger flow from the source to the sink?
Choose any set of nodes V that contains the
sink but does not contain the source. Then the
set of arcs (i,j) with i not in V and j a member
of V is a cut for the network.
The capacity of a cut is the sum of the
36
The capacity of a cut is the sum of the
capacities of the arcs in the cut.
The flow from source to sink for any feasible
flow is less than or equal to the capacity of any
cut.
If the sink cannot be labeled, then
Capacity of CUT = current flow from source to sink
7
Minimum Cost Network Flow
Problems
The transportation, assignment,
transshipment, shortest path, maximum flow,
and CPM problems are all special cases of
minimum cost network flow problems (MCNFP).
Any MCNFP can be solved by a generalization
37
Any MCNFP can be solved by a generalization
of the transportation simplex called the
network simplex.
MCNFP can be written as
ij ij ij
j k
i ki ij
allarcs
ij ij
U X L
b X X t s
X c
s s
=

. .
min
(for eachnodei inthenetwork)
(for eacharcinthenetwork)
Constraints stipulate that the net flow out of
node i must equal b
i
and are referred to as the
flow balance equation.
Consider the following transportation problem
38
1
2 4
3
Supply point 1
Supply point 2 Demand point 2
Demand point 1
1 2 4 (Node 1)
3 4 5 (Node 2)
6 (Node 3) 3 (Node 4)
MCNFP representation of the problem
min Z=X
13
+2X
14
+3X
23
+4X
24
X
13
X
14
X
23
X
24
rhs Constraint
1 1 0 0 4 Node 1
39
1 1 0 0 = 4 Node 1
0 0 1 1 = 5 Node 2
-1 0 -1 0 = -6 Node 3
0 -1 0 -1 = -3 Node 4
All Variables nonnegative
The flow balance equations in any MCNFP have
this important property:
Each variable x
ij
has a coefficient of +1 in the
node i flow balance equation, a coefficient of -1
40
in the node j flow balance equation, and a
coefficient of 0 in all other flow balance
equations.
LINGO can easily be used to solve ay MCNFP
problem.
Minimum Spanning Tree
Problems
Suppose that each arc (i,j) in a network has a
length associated with it and that arc (i,j)
represents a way of connecting node i to node
j.
In many applications it must be determined
41
In many applications it must be determined
that the set of arcs in a network that connects
all nodes such that the sum of the length of
the arcs is minimized. Clearly, such a group of
arcs contain no loop.
For a network with n nodes, a spanning tree
is a group of n-1 arcs that connects all nodes
of the network and contains no loops.
A spanning tree of minimum length in a
network is a minimum spanning tree (MST).
The MST Algorithm may be used to find a
minimum spanning tree.
B i t d i d j i d i t th d i
42
Begin at any node i, and join node i to the node in
the network (call it node j) that is closest to node i.
The two nodes i and j now form a connected set of
nodes C={i,j}, and arc (i,j) will be in the minimum
spanning tree. The remaining nodes in the network
(call them ) are referred to as the unconnected set
of nodes.
8
Now choose a member of C (call it n) that is closest
to set C. Let m represent the node in C that is closest
to n. Then the arc(m,n) will be in the minimum
spanning tree. Now update C and C. Since n is now
connected to {i,j}, C now equals {i,j,n} and we must
eliminate node n from C.
43
Repeat this process until a minimum spanning tree is
found. Ties for closest node and arc to be included in
the minimum spanning tree may be broken
arbitrarily.
Example: MST Algorithm
The State University campus has five
computers. The distances between each pair os
computers are given.
What is the minimum length of cable required
to interconnect the computers?
44
to interconnect the computers?
Note that if two computers are not connected this is
because of underground rock formations.
4
2
5
3
1
6
4
5
1
3
2
2
2
4
Example: Solution
We want to find the minimum spanning tree.
Iteration 1: Following the MST algorithm discussed
before, arbitrarily choose node 1 to begin. The
closest node is node 2. Now C={1,2}, ={3,4,5},
and arc(1,2) will be in the minimum spanning tree.
45
4
2
5
3
1
6
4
5
1
3
2
2
2
4
Ex. Solution continued
Iteration 2: Node 5 is closest to C. since node
5 is two blocks from node 1 and node 2, we
may include either arc(2,5) or arc(1,5) in the
minimum spanning tree. We arbitrarily choose
to include arc(2,5). Then C={1,2,5} and

46
={3,4}.
4
2
5
3
1
6
4
5
1
3
2
2
2
4
Ex. Solution continued
Iteration 3: Since node 3 is two blocks from
node 5, we may include arc(5,3) in the
minimum spanning tree. Now C={1,2,5,3} and
={4}.
1
1
47
4
2
5
3
1
6
4
5
1
3
2
2
2
4
Ex. Solution continued
Iteration 4: Node 5 is the closest node to node
4. Thus, we add arc(5,4) to the minimum
spanning tree.
The minimum spanning tree consists of
arcs(1 2) (2 5) (5 3) and (5 4) The length of
48
arcs(1,2), (2,5), (5,3), and (5,4). The length of
the minimum spanning tree is 1+2+2+4=9
blocks.
4
2
5
3
1
6
4
5
1
3
2
2
2
4
9
Another Example : Minimal Spanning Tree
2
3
6
9
6
Objective: Find the minimumdistance such that all
nodes are visited once (i.e. no cycles).
49
1 3
4 5
3
4
2
6
3
3
3
1
7
Minimal Spanning Tree
2
3
6
9
One possible spanning tree, Z =26 (note, no cycles).
50
1 3
4 5
3
4
3
7
Minimal Spanning Tree
Possible applications:
Phone lines between cities.
Rail lines between cities.
Road networks.
Air conditioning ducts.
2 6
9
51
etc..
1
2
3
4 5
3
6
4
3
7
Minimal Spanning Tree
Algorithm:
Step 1 Select an arbitrary node initially. Identify a node
that is closest and include the arc connecting these two nodes
in the spanning tree.
52
Step 2 Out of the remaining nodes, determine the one that
is closest to a node already selected in the spanning tree.
Include the arc connecting these two nodes in the spanning
tree. Whenever there is a tie for the closest node, it is
broken arbitrarily.
Minimal Spanning Tree
2
3
6
9
6
Start with node 1. Node 2 is closest.
53
1 3
4 5
3
4
2
6
3
3
3
1
7
Minimal Spanning Tree
2
3
6
9
6
Node 3 is closest to partial spanning tree {(1,2)}. Remove
any cycles.
54
1 3
4 5
3
4
2
6
3
3
3
1
10
Minimal Spanning Tree
2
3
6
9
6
Node 4 is closest to partial spanning tree {(1,2), (2,3)}.
Remove any cycles.
55
1 3
4 5
3
2
6
3
3
3
1
Minimal Spanning Tree
2
3
6
9
6
Node 5 is closest to partial spanning tree {(1,2), (2,3),(3,4)}.
Remove any cycles. Note, arbitrarily select (3,5) or (4,5).
56
1 3
4 5
3
2
6
3
3
1
Minimal Spanning Tree
2
3
6
Node 6 is closest to partial spanning tree {(1,2), (2,3),(3,4),(4,5)}.
Remove any cycles. Stop, no more nodes.
57
1 3
4 5
3
2
3
3
1
Minimal spanning tree is {(1,2), (2,3),(3,4),(4,5),(5,6)}. Z =12.
The Constrained Shortest Path Problem
(1,10)
(1,1)
(1,7)
(2,3)
2
4
58
(10,3)
(12,3)
(2,2)
(1,2)
(10,1)
(5,7)
1
5
3
6
Find the shortest path from node 1 to node 6
with a transit time at most 10
Constrained Shortest Paths: LP
Formulation
Given: a network G = (N,A)
c
ij
cost for arc (i,j)
t
ij
traversal time for arc (i,j)
c x
Z* = Min
59
( , )
ij ij
i j A
c x
e
Z* = Min
s. t.
1 if i =s
1 if i =t
0 otherwise
ij ji
j j
x x


( , )
ij ij
i j A
t x T
e
s

0 or 1 for all ( , )
ij
x i j A = e
Complicating constraint
Classes of routing problems
Traveling salesman problem (TSP)
Multiple traveling salesman problem (MTSP)
Vehicle routing problem (VRP)
60
Chinese postman problem (CPP)
11
Traveling salesman problem:
The integer programming formulation
x c Min
x
i j k
ijk ijk
ijk

s constraint Subject to
otherwise , 0
k leg during j to i node from goes salesman the if , 1
61
j i n i x
j i n j x
x
x
j
n
k
ijk
i
n
k
ijk
n i
j
= = =
= = =
=
=

=
=
=
; ,..., 3 , 2 , 1 , 1
; ,..., 3 , 2 , 1
1
1
1
1
1
1 i i,
1
1 j j,
1 1
Traveling salesman problem:
The integer programming formulation
s constraint Subject to
otherwise , 0
k leg during j to i node from goes salesman the if , 1

i j
ij ij
ijk
x c Min
x
62
) 0 ; ,..., 3 , 2 , ,..., 3 , 2 ; (for 1
; ,..., 3 , 2 , 1
1,2,...N) i (for 1
1,2,...N) j (for 1
s constraint Subject to
1
1
1
1
> = = = s +
= = =
= =
= =

=
=
=
j ij j i
i
n
k
ijk
N
j
ij
N
i
ij
u N j N i j i N Nx u u
j i n j x
x
x
Solving TSP
Branch-and-Bound method is an effective way
of solving TSPs
There are many heuristics to solve TSPs
63
Traveling salesman problem:
The nearest neighbor procedure
1. Start with a node at the beginning of the tour (the depot
node).
2. Find the node closest to the last node added to the tour.
3. Go back to step-2 until all nodes have been added.
4. Connect the first and the last nodes to form a complete tour.
64
Advantage:
1. Simple and gives a near optimal solution
Disadvantage:
1. May not give a optimal solution
Traveling salesman problem:
The nearest neighbor procedure
From
Node
To node (distance in kilometers)
A B C D E F
A - 5.4 2.8 10.5 8.2 4.1
65
B 5.4 - 5.0 9.5 5.0 8.5
C 2.8 5.0 - 7.8 6.0 3.6
D 10.5 9.5 7.8 - 5.0 9.5
E 8.2 5.0 6.0 5.0 - 9.2
F 4.1 8.5 3.6 9.5 9.2 -
Traveling salesman problem:
The nearest neighbour procedure
Solution:
A C F B E D A
66
The length of the tour 35.4 km
Best tour
A B E D C F A
The length of the tour 30.9 km
12
Traveling salesman problem:
The nearest neighbor procedure
For smaller networks it is easy to enumerate all
possible tours and select the best.
But with bigger networks it is not possible even
with super computers (why?) So approximate
67
with super computers (why?). So approximate
solutions can be useful
The nearest neighbour procedure can be
repeated assuming each node as starting point
to find still better solutions. In the example
above the best solution (31.3 km) is
F C A B E D F
Multiple traveling salesman problem
and
Vehicle routing problem
The MTSP is a generalization of the TSP where
there are multiple vehicles and a single depot.
In MTSP when there are restrictions on the
68
capacity of the multiple vehicles and demand
at each node is different the problem is
classified as Vehicle routing problem.
The Vehicle routing problem
Cluster first, route second approach
Use optimization algorithm for block formation
Include the affect of peak periods, existing
route, vehicle type etc.
Updation
69

Das könnte Ihnen auch gefallen