aboutsummaryrefslogtreecommitdiff
path: root/bestflags/task.py
diff options
context:
space:
mode:
Diffstat (limited to 'bestflags/task.py')
-rw-r--r--bestflags/task.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/bestflags/task.py b/bestflags/task.py
new file mode 100644
index 00000000..b092ffc9
--- /dev/null
+++ b/bestflags/task.py
@@ -0,0 +1,66 @@
+"""A reproducing entity.
+
+The Task class is used by different modules. Each module fills in the
+corresponding information into a Task instance. Class Task contains the bit set
+representing the flags selection. The builder module is responsible for filling
+the image and the checksum field of a Task. The executor module will put the
+execution output to the execution field.
+"""
+
+__author__ = 'yuhenglong@google.com (Yuheng Long)'
+
+
+class Task(object):
+ """A single reproducing entity.
+
+ A single test of performance with a particular set of flags. It records the
+ flag set, the image, the check sum of the image and the cost.
+ """
+
+ def __init__(self, flag_set):
+ """Set up the optimization flag selection for this task.
+
+ Args:
+ flag_set: the optimization flag set that is encapsulated by this task.
+ """
+ self._flag_set = flag_set
+
+ def reproduce_with(self, other):
+ """Create a new SolutionCandidate by reproduction with another.
+
+ Mix two Tasks together to form a new Task of the same class. This is one of
+ the core functions of a GA.
+
+ Args:
+ other: The other Task to reproduce with.
+
+ Returns: A Task that is a mix between self and other.
+ """
+ pass
+
+ def compile(self):
+ """Run a compile.
+
+ This method compile an image using the present flags, get the image,
+ test the existent of the image and gathers monitoring information, and sets
+ the internal cost (fitness) for this set of flags.
+ """
+ pass
+
+ def get_flags(self):
+ pass
+
+ def set_flags(self, flags):
+ pass
+
+ def get_checksum(self):
+ pass
+
+ def set_checksum(self, checksum):
+ pass
+
+ def get_image(self):
+ pass
+
+ def set_image(self, image):
+ pass