[pgrouting-dev] helpful(?) from end function for the tsp routing code

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jul 8 05:49:29 PDT 2013


Dave,

Thank you for offering these functions to the community. I think that 
these might be very helpful alternatives to for accessing the TSP 
functionality.

I still need to get back to my sample code I posted as soon as I have a 
chance to see if I can figure out what is cause the weird results.

I would recommend that you create a gist at https://gist.github.com/

And post the link and a short description on the wiki at
https://github.com/pgRouting/pgrouting/wiki/Writing-functions

Thanks,
   -Steve

On 7/8/2013 5:45 AM, Dave Potts wrote:
> Dear List
>
> Currently the Travelling sales person code takes a 4+x4+ distance matrix
> of  distances between nodes in the range 0-x  and returns a list of node.
>
> The attached function takes a sql query in the form
>
> 'select source,target,cost from xxxxxx'
>
> where source and target can be any numerical values, the return is a
> list of the same node values.
>
> For example
>   id | source | target | cost
> ----+--------+--------+------
>    1 |      1 |      2 |   30
>    2 |      1 |      3 |   40
>    3 |      1 |     42 |   10
>    0 |      2 |      1 |   30
>    5 |      2 |      3 |   60
>    6 |      2 |     42 |   70
>    7 |      3 |      1 |   40
>    8 |      3 |      2 |   60
>    9 |      3 |     42 |   90
>   10 |     42 |      1 |   10
>   11 |     42 |      2 |   70
>   12 |     42 |      3 |   90
>
> select pgr_mktspret('select source,target,cost  from edge5',42);
>   pgr_mktspret
> --------------
>   (0,42)
>   (1,1)
>   (2,3)
>   (3,2)
> (4 rows)
> select pgr_mktspret('select source,target,cost  from edge5',3,2);
>   pgr_mktspret
> --------------
>   (0,3)
>   (1,1)
>   (2,42)
>   (3,2)
> (4 rows)
>
>
>
> Its based on some sql code that Steve posted several days ago.
>
>
>
>
> _______________________________________________
> 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