diff --git a/alns/criteria/SimulatedAnnealing.py b/alns/criteria/SimulatedAnnealing.py index 95820fc1..72eb1ada 100644 --- a/alns/criteria/SimulatedAnnealing.py +++ b/alns/criteria/SimulatedAnnealing.py @@ -82,4 +82,11 @@ def accept(self, rnd, best, current, candidate): self.step, self.method)) - return probability >= rnd.random_sample() + # TODO the following is in preparation of the new numpy Generator + # interface, which deprecates random_sample() in favour of random(). + # ALNS does not yet formally support Generators, but unofficially it + # should work in most cases. + try: + return probability >= rnd.random() + except AttributeError: + return probability >= rnd.random_sample() diff --git a/setup.py b/setup.py index 16768d74..3ca4343d 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ MAJOR = 1 MINOR = 2 -MAINTENANCE = 4 +MAINTENANCE = 5 MODIFIER = "" VERSION = "{0}.{1}.{2}{3}".format(MAJOR, MINOR, MAINTENANCE, MODIFIER)