Jump to content

TSP art generator


Gianni
 Share

Recommended Posts

but can you make that an actual solvable maze :)

no but seriously, someone do that.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

@Chimp: Great; interesting to see TSP being used in this way^_^.

@iamtheky: This is by definition a solvable maze, as it's a single line. So in a maze like that, just keep either your left hand (c.q. your right hand) touching the nearest left (c.q. right) wall as you keep walking forward, and you'll get to the exit.:P

For those interested in the underlying maths, an example of an AutoIt script solving the TSP (Travelling Salesman Problem), see example 2 in my Simulated Annealing thread.

Edited by RTFC
Link to comment
Share on other sites

Well done @Chimp :thumbsup:

The script doesn't run properly when the path has blanks (white space) and I cannot scroll the result using the scrollbar to the right.

 

 

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Hi all, thanks for the likes and the feedback :)

@iamtheky, about the maze, as @RTFC sayd "This is by definition a solvable maze, as it's a single line", indeed it is already a maze,  but there is a funny way to find quickly the exit, here how: :)
1) to create a "maze" do like this: create a TSP art by setting sampling points to 1000 and then drag & droppo an image like the following for example  (a black square) to the tsp art generator.

x0DoloB.png

A "maze" similar to this will be created.

Gh81e2Z.png

2) now, open the folder of the script and you can find the tsp_art.svg that is the just created tsp_art, Right click it and select the open with notepad option.

go to the last line at the bottom and change this statement  stroke-width="0.25" to stroke-width="2" and save.

3) doubble.click the just modified file and it should open in a browser, zoom in or zoom out  the view of the browser to fit it on the screen if necessary abd then hit the "print screen" key.

4) now paste the screen in msPaint. There, using the eraser 'open' the "enter" of the maze at top left and the "exit" at right bottom.

5) using the fill tool, fill with a color the black line of the maze, you con see that only a part is filled, do the same with another color on the other part.

You can see that the the limit of the 2 colors is the best way to exit the maze.

6VleB63.png

@RTFC, Iv'e already used your nice TSP solver and it would be nice to use it here, but unfortunately the execution speed of AutoIt for solving a tsp problem with a number of points (towns) of the order of some thousands can not compete with the specialized program "concorde", written in C and compiled. (http://www.math.uwaterloo.ca/tsp/concorde/index.html)

 

On 10/25/2017 at 10:57 AM, UEZ said:

The script doesn't run properly when the path has blanks (white space) and I cannot scroll the result using the scrollbar to the right.

  Hi @UEZ, I've modified the script and posted in first post, now should work ok also with paths with white spaces.
About the scroll bars, my intention was to use the display window just as a little preview. For this purpose I'm using this statement within the HTML part that shows the svc file on the browser control: style="width:100%; height:100%;" this should fit the whole image in the available display area without the need of "scrolling", and it works like this on my pc,  but maybe, as you reported, this is not always the case.
The inibition of the scroll bars is due to the fact I've overlapped to the browser control area another trasparent control (a transparent label), that avoids the interaction of the user with the browser control itself. This has been done because otherwise when you drag and drop an image to the browser control, the drop event is captured by the browser control instead of by the GUI, avoiding the management of the drop event into the script.
I will try to use some other technique so to allow the use of the both (suggestions are welcome :))
... anyway, not need to say that the final generated TSP_art is saved in the same directory of the script with the name tsp_art.svg. ready to be doubble-clicked...,, also the intermediate "voronoi art" is saved in the same directory with the name of out.svg.

Edited by Chimp
update images links

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

14 hours ago, Chimp said:

unfortunately the execution speed of AutoIt for solving a tsp problem with a number of points (towns) of the order of some thousands can not compete

I'm not surprised.:lol: Thanks for the reference; unfortunately, the website appears to be down at the moment; I'll try again later.

It's funny though; the longer I look at these patterns, the more I'm reminded of brains; possibly not a coincidence that TSP optimises for shortest path and neuronal connections form a small-world network. Food for thought...:think:

Link to comment
Share on other sites

  • 4 months later...

I am new to TSP art and to AutoIt.  I've downloaded all the dependencies and script into a single director (C:\TSP).  When I double-click on the script (TSP.au3), nothing happens.  I've attached an image of the directory in which I'm working.  I'd like to make TSP art from the Tree1.png file.  Thanks for any suggestions on how to proceed.

 

Image1.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...