Yuheng Long | f20cffa | 2013-06-03 18:46:00 -0700 | [diff] [blame] | 1 | """A reproducing entity. |
| 2 | |
Yuheng Long | 49358b7 | 2013-07-10 14:45:29 -0700 | [diff] [blame^] | 3 | Part of the Chrome build flags optimization. |
| 4 | |
Yuheng Long | f20cffa | 2013-06-03 18:46:00 -0700 | [diff] [blame] | 5 | The Task class is used by different modules. Each module fills in the |
| 6 | corresponding information into a Task instance. Class Task contains the bit set |
| 7 | representing the flags selection. The builder module is responsible for filling |
| 8 | the image and the checksum field of a Task. The executor module will put the |
| 9 | execution output to the execution field. |
| 10 | """ |
| 11 | |
| 12 | __author__ = 'yuhenglong@google.com (Yuheng Long)' |
| 13 | |
| 14 | |
| 15 | class Task(object): |
| 16 | """A single reproducing entity. |
| 17 | |
| 18 | A single test of performance with a particular set of flags. It records the |
| 19 | flag set, the image, the check sum of the image and the cost. |
| 20 | """ |
| 21 | |
| 22 | def __init__(self, flag_set): |
| 23 | """Set up the optimization flag selection for this task. |
| 24 | |
| 25 | Args: |
| 26 | flag_set: the optimization flag set that is encapsulated by this task. |
| 27 | """ |
| 28 | self._flag_set = flag_set |
| 29 | |
| 30 | def reproduce_with(self, other): |
| 31 | """Create a new SolutionCandidate by reproduction with another. |
| 32 | |
| 33 | Mix two Tasks together to form a new Task of the same class. This is one of |
| 34 | the core functions of a GA. |
| 35 | |
| 36 | Args: |
| 37 | other: The other Task to reproduce with. |
| 38 | |
| 39 | Returns: A Task that is a mix between self and other. |
| 40 | """ |
| 41 | pass |
| 42 | |
| 43 | def compile(self): |
| 44 | """Run a compile. |
| 45 | |
| 46 | This method compile an image using the present flags, get the image, |
| 47 | test the existent of the image and gathers monitoring information, and sets |
| 48 | the internal cost (fitness) for this set of flags. |
| 49 | """ |
| 50 | pass |
| 51 | |
| 52 | def get_flags(self): |
| 53 | pass |
| 54 | |
| 55 | def set_flags(self, flags): |
| 56 | pass |
| 57 | |
| 58 | def get_checksum(self): |
| 59 | pass |
| 60 | |
| 61 | def set_checksum(self, checksum): |
| 62 | pass |
| 63 | |
| 64 | def get_image(self): |
| 65 | pass |
| 66 | |
| 67 | def set_image(self, image): |
| 68 | pass |