graph icon indicating copy to clipboard operation
graph copied to clipboard

cycle_ratio_example.cpp is non-deterministic and sometime fails

Open jzmaddock opened this issue 6 years ago • 0 comments

We're running cycle_ratio_example.cpp in the tests, but it uses a non-deterministic random number generator which very occasionally results in the assertions failing. It's not clear if this is inevitable, or is showing up a deeper bug of some sort.

Observed failure is:

Vertices number: 1000
Edges number: 30000
Maximum cycle ratio is 9.32637
Minimum cycle ratio is -0.45058
Critical cycle:
(354,386) (386,354) 
cycle_ratio_example: libs/graph/example/cycle_ratio_example.cpp:83: int main(int, char**): Assertion `std::abs(cr.first / cr.second - min_cr) < epsilon * 2' failed.
Aborted (core dumped)

Actually looking at the result, I suspect we just need to up the error tolerance slightly - 2 epsilon might be a bit hopeful?

jzmaddock avatar Aug 29 '19 09:08 jzmaddock