Skip Menu |

This queue is for tickets about the Map-Tube CPAN distribution.

Report information
The Basics
Id: 103103
Status: resolved
Priority: 0/
Queue: Map-Tube

People
Owner: MANWAR [...] cpan.org
Requestors: GWS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.94
Fixed in: 2.95



Subject: Map::Tube::Route::preferred() may produce counter-intuitive results
When using the above-mentioned method on Map::Tube::KoelnBonn to find the preferred route between, say, Juridicum and Vilich, it seems that one has to change lines three times, when in fact there is a single line (running through the same stations, so same path length) connecting the two. The result is: --- Juridicum (16), Universität / Markt (16), Bonn Hbf (16), Stadthaus (61), Bertha-von-Suttner-Platz / Beethovenhaus (62), Konrad-Adenauer-Platz (62), Adelheidisstr. (66), Vilich (66) --- In fact, line 66 runs through from Juridicum to Vilich through exactly the same stations. So, while the result is a correct route, it would probably not be called "preferred" due to the number of unnessessary changes. The problem is that in case of multiple lines, the current algorithm picks one line per link at random (the one that happens to be first in the array of common lines of the two neighbouring stations involved). This is repeated for every pair of adjacent stations. This purely local choice of lines leads to the sub-optimal end result. I think the algorithm should try harder to pick a "good" line. Picking an optimal one may actually be computationally hard (NP?), but it should be feasible to pick a route that has as long runs as possible without line change. (I could provide some ideas on this if desired.)
Hi Gisbert, Thanks for reporting the bug. I knew it wasn't perfect solution and bound to fail. However I couldn't resist myself. Now I have to dig deep to find a solution ;-) This time I will try to get it done properly. Suggestions are always welcome ;-) Best Regards, Mohammad S Anwar
Hi Gisbert, I have pushed a solution for the issue you raised as below: https://github.com/Manwar/Map-Tube/commit/a3f909f9e776a98fb07ef03cd410c1a6299e1730 Please have a look. Many Thanks. Best Regards, Mohammad S Anwar
Subject: AW: [rt.cpan.org #103103] Map::Tube::Route::preferred() may produce counter-intuitive results
Date: Fri, 27 Mar 2015 00:11:13 +0000
To: "bug-Map-Tube [...] rt.cpan.org" <bug-Map-Tube [...] rt.cpan.org>
From: "Selke, Gisbert W." <gisbert.selke [...] wido.bv.aok.de>
Hi Mohammad -- I checked your solution in 2.95 with my KoelnBonn test case, works perfectly! The difference in result with respect to my attempt is minimal, viz., I output only one tube line between any two stations, like your 2.94 did; you show all the possibilities with minimal need for changing. This is a more complete picture. (Would have been trivial to do that in my attempt, too -- the underlying structure is the same!) Problem solved! \Gisbert Show quoted text
> -----Ursprüngliche Nachricht----- > Von: Mohammad Sajid Anwar via RT [mailto:bug-Map-Tube@rt.cpan.org] > Gesendet: Donnerstag, 26. März 2015 12:19 > An: GWS@cpan.org > Betreff: [rt.cpan.org #103103] Map::Tube::Route::preferred() may produce > counter-intuitive results > > <URL: https://rt.cpan.org/Ticket/Display.html?id=103103 > > > Hi Gisbert, > > I have pushed a solution for the issue you raised as below: > > https://github.com/Manwar/Map- > Tube/commit/a3f909f9e776a98fb07ef03cd410c1a6299e1730 > > Please have a look. > > Many Thanks. > > Best Regards, > Mohammad S Anwar
Closing it now :-)