generation.py revision 49358b75c25a44760e884245440dc96e55812d04
1"""A generation of a set of tasks. 2 3Part of the Chrome build flags optimization. 4 5This module contains the core algorithm of producing the next generation of 6execution. 7""" 8 9__author__ = 'yuhenglong@google.com (Yuheng Long)' 10 11 12class Generation(object): 13 """A generation of a framework run. 14 15 This also contains the core implementation, reproducing new generations. 16 """ 17 18 def __init__(self, pool): 19 """Set up the tasks set of this generation. 20 21 Args: 22 pool: a set of tasks to be run 23 """ 24 self._pool = pool 25 26 def next(self): 27 """Calculate the next generation. 28 29 This is the core of the framework implementation. 30 31 Returns: 32 A new generation. 33 """ 34 35 def pool(self): 36 """Return the task set of this generation.""" 37 pass 38 39 def improve(self): 40 """True if this generation has improvement over its parent generation.""" 41 pass 42 43 def get_best(self): 44 """Get the best flagset.""" 45 return self._pool[0] 46