File: algo-cpp.xml

package info (click to toggle)
libgroboutils-java 5-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,496 kB
  • sloc: java: 59,880; xml: 12,762; sh: 377; perl: 104; makefile: 20
file content (91 lines) | stat: -rw-r--r-- 3,531 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<head>
    <name>Algorithm: Directed Chinese Postman Problem</name>
    <doc-version>$Date: 2003/10/06 11:16:09 $</doc-version>
    <author>Matt Albrecht</author>
</head>
<!--
&#x2208; = contained in the set
&#x211d; = the set of all Real numbers
&#x2265; = greater than or equal to
&#x2200; = for all
&#x220b; = such that
&#x3c6; = phi
&#x2211; = sum (as sigma)
-->
<body>
<section>About The Chinese Postman Problem</section>
<P>
The Chinese Postman Problem (CPP) is one of those graph theory problems with a
host of applications.  Since it belongs in the realm of graph theory (and,
thus, combinatorics), I shall explain the algorithm and the current
implementation in graph theroy terminology.
</P>
<P>
The CPP resembles the Traveling Salesman Problem (TSP), but the postman in this
problem must visit each road (edge) in the city (graph) to deliver the mail.
Unlike TSP, CPP for either the directed or undirected case can be solved in
polynomial time (mixed mode is NP-hard) <ref name="1"/>.
</P>
<P>
Let <B>G</B>(<B>E</B>,<B>V</B>) be a directed graph, where
<B>V</B> is the set of all verticies in the graph, and <B>E</B> is the set of all
edges.  We define each edge to be the set
{<i>label</i>, (<i>i</i>, <i>j</i>), <i>w<sub>e</sub></i>},
where <i>label</i> is an identifier for the edge, the ordered pair
(<i>i</i>, <i>j</i>) forms a directed edge from vertex <i>i</i> to vertex
<i>j</i> (<i>i</i> and <i>j</i> &#x2208; V), and <i>w<sub>e</sub></i> is the
weight of the edge (for our purposes, <i>w<sub>e</sub></i> &#x2208; &#x211d;).
To aid us later, we also create a mapping <i>f<sub>w</sub></i>(<i>e</i>) =
<i>w<sub>e</sub></i> &#x2200; <i>e</i> &#x2208; <B>E</B>.
</P>
<P>
Mathematicians say that this graph is a <i>multigraph</i>
since it allows multiple edges with the same ordered pair (<i>i</i>, <i>j</i>).
I'll say that <B>E</B><i><sub>ij</sub></i> is the set of all edges whose
ordered pair of vertices match (<i>i</i>, <i>j</i>).
</P>
<P>
To solve the CPP, we must find a <i>Chinese Postman Tour</i> (CPT).
A CPT is a circuit that includes every element of <B>E</B>.
An <i>optimal</i> CPT must minimize the "cost" of the tour (I'll go into
detail about the "cost" later).
</P>
<P>
Unlike an Euler circuit, in which each edge can only be traversed once, the CPP
allows for multiple traversals of an edge.  Let <i>f<sub>ij</sub></i> be the
extra number of times the CPT traverses any directed edge from <i>i</i> to
<i>j</i>; since every edge has to be traversed at least once,
<i>f<sub>ij</sub></i> + 1 &#x2265; 1 is the number of times edge <i>e</i>
is traversed in the CPT.
</P>
<P>
We write <i>c<sub>ij</sub></i> to mean the minimal weight value for all edges
with vertices <i>i</i> to <i>j</i>, so that
    <i>c<sub>ij</sub></i> = <tt>min</tt>(<i>f<sub>w</sub></i>(<i>e</i>))
    &#x2200; <i>e</i> &#x2208; <B>E</B><i><sub>ij</sub></i>.
</P>
<P>
Thus, we can express the optimization of the CPT as minimizing the weight of
the extra edge visits <ref name="2" />:
<BLOCKQUOTE>
<i>&#x3c6;</i> = &#x2211; <i>c<sub>ij</sub></i> <i>f<sub>ij</sub></i>
</BLOCKQUOTE>

</P>

<reflist>
    <refitem id="1">
    C. H. Papadimitriou, "On the Complexity of Edge Traversing,"
    <i>Journal of the ACM</i>, 23:544-554, 1976.
    </refitem>
    <refitem id="2">
    Harold Thimbleby, "The Directed Chinese Postman Problem,"
    <i>Middlesex University School of Computing Science Technical Report</i>,
    October 2000.
    </refitem>
</reflist>
</body>
</document>