Jugendhackt / paketmagie

Magische Pakete, 100% biologisch und gentechnikfrei geroutet
http://hackdash.org/projects/557bf10f3f8689f158e0f371
GNU General Public License v3.0
4 stars 0 forks source link

Implementing an A* for giving only relevant nodes to the haskell part #16

Open fkarg opened 9 years ago

fkarg commented 9 years ago

The general idea was to unload the haskell part in case of bigger datasets, so the python part would make a A* search over the whole dataset and return all the nodes of the n best ways (the best way and all ways with a distance tolerance of at least 10% to 50% ). this should make it a lot faster, but for the sake of speed we might not actully find the possibly shortest (time) and most probable way that way, but it's pretty unlikely

sternenseemann commented 9 years ago

I think this would lead to incorrect behaviour. Also this optimization is splitting the algorithm into two parts. Optimizations should be only done in the Haskell code!

fkarg commented 9 years ago

okay then do it this way, but then it's only really possible with the database included, since otherwise we might have to parse huge JSON files at some point ...

sternenseemann commented 9 years ago

We'll deal with it at that point.

froozen commented 9 years ago

I talked to @shak-mar today, and he had the great idea of implementing the algorithm as a pathfinding algorithm in a three-dimensional space, the third dimension being the changing probabilities.

I'll probably look into that after some sleep and maybe rewrite the algorithm to check how the both of them perform under high load (many, many nodes).

sternenseemann commented 9 years ago

Making it 3d seems to be a good idea.

Am 16.06.2015 um 15:49 schrieb froozen notifications@github.com:

I talked to @shak-mar today, and he had the great idea of implementing the algorithm as a pathfinding algorithm in a three-dimensional space, the third dimension being the changing probabilities.

I'll probably look into that after some sleep and maybe rewrite the algorithm to check how the both of them perform under high load (many, many nodes).

— Reply to this email directly or view it on GitHub.

froozen commented 9 years ago

Yup. It'll also be a nice chance for me to learn a bit about the different pathfinding algorithms. :)

fkarg commented 9 years ago

This might actually work, if you're seeing it as an 3D - tree, you might actully be able to do it with an only slightly modified A* in the end, as it should be totally fitting for it

froozen commented 9 years ago

I've been thinking about how to approach this new algorithm for a while now, and I've come to the conclusion that we won't get an algorithm that is more efficient than our current one by using a 3D-tree.

The construction of that tree would do exactly the same thing as we are doing with our algorithm right now and running another algorithm, like the A*, over it would only add extra costs. The way we're handling probabilities right now is cutting us off from any more efficient algorithms. There are two ways for us to handle that fact:

nkoehring commented 9 years ago

Good that you decided to not split the path finding out into the python part. It would be super slow compared to haskell.

froozen commented 9 years ago

Agreed, though the choice was made mainly for comfort reasons as writing a recursive algorithm in haskell is a lot easier.

fkarg commented 9 years ago

I think you might have the wrong idea as to what a A* is or how to implement it some efficient way @froozen . Either way, I'd come to the lab at Wednesday, I hope to see you there, I'd explain as to how I meant it. And it might be good for what we are going to do next and all. Ah, and don't forget the book ;)

froozen commented 9 years ago

I think it might be useful to state what we decided on when we met, so I'll try just that. Please correct me if I'm wrong.

I'm not quite sure how realistic the last idea is, but we'll just have to see.

sternenseemann commented 9 years ago

Haskell load in background also know as laziness

froozen commented 9 years ago

Lazyness isn't in the background, though. Letting lazyness hadle it means doing all the DB lookups in the main thread and hence not getting the speedup we were hoping to achieve by doing it in the first place.

Another problem with it would be, that the whole algorithm would take place in the IO monad, which isn't really good style.

froozen commented 9 years ago

I just came across exactly what we need: haxl It basically handles the efficient loading of data in the background of pure algorithms.

sternenseemann commented 9 years ago

Intredasting.