Skip to content

Path evaluation on C++ not updated before the results go back to C #1616

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
cvvergara opened this issue Oct 3, 2020 · 1 comment · Fixed by #1618, #1635 or #1645
Closed

Path evaluation on C++ not updated before the results go back to C #1616

cvvergara opened this issue Oct 3, 2020 · 1 comment · Fixed by #1618, #1635 or #1645
Milestone

Comments

@cvvergara
Copy link
Member

Describe the bug
While developing I found that there is a small bug on the Path class, and the total cost is not updated properly
As far as I can see affects some functions:

  • bellman_ford_driver.cpp
  • dijkstra_driver.cpp
  • pgr_ksp.hpp

To Reproduce
Very difficult to reproduce, but from this test execution:

"SELECT  seq, path_seq, node, edge, cost, agg_cost FROM pgr_turnrestrictedpath($$SELECT id, source, target, cost, reverse_cost FROM edge_table$$, $$SELECT * FROM new_restrictions WHERE id > 10$$, 12, 13, 3, false)"
#     Extra records:
#         (2,2,11,12,1.144,1.1689999999999998)
#     Missing records:
#         (2,2,11,12,1.144,1.169)

(2,2,11,12,1.144,1.169) ss expected as result of dijkstra
But this is obtained: (2,2,11,12,1.144,1.1689999999999998)
and 1.169 compared with 1689999999999998 is "almost" the same value so there is floating point arithmetic issue.

Expected behavior

"SELECT  seq, path_seq, node, edge, cost, agg_cost FROM pgr_turnrestrictedpath($$SELECT id, source, target, cost, reverse_cost FROM edge_table$$, $$SELECT * FROM new_restrictions WHERE id > 10$$, 12, 13, 3, false)"
#     Extra records:
#         (2,2,11,12,1.144,1.169)
#     Missing records:
#         (2,2,11,12,1.144,1.169)

To get the expected results

Sample Data
Using the sample data of the documentation

Specifications (please complete the following information):
Fix & release:

  • 3.0.3 version
  • 3.1.1 version
    and fix:
  • 3.2.0-dev
@cvvergara cvvergara added this to the Release 3.1.1 milestone Oct 3, 2020
@dkastl
Copy link
Member

dkastl commented Oct 3, 2020

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
2 participants