edwinb-ai / BioMetaheuristics.jl

Implementation for nature and bio-inspired optimization algorithms in pure Julia.
https://edwinb-ai.github.io/BioMetaheuristics.jl/dev/
MIT License
2 stars 0 forks source link

RNGs should be passed by the user #40

Closed edwinb-ai closed 3 years ago

edwinb-ai commented 3 years ago

Right now, the API expects the user to pass a random seed and internally every implementation/solver instantiates its own AbstractRNG object. For instance, the SimulatedAnnealing implementation has the following code

    if isnothing(seed)
        rng = Xorshifts.Xorshift1024Star()
    else
        rng = Xorshifts.Xorshift1024Star(seed)
    end

and the PSO implementation has the exact same piece of code.

This, of course, is very bad practice. Instead, we should expect the user to pass their own AbstractRNG object which will give them the freedom to choose whichever RNG implementation the choose.