aboutsummaryrefslogtreecommitdiff
path: root/bestflags/generation.py
blob: 413b63b87a725e5005cc406ebd34704ec0153c24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""A generation of a set of tasks.

Part of the Chrome build flags optimization.

This module contains the core algorithm of producing the next generation of
execution.
"""

__author__ = 'yuhenglong@google.com (Yuheng Long)'


class Generation(object):
  """A generation of a framework run.

  This also contains the core implementation, reproducing new generations.
  """

  def __init__(self, pool):
    """Set up the tasks set of this generation.

    Args:
        pool: a set of tasks to be run
    """
    self._pool = pool

  def next(self):
    """Calculate the next generation.

    This is the core of the framework implementation.

    Returns:
      A new generation.
    """

  def pool(self):
    """Return the task set of this generation."""
    pass

  def improve(self):
    """True if this generation has improvement over its parent generation."""
    pass

  def get_best(self):
    """Get the best flagset."""
    return self._pool[0]