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