Tuesday 20 December 2016

postgis - 1-center and k-center problem / maxmin facility problem in Post


is there anybody who has already solved the 1- and k-center problem within PostGIS (optionally with distance metric obtained by pgrouting)?


References:




What I did so far for the 1-center problem (I found a similar solution elsewhere) :


// Generate min. cost table for all pairs
INSERT into catchments
SELECT
seq, id1 as source, id2 as target, cost
FROM
pgr_apspWarshall('
SELECT id, source, target, cost
FROM network WHERE city = ''New York''', false, false);


// Select max(min(distance))
SELECT source, max(cost) as maxcost
FROM catchments
WHERE cost <= 10 **km** GROUP BY source ORDER BY maxcost ASC;

However, the second step misses the initial choice.


EDIT: Someone has already asked a question about OSS and location allocation which is a nearby topic. However, in the tools listed (Grass v.net.alloc)the functionality divides an area into districts based on predefined hubs/facilities/stations. To emphasize, I current question is about ab-initio optimization without previous definitions of location.


EDIT2: the Floyd-Warshall algorithm returns only the path information which has not previously been calculated- that is called dynamic programming in this sense. Well, now the question remains how to reestablish the full information to run the 1-center problem?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...