diff options
Diffstat (limited to 'master_thesis/frensch_procedures.py')
-rw-r--r-- | master_thesis/frensch_procedures.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/master_thesis/frensch_procedures.py b/master_thesis/frensch_procedures.py index 88aa29d..66f1c8c 100644 --- a/master_thesis/frensch_procedures.py +++ b/master_thesis/frensch_procedures.py @@ -17,6 +17,33 @@ class WaterSample: self.lime = lime self.toxin = toxin + def procedure_dict(self): + procedures = { + "1": (self.index1, self.index1_str), + "2": (self.index2, self.index2_str), + "3": (self.index3, self.index3_str), + "4": (self.index4, self.index4_str), + "5": (self.index5, self.index5_str), + "6": (self.index6, self.index6_str), + "overall": (self.overall, self.overall_str), + } + return procedures + + def select_procedures(self): + procedures = [ + (self.index1, self.index1_str), + (self.index2, self.index2_str), + (self.index3, self.index3_str), + (self.index4, self.index4_str), + (self.index5, self.index5_str), + (self.index6, self.index6_str), + ] + random.shuffle(procedures) + training_procedures = procedures[:-1] + training_procedures.append((self.overall, self.overall_str)) + + return training_procedures, procedures[-1] + def index1(self): return (self.lime[3] - self.lime[1]) * self.solid @@ -47,6 +74,12 @@ class WaterSample: def index5_str(self): return "Greater of [(Toxin_3 - Toxin_2), Lime_3]" + def index6(self): + return min(self.algae, (self.lime[0] + self.toxin[0])) + + def index6_str(self): + return "Lesser of [Algae, (Lime_1 + Toxin_1)]" + def overall(self): return 100 - max( self.index1(), self.index2(), self.index3(), self.index4(), self.index5() @@ -75,4 +108,3 @@ def random_WaterSample(): toxin = tuple(random.randint(1, 9) for _ in range(4)) return WaterSample(solid, algae, lime, toxin) - |