Marchowes / pyProm

Surface Network Analyzer.
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Basin Saddle Discovery -- poor performance. #127

Closed Marchowes closed 5 years ago

Marchowes commented 5 years ago

Basin Saddle Discovery for 0.6.0 is providing accurate results, but it takes hours to calculate because it searches the entire tree from every points perspective.

Possible new solution: Max recursion depth -- risky as it could sour results. ????? Optimizations? maybe the current model is poorly optimized and could use a little help?

Maybe add a feature that accurately exempts points we know are non basin saddles? something like: loop detection finds circuit, identifies basin saddle, takes all other points found in circuit and exempts them from further analysis. ?risky? -- worth testing at least. Analysis may still take a while, but should be shortened considerably. its the points that we know are non basin saddles that take so long to analyze because the entire tree needs to be searched.

Marchowes commented 5 years ago

My first run on a 1deg x 1 deg map took 16 hours -- well, thats no good. I was able to optimize several components and knock it down to 5 hours. Still unacceptable.

The solution to keep my current algorithm, and make it faster is to front load the remote linker checks, which take up 95% of the runtime (or more).

now, create dict {saddle.id : {"leg1": [linker1, linker2, linker3], "leg2":[linker1, linker2...]}} and read form that instead of calculating every time.

Marchowes commented 5 years ago

I've found a library "networkx" which can do what I need -- almost.

There is a weird problem tho with multiple conjoined cycles that requires me to re-run the whole cycle detection algorithm until no exceptions are found. This is a bit of a problem.

So, as a solution lets do the following:

if we find a loop disqualifier match exception we need to do the following.

1) when cycle detection is first run, we need to build an index of {saddle.id:[cycleidx_1, cycleidx_2, ....] 2) when we find an exception, we need to add the discovered cycle, as well as every single loop which contains that disqualified point. To a queue of points. 3) once the first round of analysis is done, take those points, and build a whole new Graph from scratch and run cycle_basis on that entire set. 4) rinse, repeat

what about a concept of disqualification candidates when 2 basins are of equal height?