Ticket #23 (assigned feature request)

Opened 3 years ago

Last modified 2 years ago

tsp abnormal source_id and ids case

Reported by: nagase Owned by: anton
Priority: major Milestone: Version 1.2
Component: TSP Version:
Keywords: error handling Cc:

Description

I did test pgRouting tsp function for the project(because routing web service, various input expected), but some critical bug occurred, so please check the cases as follows.

[Environment]
OS:CentOS 4.4
PostgreSQL:8.1.4
pgRouting:1.0.0b (with cgal & gaul)

[Data]
kanagawa(from  http://files.orkney.jp/pgrouting/sample/pgRouting-sampleapp.tar.bz)

[Test Case] *over 188000 id means not exist in database.
1. normal

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (125513,7731,17838,76309,124369)', '125513,7731,17838,76309,124369', '125513');
=> 5(1 row)

2. abnormal(ids count is 3)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (125513,7731,17838)', '125513,7731,17838', '125513');
=> server closed the connection unexpectedly...

3. abnormal(ids count is 2)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (125513,7731)', '125513,7731', '125513');
=> CPU 100% (It seems that infinite loop occurred)

4. abnormal(ids count is 1)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (125513)', '125513', '125513');
=> CPU 100% (It seems that infinite loop occurred)

5. abnormal(all source_id is the same)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (7731,7731,7731,7731,7731)', '7731,7731,7731,7731,7731', '7731');
=> CPU 100% (It seems that infinite loop occurred)

6. abnormal(not exist source_id)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (188000,7731,17838,76309,124369)', '188000,7731,17838,76309,124369', '188000');
=> server closed the connection unexpectedly...

7. abnormal(include not exist source in ids)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (7731,17838,76309,124369,188000)', '7731,17838,76309,124369,188000', '7731');
=> 4(1 row)

8. abnormal(include not exist source in ids)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (7731,17838,76309,188001,188000)', '7731,17838,76309,188001,188000', '7731');
=> server closed the connection unexpectedly...

9. abnormal(include not exist source in ids)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (7731,17838,188002,188001,188000)', '7731,17838,188002,188001,188000', '7731');
=> CPU 100% (It seems that infinite loop occurred)

10. abnormal(include not exist source in ids)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (7731,188003,188002,188001,188000)', '7731,188003,188002,188001,188000', '7731');
=> CPU 100% (It seems that infinite loop occurred)

11. abnormal(all source in ids and source_id not exist)

SELECT COUNT(*) FROM tsp('SELECT DISTINCT source::integer AS source_id, x1::double precision AS x, y1::double precision AS y FROM kanagawa WHERE source IN (188000,188001,188002,188003,188004)', '188000,188001,188002,188003,188004', '188000');
=> server closed the connection unexpectedly...

Change History

Changed 3 years ago by anton

  • owner changed from somebody to anton
  • status changed from new to assigned
  • version 1.0.0b deleted

Changed 3 years ago by anton

  • type changed from bug report to feature request

It is a good idea to return error codes. It should be done not only for TSP, but for other functions also.

Changed 3 years ago by DuyTan

It is a good idea.TSP funtions is not run if ids <= 3. In other cases, input data is wrong with TSP algorithm

Changed 3 years ago by anton

  • milestone changed from Version 1.0 to Version 1.1

Moved to 1.1

Changed 3 years ago by anton

  • milestone changed from Version 1.1 to Version 1.2

Changed 2 years ago by sunrise

This works ok for me.. but It probably needs feedback. postlbs Air Jordan
Note: See TracTickets for help on using tickets.