Download Terms and Algorithms

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

List of regular polytopes and compounds wikipedia , lookup

Four color theorem wikipedia , lookup

Transcript
Chapter 6 – The Traveling Salesman Problem
 Hamilton path
A path that visits each vertex of the graph once and only once
 Hamilton circuit
A circuit that visits each vertex of the graph once and only once (at the end, of
course, the circuit must return to the starting vertex).
Dirac’s theorem:
If a connected graph has N vertices (N > 2) and all of them have degree bigger or equal to N / 2,
then the graph has a Hamilton circuit.
A graph with N vertices in which every pair of distinct vertices is joined by an edge is
called a complete graph on N vertices and denoted by the symbol K .
N
Number of Edges in K
N
 K has N(N – 1)/2 edges.
N
 Of all graphs with N vertices and no multiple edges or loops, K has the most
N
edges.
Number of Hamilton Circuits in K
N
There are (N – 1)! Distinct Hamilton circuits in K .
N
Any graph whose edges have numbers attached to them is called a weighted
graph, and the numbers are called the weights of the edges. The graph is called a
complete weighted graph.
Algorithm 1: The Brute-Force Algorithm
 Step 1. Make a list of all the possible Hamilton circuits of the graph.
 Step 2. For each Hamilton circuit calculate its total weight (add the weights of all
the edges in the circuit).
 Step 3. Choose an optimal circuit (there is always more than one optimal circuit
to choose from!).
Algorithm 2: The Nearest-Neighbor Algorithm
 Start. Start at the designated starting vertex. If there is no designated starting
vertex, pick any vertex.
 First step. From the starting vertex go to its nearest neighbor (the vertex for
which the corresponding edge has the smallest weight.
 Middle steps. From each vertex go to its nearest neighbor, choosing only
among the vertices that haven’t been yet visited. (If there is more than one,
choose at random). Keep doing this until all the vertices have been visited.
Algorithm 3: The Repetitive Nearest-Neighbor Algorithm
 Let X be any vertex. Find the nearest-neighbor circuit using X as the starting
vertex and calculate the total cost of the circuit.
 Repeat the process with each of the other vertices of the graph as the starting
vertex.
 Of the nearest-neighbor circuits obtained, keep the best one. If there is a
designated starting vertex, rewrite the circuit using that vertex as the reference
point.
Algorithm 4: The Cheapest-Link Algorithm
Step 1. Pick the cheapest link (edge with smallest weight) available.
Step 2. Pick the next cheapest link available and mark it.
Step 3, 4, …, N -1 Continue picking and marking the cheapest unmarked link available
that does not
(a) close a circuit, or
(b) create three edges coming out of a single vertex.
Step N. Connect the last two vertices to close the circuit.
The Hamilton circuit can now be described using any vertex as the reference point.