One of the things that makes the Traveling Salesman Problem challenging is that it sometimes defies your intuition of what properties a solution should have. Here is a demonstration of a radially symmetric set of cities which has a solution tour which is anything but radially symmetric. To give away the game up front, the issue is that with an odd number of polyspiral arms, the tour cannot just follow adjacent arms out and back in as pairs to achieve a shortest length tour in a symmetric pattern.
Here, Traveller 1.21 with KPD mods, in an as yet unreleased developmental version after release epsilon, is working on solving a nine armed polyspiral with 81 total points in the tour, a very modest sized problem for Traveller, though it has a brute force solution time at 500 megaflops of 1.2858 * 10^105 years, one hundred thousand times longer than the universe is expected to take to have evaporated its last proton.
This is one of the city layouts I designed specifically to give Traveller ulcers, so I'd have to work harder myself to make the code much more capable in general, to solve even these hard cases without heuristics designed to cater to those cases specifically.
A popular approximate solver for the Symmetric Euclidian Traveling Salesman Problem, the simplest subspecies of the TSP, the one with which Traveller deals, is the Elastic Net. Here, Traveller's Elastic Net, adapted from code published by Alexander Budnik, is used as a seeder (one of several Traveller employs individually or in a mix), to produce excellent quality initial genomes to speed Traveller's search for an optimum solution.
Here we'll follow the action in a table of screenshots(*).
|
Elastic Net uses a set of waypoints, three times as many in number as the cities in the problem setup, and some sophisticated mathematics to attract them in a tour-length conserving manner toward the city locations. To start, the waypoints are arranged in a small circle centered in the playfield. This isn't quite that circle, this is an already-growing version that was the earliest one I could capture in real time without putting a starting pause in the code. |
|
A few tens of fast iterations later, the circle has grown, and is beginning to display the corners of a nonagon. Those corners will quickly become pseudopods. |
|
Now the elastic net is starting to approximate grossly the pattern of the tour cities, though it hasn't "noticed" yet that the spiral arms twist to the left. |
|
Weighting factors in the algorithm for cities with no waypoints near them, at this point strongly draw the net toward the extreme points, which have become very attractive, both at the center and at the outside. The arms of the elastic net "flower" are starting to distort to follow the leftward twists of the polyspiral arms. |
|
The arms of the elastic net fatten to try to approximate the cities in both adjacent arms of the polyspiral. At this point a weakness of Elastic Net becomes apparent; waypoints quarrel over ownership of cities sometimes. |
|
Here, less some succeeding tiny adjustments nearly invisible on the screen, is the elastic net's best approximate alignment of waypoints to cities in a "shortest" tour. |
|
Here is the genome seed, symmetric, pretty, and seductive, which corresponds to the elastic net's approximation above, gotten by matching each city with its closest waypoint, and then putting the cities into a genome in the order of the corresponding matched waypoints around their elastic net. |
|
And here, the point of this essay, is the completely different, and unsymmetric, final optimal tour for this polyspiral city layout. [Traveller solved this, in this instance, in 821 seconds, on a two gigahertz large-memory laptop. Solution times are of course very dependent on the mix of Traveller seeders, metaheuristics, heuristics, and control values selected by the user, besides the capacities of the underlying hardware.] |
If there are lessons to be learned from this, these will do:
[With some luck, my computer won't be stolen with the only current copy of my software efforts, again, or me be thrown in jail for being homeless, again, before I can finish reconstructing the lost parts of the next Traveller release, clean up the documentation, and get it all up on the Web. I comfort myself that even Galileo had problems getting his research published, and I'm certainly not a genius like Galileo, otherwise I'd try for a MacArthur grant, except I'm about twice too old, also.]
Cheers,
xanthian
2002/09/02 23:17
[Oh, and in my never ending quest to be more politically correct than thou, try viewing this page with images turned off. Creating what you see that way was a lot of extra work and I'd like the effort to be appreciated [and imitated among you web developers] by the 99.9 percent of the population to whom it is usually invisible and not considered.]
Please excuse Microsoft's typically buggy software in WinXP, which fails to capture the entire window frame when taking a snapshot of an individual window.
[Actually, if you look closely, the missing right edges of the frames are there, pasted to the left edges of the frames. Bleah. It is utterly typical of Microsoft to release a software beta version as a commercial product.]
I didn't have the patience to fix this Microsoft-ware bogosity by capturing the whole screen for each shot and cropping out the window images one by one. This document began life as a throw-away web page, but any effort done into the teeth of Microsoft's utter disdain for quality will always take longer than you can possibly anticipate, even taking this warning into account in advance.
[The artifacts of the decorative red border inside the frame are mine. I haven't figured out yet how Java lets me make sure a panel repaints itself entirely during an expose event, so only the black canvas is being updated in a timely manner.]
Viewed full sized, several of these images show missing or broken lines in that viewer, which sent me into a panicked scurry gathering tools to "fix" them. The lines aren't broken, the Microsoft *.png viewing capability is. Viewed with competently written software (e.g., freeware The Gimp) the lines are seen to be intact.
When this web page is viewed in that browser with pictures turned off, with the alternate text wordwrapped in the web page source onto several lines between the opening and closing double quote for ease of maintenance, the box displaying the alternate text for the last picture crops that text long, complicated descriptive text in the vertical center of a line [counts as two bugs, one for not displaying the whole text, the other for cropping text in mid-glyph, something characterized as unsatisfactory at least as early as 1977 in SIGGRAPH publications and 1979 in ANSI X3H3 publications.]
[Yes, I've heard of "longdesc" (or whatever) in HTML 4.01, that doesn't excuse this mess, since "longdesc" is still too poorly documented to use.]
When the mouse button is hovered over that alternate text, a large popup bubble attempts to display the text.
When the mouse cursor is instead hovered over the default image icon, the text stops flashing many times a second, and instead shows up, displays steadily, but disappears after a second or two, far insufficient time to read the contents. The word wrapping is equally flawed in this case.
[Joining the alternative text into one long, unmaintainable quoted string (of the kind made infamous in browser "see page source" windows) for each image fixed the word wrap formatting problems and the flashing bubbles, but not the early cutoff of the large alternative text, nor the briefness of the popup duration. This shouldn't have been necessary, HTML source text is supposed to be free format with regards to whitespace, newlines being interchangable with spaces, except inside a <pre> tag, and the flashing was unforgivable with any input format for the alternative text.]
The browser does not respect the HTML 4.01 alphabetic entity spellings for left and right single and double quotes, so you get the ugly ones instead of the graceful ones, since I don't remember the hexadecimal versions, and from offline, can't look them up.
Time sharing performance between compute bound applications and finger speed interactive applications is deeply flawed, to the point that I had to convert Traveller to the Macintosh model of cooperative multitasking, with explicit wait() executions hundreds of times a second, to be able to type text in an editor window at all to compose this web page while Traveller ran.
Replacing the Blue Screen of Death with a black one with popcorn visual surprises and static sound effects is no improvement. XP still crashes to the bare metal when assaulted by mere user software. Luckily, the extremely competently written (thanks, Bram) vim() editor keeps a keystroke-by-keystroke journal file, so all I lost was time, not typing. [Vim() is recommended to everyone sick of losing work to MS-Word when Windows crashes. You don't really need word processed text for 99.9% of text uses anyway, so using an overly complicated, fragile fritterware tool like MS-Word is a waste of your time. When you need pre-press production quality text layout, learn how to write open-standard HTML [It's easy, really, and the results can be shared by passing around one line URLs instead of multi-megabyte porkware documents that drag your corporate email system to its knees!] in a robust charity-ware text editor instead, and print your fancily formatted hardcopy from that.] At least the snotty "you forgot to shut down Windows properly" message is gone. The premier entity shutting down Windows improperly is still Windows, as ever. Maybe Bill Gates is learning humility?
[Of course, having Windows instead whine to me about not instantly letting it submit bug reports from my thoroughly offline homeless person's computer is still mind-bogglingly stupid and insulting.]
[That is exceeded, though, in sheer gall, by the initial computer startup message that if I, homeless, phoneless, connectionless, and too indigent for long distance toll charges, don't contact Microsoft online or by (pay-)phone next to my running computer where I can enter the indicated passwords, within a month to get a code to keep my operating system working, it will shut itself down on the presumption that I stole the software. Somehow this presumption that the purchaser is by default a thief failed to be mentioned in the product ads, service contract, or on the outside of the box. I can hardly wait to have it proved to me that only rich people are allowed to run WinXP for more than a month despite having bought and paid for it, for lack of a Redmond-approved set of life circumstances that allow timely contact with Microsoft. An intelligent alternative overlooked by Microsoft would have been to have the hardware vendor who first purchased and installed the OS software pursue this certification and install the password needed, as a normal part of doing business, not the end user customer to whom doing so might be effectively impossible, and who in any case has no obligation to be burdened with efforts to prove that the hardware vendor who installed it came by the software honestly, nor way of assuring in advance of purchase, or indeed at all, that this is so.]
| Foolhardily of me, perhaps, to post this, but being so poor there is nothing of value for which I can be sued by Microsoft's pantheon of truth-suppressing lawyers, I figure that publicizing repeatedly, truthfully, and reproducably the problems Microsoft's uniformly horrible software quality causes me as a customer or user [and has, without a single exception, in the many, many products in their line, operating systems, compilers, management tools, word processing tools, databases, spreadsheets, server software, browsers, and data presentation tools, among others, which various employment has compelled me to use since 1983] will be a practice imitated by others, and in the mass will eventually warn the computer naïve [most of software purchasing management, for example, the human equivalent of lemmings: "If everyone else ran off a cliff, would you run off it too, knowing 'there is safety in numbers'?" "No?" "If everyone else bought horrible quality software from a monopolist, would you buy it too, knowing 'there is safety in numbers'?" "Yes?" "Can you explain the difference, since your ability to be productive lies smashed to the bottom in either case?"] to seek operating systems and other software tools from more reliable, reputable, ethical commercial or freeware community sources. |
[Ah, a perfect example of world-famous "Kentish grammar" to wrap up this rant.]
[Back to the brag.]
Interested in hiring Unix software development talent, and willing to endure someone not afraid to tell you when you're about to run off a cliff, and with the experience to back it up?