Evaluator.py 734 B

123456789101112131415161718192021222324252627282930
  1. """Abstract Evaluator class
  2. """
  3. # main imports
  4. from abc import abstractmethod
  5. class Evaluator():
  6. """Abstract Operator class which enables to update solution applying operator (computation)
  7. """
  8. @abstractmethod
  9. def __init__(self):
  10. pass
  11. @abstractmethod
  12. def apply(self, solution):
  13. """Apply the computation of fitness from solution
  14. Args:
  15. solution: {Solution} -- Solution instance
  16. """
  17. pass
  18. def setAlgo(self, algo):
  19. """Keep into operator reference of the whole algorithm
  20. The reason is to better manage operator instance
  21. Args:
  22. algo: {Algorithm} -- the algorithm reference runned
  23. """
  24. self._algo = algo