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