is there anybody who has already solved the 1- and k-center problem within PostGIS (optionally with distance metric obtained by pgrouting)?
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?