Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

A* SQL function returns paths of increasing length for consecutive, identical queries #7103

Closed
1 of 5 tasks
martineutinger opened this issue Jan 20, 2017 · 11 comments
Closed
1 of 5 tasks
Assignees
Labels
Milestone

Comments

@martineutinger
Copy link

martineutinger commented Jan 20, 2017

OrientDB Version, operating system, or hardware.

  • v2.2.14

Operating System

  • Linux
  • MacOSX
  • Windows
  • Other Unix
  • Other, name?

Expected behavior and actual behavior

When sending the same query (e.g. 'SELECT astar(#23:19965, #23:19187, 'length')') more than once, only the first result is correct. The consecutive results are longer and longer paths until it seems to either plateau or return no path at all.

So e.g. the shortest path contains 5 nodes.
The first query would return the 5 nodes. The second would return 10. Then 17. And then it returns 21 for every query past that point.

Steps to reproduce the problem

Possible solutions

The problem seems to be, that in com.orientechnologies.orient.graph.sql.functions.OSQLFunctionAstar
'PriorityQueue open' and 'Set closedSet' are carried over from the last execution of the algorithm.
It seems like ...
... either .clear() should be called for 'open' and 'closedSet' before each execution
... or a new instance of OSQLFunctionAstar should be created, every time the function is executed.

Misc

This is not the case with Dijkstra's algorithm, because a new instance of A* is created each time.

@saeedtabrizi
Copy link
Contributor

saeedtabrizi commented Jan 22, 2017

Hi @martineutinger , @luigidellaquila
yes i detect some bugs in the astar function too (null checking and etc ) . i check it asap .

@luigidellaquila
Copy link
Member

Thank you @saeedtabrizi, I'll check it as well

Thanks!

Luigi

@saeedtabrizi
Copy link
Contributor

Hi @martineutinger , @luigidellaquila
I fix some bugs (reported bug) and more test to astar function now . i will push it asap .

@luigidellaquila
Copy link
Member

Great, thank you very much @saeedtabrizi !

Looking forward to the pr!

Thanks

Luigi

saeedtabrizi added a commit to saeedtabrizi/orientdb that referenced this issue Jan 27, 2017
 -fix null checking in astar function .
 - add toCalendar method as we discussed on Better support for time expression orientechnologies#7081.
 - add some test cases for toCalendar Method . (need to be documented) .
@saeedtabrizi
Copy link
Contributor

@luigidellaquila the bugs fixed now .

@martineutinger
Copy link
Author

Thank you @saeedtabrizi.

So does that mean the single-astar-instance-per-server is by design?

@saeedtabrizi
Copy link
Contributor

Dear @martineutinger , Short answer is Yes in the current version . but i planned to add and implement some useful and more efficient path finding functions like the Block A* , Hybrid A* , CH , CRP for OrientDB asap .
As we know path-finding algorithms is so useful to Robotic , Intelligence Traffic Management, Routing for the smart vehicle systems and some similar applications.

screenshot from 2017-01-28 12-47-17

I'm glad if i hear from @lvca , @luigidellaquila and i create an issue for proposal path-finding .

@lvca
Copy link
Member

lvca commented Jan 28, 2017

+100!

luigidellaquila added a commit that referenced this issue Jan 31, 2017
@luigidellaquila
Copy link
Member

Hi @martineutinger

I just pushed a fix for this. Thank you very much @saeedtabrizi for the contribution!

Luigi

@saeedtabrizi
Copy link
Contributor

@luigidellaquila Thanks to solve the root of problem .

@santo-it santo-it added this to the 2.2.16 milestone Feb 1, 2017
@santo-it
Copy link

santo-it commented Feb 1, 2017

Noted in the Release Notes

saeedtabrizi added a commit to saeedtabrizi/orientdb that referenced this issue Aug 9, 2017
 -fix null checking in astar function .
 - add toCalendar method as we discussed on Better support for time expression orientechnologies#7081.
 - add some test cases for toCalendar Method . (need to be documented) .
saeedtabrizi added a commit to saeedtabrizi/orientdb that referenced this issue Aug 9, 2017
 -fix null checking in astar function .
 - add toCalendar method as we discussed on Better support for time expression orientechnologies#7081.
 - add some test cases for toCalendar Method . (need to be documented) .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants