[pgrouting-users] tsp problem

Jaime Casanova jaime at 2ndquadrant.com
Tue Mar 22 16:09:48 EDT 2011


Hi,

I installed pgrouting with tsp on a centos 5 machine with postgres
8.4.5 and postgis 1.3.6.
When i tried to run this query:
"""
SELECT *
FROM tsp_astar_directed('view_viasnodo','38151,38151,35604,35586,20948,39935,35457,40636,40242,35485,19143,40079,40335,40058,19058',38147,12000,false,false);
"""

i get this message "ERROR:  relation "tsp_test" does not exist at
character 328" which is because the function tsp_astar_directed() in
routing_tsp_wrappers.sql has an UNION ALL that takes values from that
table... i workaround that problem creating a dummy tsp_test table...

but then when i try the same select i get "segmentation fault", this
is the backtrace:
"""
(gdb) bt
#0  0x00b02f7b in tsp_seed (pop=0x9430ee0, adam=0x9431090) at
/root/pgrouting-1.05/extra/tsp/src/tsp_solver.cpp:84
#1  0x00337b66 in gaul_population_fill (pop=0x9430ee0, num=88) at ga_core.c:823
#2  0x0034683f in ga_evolution (pop=0x9430ee0, max_generations=88) at
ga_optim.c:2415
#3  0x00b0315b in find_tsp_solution (num=22, dist=0xb04240,
p_ids=0xbfecb560, source=38147, fit=0xbfecb600, err_msg=0x0)
    at /root/pgrouting-1.05/extra/tsp/src/tsp_solver.cpp:296
#4  0x00b02b7c in solve_tsp (fcinfo=0xbfecb6c4) at
/root/pgrouting-1.05/extra/tsp/src/tsp.c:345
#5  tsp (fcinfo=0xbfecb6c4) at /root/pgrouting-1.05/extra/tsp/src/tsp.c:401
#6  0x08191002 in ExecMakeTableFunctionResult ()
#7  0x0819dbd4 in ?? ()
#8  0x081924bf in ExecScan ()
#9  0x0819db59 in ExecFunctionScan ()
#10 0x0818ad8f in ExecProcNode ()
#11 0x081888ab in standard_ExecutorRun ()
#12 0x0823917e in ?? ()
#13 0x08239f44 in PortalRunFetch ()
#14 0x081a56b0 in ?? ()
#15 0x00280253 in ?? () from /usr/lib/pgsql/plpgsql.so
#16 0x0027f1b1 in ?? () from /usr/lib/pgsql/plpgsql.so
#17 0x0027ecaf in ?? () from /usr/lib/pgsql/plpgsql.so
#18 0x002816ff in plpgsql_exec_function () from /usr/lib/pgsql/plpgsql.so
#19 0x00276028 in plpgsql_call_handler () from /usr/lib/pgsql/plpgsql.so
#20 0x08191002 in ExecMakeTableFunctionResult ()
#21 0x0819dbd4 in ?? ()
#22 0x08192584 in ExecScan ()
#23 0x0819db59 in ExecFunctionScan ()
#24 0x0818ad8f in ExecProcNode ()
#25 0x081888ab in standard_ExecutorRun ()
#26 0x0823917e in ?? ()
#27 0x0823a20b in PortalRun ()
#28 0x08235912 in ?? ()
#29 0x082367e1 in PostgresMain ()
#30 0x0820a0ea in ?? ()
#31 0x0820b112 in PostmasterMain ()
#32 0x081b5be0 in main ()
"""

which points at this:
"""
boolean tsp_seed(population *pop, entity *adam)
{
  int           i,s,tmp;
  int           *data;

  data = (int *)adam->chromosome[0];

  for (i=0; i<pop->len_chromosomes; i++)
  {
    data[i] = i;
  }

  for (i=0; i<pop->len_chromosomes; i++)
  {
    if(ids[data[i]] == source_id)
      s = i;
  }

  tmp = data[0];
  data[0] = data[s];      // this line is the one with the problem
  data[s] = tmp;

  return TRUE;
}
"""

any ideas?

-- 
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte y capacitación de PostgreSQL


More information about the Pgrouting-users mailing list