tekgrrl / coding_problems

0 stars 0 forks source link

Order of magnitude changes to RNG seed sizes lead to exponential increases in execution time for creating distance matrices #2

Closed tekgrrl closed 5 months ago

tekgrrl commented 5 months ago

We have the ability to test with different city distance matrices by adjusting the seed value. I found that if I used the often used default of 12345 the matrix generation took forever (almost literally). Testing showed that the time for generation increased exponentially as I increased the seed value by orders of magnitude (1, 10, 100, 1000, ...)

tekgrrl commented 5 months ago

The way I was using default and optional constructor parameters led to the RNG value being used for the strata_size value and as that is effectively squared in the code it led to an exponential increase in calls to calculate_average_neighbor_density().

After fixing the issue it uncovered issue #3 as the genetic algorithm works better with larger values of strata_size

tekgrrl commented 5 months ago

fixed by d670c90