RandomPolicy.py 378 B

1234567891011121314151617
  1. # main imports
  2. import random
  3. # module imports
  4. from .Policy import Policy
  5. class RandomPolicy(Policy):
  6. def apply(self, solution):
  7. # TODO : implement for mutator (need two parameters)
  8. # choose updator randomly
  9. index = random.randint(0, len(self.updators) - 1)
  10. updator = self.updators[index]
  11. return solution.apply(updator)