travelling-salesman | Brute force solution to Travelling Salesman Problem
kandi X-RAY | travelling-salesman Summary
kandi X-RAY | travelling-salesman Summary
Brute force solution to Travelling Salesman Problem (TSP)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Calculate the distance between two points .
- Initialize the object .
travelling-salesman Key Features
travelling-salesman Examples and Code Snippets
Community Discussions
Trending Discussions on travelling-salesman
QUESTION
I'm unsure of which algorithm I should use to accomplish this task. I have a graph of nodes. Some nodes are connected with a weighted line that are required to be traversed. However, every node is connected with a weighted, bi-directional line. Only some of the lines must be traversed while the others are just for navigation. I need to find a path to go over all these required lines (bi-directional), but only go over the lines one time. I know which node I must start with.
The real-world problem is that I have a list of edges that need cut from a CNC pattern. I'm trying to decrease the amount of time the CNC machine spends cutting out this pattern. I know I always want to start at the origin, but I don't care where the pattern ends, just as long as all the little pieces in the pattern are cut out. I know how long each edge of the pieces will take to cut out, and the machine is accurate enough that it can lift up the head and go to any point to start from that position. My graph isn't huge, maybe up to 100 nodes in a general case.
This is unlike the travelling-salesman because I don't have to start and end at the same place, and I'm allowed to (and required) to hit a node multiple times.
Djikstras algorithm doesn't work because I need to traverse all the nodes to get all the edges cut... I'm not just trying to find the fastest way from point A to B.
Bonus, I need this implemented in C#, but even if I just knew what algorithm, I can probably get it programmed.
Here is a sample picture of a pattern I need to cut out. Note, there is one diagonal and one arc I forgot to assign a weight to, which can be 50 for the diagonal, and 75 for the arc:
...ANSWER
Answered 2020-Apr-14 at 20:35I think this would still reduce to the traveling salesman problem. TSP does not get any easier by removing the return-to-origin rule or allowing multiple visits.
As such there would be no polonomial solution, and your best bet is probably an approximate solution.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install travelling-salesman
You can use travelling-salesman like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page