blob: 413b63b87a725e5005cc406ebd34704ec0153c24 [file] [log] [blame]
Yuheng Longf20cffa2013-06-03 18:46:00 -07001"""A generation of a set of tasks.
2
Yuheng Long49358b72013-07-10 14:45:29 -07003Part of the Chrome build flags optimization.
4
5This module contains the core algorithm of producing the next generation of
6execution.
Yuheng Longf20cffa2013-06-03 18:46:00 -07007"""
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]