It is currently Mon Mar 18, 2024 10:02 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 73 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 3:03 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
Not going to rehash all that I've done already at the registry, but the link to that is here (http://registry.gimp.org/node/22301). I did use the Stipple program mentioned a few days ago, used Inkscape to scale down the points to a dot, converted it into a pbm file (in GIMP), and then fed the results into the python program (not a GIMP plugin though). I couldn't get the non-GIMP python programs to exactly work, but, with mods, got it to at least retain the TSP file (so I was able to digitize the bitmapped points anyway) and open the resulting TSP file in Concorde and do a quick plot and then copy/paste and merged in GIMP. If any python programmers out there can help me, I won't mind. Again, I got it to the point of getting the digitized file to create (TSP), but I then get this error.

Attachment:
python_error.png
python_error.png [ 41.56 KiB | Viewed 6402 times ]


Below's the result that I acquired; bitmapped based though and I did some GIMP stuff to enhance it. :


Attachments:
tsp.png
tsp.png [ 47.41 KiB | Viewed 6402 times ]

_________________
Lyle

Psalm 109:8

Image
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 6:18 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
What the hey; another one. Smoothed it some with some G'MIC presets and then vector simplified (Potrace) for additional cleanup. :)


Attachments:
sc_skull.png
sc_skull.png [ 244.63 KiB | Viewed 6359 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 7:11 pm  (#3) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
I fixed mine in Ubuntu, tell me what line 258, in tspart.py, says.

Are you placing your pbm file as input-file?

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 7:22 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
Hey Mahvin; I don't have a debugger or code editor, but believe this is the area where it is failing. I pretty much am sure it has to do with the sofile variable. I know tspfile is correct since I was able to block the deletion of the tsp file (which means the code that digitizes the bitmap is running correctly) and I'm using that file to run it in Concorde. If you got it to port the SVG file (i.e., had to solve the problem before doing so), then I'm all ears. Sucks to do it manual, but still, better then not being able to do so at all. Again, programmer I'm not. lol

:)

# Run the solver
print 'Running TSP solver ... '
cmd = LINKERN + LINKERN_OPTS % ( linkern_runs, solfile, tspfile )
pipe = os.popen( cmd, 'w' )
status = pipe.close()

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 7:27 pm  (#5) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
Well, in Ubuntu, I had to re-direct tsp to my linkern binary which was in my concorde folder, it was looking for it in usr/local/bin. So, after a quick thought, I just moved the linkern binary to usr/local/bin and it ran without errors, I have a beautiful svg file that looks lovely in Inkscape, but can't see a decent way to get the paths to play nice in GIMP.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 7:36 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
I had to move the linkern program to Cygwin (had to install that too of course) too. Changed the paths as well accordingly. Linkern is possibly the issue, but, I believe it is also responsible for the digitizing step, but I could be wrong. Again, I'm no coder. I guess I could just run this program in Ubuntu myself and be done with it. lol

:)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 7:39 pm  (#7) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
Would save you a ton of problems, because support in Windows is limited. Funny thing is it rendered an svg of my pbm at 3200 x 800px, and it looks fine in Inkscape, but everything I have tried to extract the paths has failed. They won't combine, won't allow you to select them as a group, etc. Just nerve wracking to get so far and see something else turn into a lemon. Still trying to make lemonade!

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 7:48 pm  (#8) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
Here's the SVG as a bitmap.
Image

14523 stipples

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Last edited by mahvin on Thu Feb 10, 2011 9:21 pm, edited 1 time in total.

Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 8:23 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
OK Mahvin. I moved the linkern and concorde files to the right place (had to use command prompt to do since I couldn't use drag and drop). I now get this error in Ubuntu. Any ideas? Like your result by the way. :)


Attachments:
stillproblem.png
stillproblem.png [ 84.31 KiB | Viewed 6341 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 8:41 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
As a side note, I tried moving it into /user/local/bin too (both files) but similar error as above (made sure the paths matched in the python file too of course). :)

edit:

Just realize that the erro did change. Now I get permission denied. I wonder if linkern needs to be run in Wine or not? Well, too tired to go the another set of iterations right now in Ubuntu. Might try later. :)


Attachments:
pd.png
pd.png [ 108.32 KiB | Viewed 6330 times ]

_________________
Lyle

Psalm 109:8

Image


Last edited by lylejk on Thu Feb 10, 2011 9:02 pm, edited 1 time in total.
Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 9:02 pm  (#11) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
The binary or the whole folder? And can you open gedit and turn line numbers on and see what line 259 says. I check my own and they don't say the same thing as your Windows error did.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 9:08 pm  (#12) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
I put all my py files in the Concorde folder, cd to Concorde, copy a pbm to Concorde, and run the terminal command from there. And it works. Linkern binary is the only thing I moved to usr/local/bin.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 9:11 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
I'm only using the concorde and the linkern files. Did not install Concorde itself in Ubuntu. Haven't checked to see if I can (but betcha it's possible). I agree the gedit will show line numbers, but notepad won't in Windows. Haven't checked since you originally asked, but before doing all that, I guess I will have to install Concorde for Linux and give that a whirl. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 9:14 pm  (#14) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
I compiled Concorde in Ubuntu, no problems.

./configure

sudo make

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 9:22 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
You took the source and compiled? All I did was download the concorde.gzip and linkern.gzip files and moved them (lots of places now; lol). Now each is an executable but when I try to double-click on either I get (now I temporarily moved both files to my desktop in Ubuntu) this error. Maybe I'm going to have to download the source files and manual compile it myself in Linux (never done it for this program; did have to compile MAZE5 which used it's own special compiler and it was a pain). Or, maybe, I'll just stick with the convoluted flow that I've done so in Windows and be done with it (very tired now; caused my insomnia last night, but at least I finally got a result before hitting the sack; lol). Again, I appreciate your help Mahvin. Maybe that's why yours work and mine don't. The thread implied that all I had to do is download these two programs and all is well with the world. I know that isn't so though. lol

:)


Attachments:
ex_error.png
ex_error.png [ 16.25 KiB | Viewed 1711 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 9:27 pm  (#16) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
That's not what I was discovering when reading. For Windows, yes, you are correct, but not so for Linux. It recommended compiling Concorde. Get some sleep, attack tomorrow! :)

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Thu Feb 10, 2011 9:33 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
lol; you're right. Now if I run it in Windows these two files (in cygwin directory) it just gives parameters to follow. Compile Concorde; cost/benefit analysis time now. lol

:)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Fri Feb 11, 2011 4:04 am  (#18) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4037
Well, I finally figured out a good way to take the resulting SVG file (using G'MIC's morphological filter) and get a decent path off of it without using Inkscape.

I have yet to play with the file in Inkscape, btw. Something tells me you'd be able to make some interesting pictures using Inkscape's path effects.

Image

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Fri Feb 11, 2011 7:29 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
I can imagine you could. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: The Traveling Salesman problem.
PostPosted: Fri Feb 11, 2011 3:58 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
Excellent colorized version Mahvin. Figured out a few more tricks (still work) but got the result much smoother now (still using Potrace for the cleanup step). Figure I would include the TSP file too. Until I figure out how to create Organic Labrynths, I will create many more of these (but not necessarily post them here; you all probably are getting tired of them anyway; lol). :)

Attachment:
tsp_circle.png
tsp_circle.png [ 286.39 KiB | Viewed 1687 times ]


Attachments:
tsp_circle.zip [12.46 KiB]
Downloaded 110 times

_________________
Lyle

Psalm 109:8

Image
Top
Post new topic Reply to topic  [ 73 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) The Traveling Salesman revisited.

4



* Login  



Powered by phpBB3 © phpBB Group