[pgrouting-dev] Problems with TSP
Stephen Woodbridge
woodbri at swoodbridge.com
Mon Jun 24 14:30:02 PDT 2013
On 6/23/2013 5:19 AM, Dave Potts wrote:
> Just looked at the write up for the tsp, ok the answer will be in the
> range 0-(X-1) where X is the number of points provided, the returned
> index starts of at zero in set as one as found in postgres arrays. But
> I do not understand the remark id, 'index into the matrix' the matrix
> is a two dimension so I I don't understand how the index is desgined to
> work!
Since the the matrix is symmetric NxN, index refers to a row or column,
so the resultant path would be for you first example below would be:
0,2: 20
1,3: 2
2,1: 90
3,0: 42
or a path from 2 -> 3 -> 1 -> 0 for a cost of (20+2+90+42) = 154
> On 23/06/13 10:04, Dave Potts wrote:
>> I having some problems with the tsp
>>
>> I have a matrix {{0,31,22,42},{31,0,90,2},{22,90,0,27},{42,2,27,0}},
>> starting at node 2, I get the answer
>> seq | id
>> -----+----
>> 0 | 2
>> 1 | 3
>> 2 | 1
>> 3 | 0
>> (4 rows)
>> using the matrix
So as you figured out, 4 is invalid, and probably should throw an error
(write a ticket for this) as the nodes are 0-3.
-Steve
>> {{0,22,42,31},{22,0,27,90},{42,27,0,2},{31,90,2,0}} starting at node
>> 4 I get the answer
>> seq | id
>> -----+----
>> 0 | 0
>> 1 | 1
>> 2 | 2
>> 3 | 3
>> The matrix is topological identicial, I start off at the same
>> topological node, so I was expecting the same answer, also I was
>> expecting all nodes to be in the result set ie nodes 1,2,3 and 4, for
>> some strange reason I get 0.
>>
>> Is there some mistake in my data?
>>
>> regards
>>
>>
>> Dave.
>>
>>
>>
>>
>>
>> _______________________________________________
>> pgrouting-dev mailing list
>> pgrouting-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/pgrouting-dev
>
>
>
> _______________________________________________
> pgrouting-dev mailing list
> pgrouting-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-dev
>
More information about the pgrouting-dev
mailing list