summaryrefslogtreecommitdiff
path: root/master_thesis/frensch_procedures.py
diff options
context:
space:
mode:
authorNiclas Dobbertin <niclas.dobbertin@mailbox.org>2023-08-18 10:23:47 +0200
committerNiclas Dobbertin <niclas.dobbertin@mailbox.org>2023-08-18 10:23:47 +0200
commit11bab9715e6f68c3d90b4ba04a3b2e54f43c06a3 (patch)
treee4ea60274b0da227af0f3c6a02688c891764bed6 /master_thesis/frensch_procedures.py
parent395c6ea6abd9838c214f90e46b21633ec185dbc6 (diff)
procedure randomisation
Diffstat (limited to 'master_thesis/frensch_procedures.py')
-rw-r--r--master_thesis/frensch_procedures.py34
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)
-