Jump to content
Chimp

TSP art generator

Recommended Posts

iamtheky

but can you make that an actual solvable maze :)

no but seriously, someone do that.


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

Share this post


Link to post
Share on other sites
RTFC

@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

Share this post


Link to post
Share on other sites
UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Chimp

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 this for example http://lekhaindrao.com/158-large_default/tiffen-4x565-ir-nd15-filter.jpg  (a black square) to the tsp art generator.

tiffen-4x565-ir-nd15-filter.jpg

A "maze" similar to this will be created.

maze1.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.

maze2.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 25/10/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
  • Like 1

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

Share this post


Link to post
Share on other sites
RTFC
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:

  • Like 1

Share this post


Link to post
Share on other sites
Lakes

TSP Art picture of a brain. :)


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites
willichan
DWB

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

Share this post


Link to post
Share on other sites
Chimp

Hi @DWB,

renaming the file cygwin1-20180309.dll to cygwin1.dll should fix....
let us know ...


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

Share this post


Link to post
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

  • Similar Content

    • wakillon
      By wakillon

      Bitmap2AscII use Lucida Console font with a size set to 8, so Windows 8/8.1 users need to change their notepad font and size for get a correct display.
      Image Rescale slider is only available when saving as image.
      A click on the "PreviewEdit" open AscII string in Notepad.
      You can save as Text, Html or Image (add the extension you want)
      Each setting change is immediately applied.
       
      Downloads available in the download section
       
      Hope you like it ! 
       
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.