vvim / routetool

Using Google Maps API to add locations and calculate the shortest route by Traveling Salesman Algorithm
1 stars 0 forks source link

Calculating optimal route goes b0rk b0rk #26

Open vvim opened 8 years ago

vvim commented 8 years ago

Sometimes, the optimal route is calculated, but shown incorrectly. Instead of following a perfect circle amongst 4 locations, it makes an X (resulting in a lot of unnecessary kilometers).

How to reproduce?

When you add the following locations:

Then you click on "Route tonen", then you click on "Route omdraaien".

If now you click on "Route optimaliseren", you get a very strange route.

It shows a route from 0 - 1 - 2 - 3 - 0: 2015-12-25--1451056538_1280x1024_scrot

While it should show a route from 0 - 1 - 3 - 2 - 0: 2015-12-25--1451056946_1280x1024_scrot

Please notice that the calculated "total distance" and "total time spent" is exactly the same for both screenshots, but the route shown (and the order in the QListWidget) is clearly different. Also, if we would compile a transportationlist, the lists of both instances will be different in the order of locations visited, but the total distance / time will be the same, also for stops in between (which is impossible).

The distance between 1 - 2 is much larger than between 1 - 3.

Possibility

Something goes wrong with the calculation of the distance matrix, with assigning the right markers to the correct rows of those matrices. Or maybe with reordering the markers in memory?

vvim commented 8 years ago

the transportation lists

transportation-lists-b0rkb0rk.zip

vvim commented 8 years ago

Tweede Voorbeeld

Also happens with the combination:

This order is the optimal order but Waldico and Biehal keep switching by clicking "Calculate Optimal Route" (and the difference is enormous, from 317 km / 4u55 to 436 km / 6u10

vvim commented 8 years ago

possible solution: always recalculate distance matrices, but it will give much more traffic to the Google Maps API

( matrices_up_to_date = false always)

vvim commented 8 years ago

Derde Voorbeeld

Also happens with the combination:

This order seems to be correct, but with clicking "Calculate Optimal Route" the locations 'tintelijn' and 'defosset' change place every click, although the difference in distance/time is not mentioned, there is a difference of 2 minutes.

When I first delete the Address, and then the Levering, and then click on "Calculate Optimal Route", the program crashes

[ void Form::process_result_distancematrix(QList<int>*) ] "Vlaspit" 0 
[ void Form::process_result_distancematrix(QList<int>*) ] "Tintelijn" 2 
ASSERT failure in QList<T>::at: "index out of range", file ../../QtSDK/Desktop/Qt/473/gcc/include/QtCore/qlist.h, line 456
The program has unexpectedly finished.