date: 2025-02-23
title: AM-HW-1
status: DONE
author:
- AllenYGY
tags:
- NOTE
- Assignment
- AAM
publish: true
AM-HW-1
Briefly describe the problem statements of Eulerian paths, Chinese Postman Problem, Hamiltonian paths, and Traveling Salesman Problem.
Eulerian paths:The Eulerian Path Problem is a fundamental question in graph theory that asks whether it is possible to traverse each edge of a graph exactly once without repetition. Euler's theorem states that for a graph to have such a path, the number of vertices with an odd degree must be exactly 0 or 2.
Chinese Postman Problem: A postman departs from the post office, traverses every street in his assigned area, and then returns to the post office. He may walk along any street multiple times but must choose the shortest possible route.
Hamiltonian paths: The Hamiltonian Path Problem involves determining whether there exists a path in a graph that visits each vertex exactly once.
Traveling Salesman Problem: The Traveling Salesman Problem (TSP) is a classic problem in optimization and theoretical computer science. It seeks to determine the shortest possible route that visits a given set of cities exactly once and returns to the starting city.
See Chapter 1.pdf. Draw an Eulerian Path:
Solve the above Chinese Postman Problem starting and ending at point A by the following steps:
There are only 2 odd vertices:
According to the subgraph, we need to add the following edges to make all vertices even:
The shortest path which is:
The total length is:
See Chapter 2.1.pdf.
Suppose we start from point 1, and the distance between each pair of points is as follows:
Here are all possible routes, and their total lengths:
So the shortest paths are
Suppose the salesman starts and ends at city A with the following distances between each pair of cities:
Path1: ABCDA
Firstly, finish a loop, Path1
The total cost of Path1 = 4+2+4+2=12
Current low cost: 11.
So the lowest cost should be no greater than 12.
Backtrack to the second path.
Path2: ABDC... , cost = 4+6+4=14>12, prune
For the remaining paths, we have:
Path3: ACBD.., cost = 6+2+6=14>12, prune
Path4: ACDB..., cost = 6+4+6=16>12, prune
Path5: ADCBA, cost = 2+4+2+4=12
Path6: ADBCA, cost = 2+6+2+6=16>12, prune
Conclusion:
See Chapter 2.2.pdf.
0 | 3 | 6 | 7 | |
5 | 0 | 2 | 3 | |
3 | 4 | 0 | 2 | |
3 | 7 | 5 | 0 |
The sub-problem
In simpler terms,
Base Case: If
Simple Example: If
Consider a TSP with 4 cities (
To solve
We consider the following cost matrix
Here,
Let
If
For each subset
Given the provided cost matrix for the Traveling Salesman Problem (TSP), we can solve it step by step using dynamic programming as outlined in the reference material.
Finally, solve the original problem
Compute
Compute
Compute
Finally:
The minimum cost for the TSP is 10, The optimal path is