data (#23) - Creating Data for traveling salesperson problem (#227) - Message List

Creating Data for traveling salesperson problem

Hi,

I am new to postgis and pgrouting. I need steps to Create Data for TSP and routing from tiger shape database.

Thanks

  • Message #802

    You need the same data as you need for routing.

    1. First you have to compile pgRouting with TSP, create a database load all the functions you need (there are a couple of wiki pages about installation)
    2. Then you need to get your shape file data to PostgreSQL (shape2pgsql might be what you need for this)
    3. Next I recommend you to follow the workshop: WorkshopFOSS4G2007
    4. When you can get a shortest path, then TSP function should work as well.
    • Message #804

      Hi Daniel,

      Thank. I have gone through WorkshopFOSS4G2007. I did not find any field "COST" in victoria table.

      • Message #805

        In the workshop we take "length" as cost (so "cheapest" becomes "shortest"), because this data doesn't have much attributes.

        You have two options:

        1. Create a "cost" column column and update with some data (ie. length) or rename "length" to "costs, or
        2. Take "length" AS "cost":
        SELECT * FROM shortest_path('
        		SELECT gid as id,
        			 source::integer,
        			 target::integer,
        			 length::double precision AS cost
        			FROM victoria',
        		238, 1455, false, false);