Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce travel time by solving open-loop TSP on paths #13

Open
sameer opened this issue Jun 8, 2021 · 3 comments
Open

Reduce travel time by solving open-loop TSP on paths #13

sameer opened this issue Jun 8, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@sameer
Copy link
Owner

sameer commented Jun 8, 2021

This is an idea I had from the very beginning, but requires a lot of time investment for questionable reward.

svg2gcode draws paths one by one with a naive DFS traversal of the SVG. There is a better way to do this that could be faster. Each path has a start and an end point. We could solve the open loop traveling salesman problem on the set of all paths to find the ordering that minimizes the total G0 move time.

It is a bit difficult as this is unfortunately not a Euclidean TSP, but some modification thereof due to the path start/stop points.

@sameer sameer changed the title Reduce travel time by solve open-loop TSP on paths Reduce travel time by solving open-loop TSP on paths Aug 20, 2021
@thomaskole
Copy link

Perhaps a good place to start, I've had good experience with this:

https://xyzbots.com:4000/gcode-optimizer/

@timschmidt
Copy link

The hilbert crate can provide an approximate solution to this problem which preserves locality through the 2D->1D transformation: https://crates.io/crates/hilbert Because points in hilbert 1D space are also close to each other in 2D space and vice versa.

@kvdveer
Copy link

kvdveer commented Mar 13, 2024

I'm going to have a stab at this. Don't let that dissuade other from trying too - I'm learning rust in the process, in my (rare) off-hours.

@sameer suggested using https://github.com/sameer/raster2svg/blob/main/src/graph/tsp.rs, I'll investigate that first.
It's not going to be a drop-in solution, as gcode moves don't end where they start, and also they can be reversed. This makes the problem different than a point-to-point traveling salesman problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants