diff --git a/copycat/temperature.py b/copycat/temperature.py index 1ead82e..eb49cea 100644 --- a/copycat/temperature.py +++ b/copycat/temperature.py @@ -222,3 +222,21 @@ class Temperature(object): c = (10 - a) / 100 f = (c + 1) * value return (0 + (-f * math.log2(f))) # max(f, 0.0000) + + def getAdjustedProbability(self, value): + # Recall self.value(): + # def value(self): + # return 100.0 if self.clamped else self.actual_value + # + # f in terms of value() and value only + # f = ((10 - sqrt(100 - self.value()))/100 + 1) * value + + if value == 0 or value == 0.5 or self.value() == 0: + return value + if value < 0.5: + return 1.0 - self.getAdjustedProbability(1.0 - value) + coldness = 100.0 - self.value() + a = math.sqrt(coldness) + c = (10 - a) / 100 + f = (c + 1) * value + return max(f, 0.5) diff --git a/copycat/workspace.py b/copycat/workspace.py index f2d5ba0..1c1ace7 100644 --- a/copycat/workspace.py +++ b/copycat/workspace.py @@ -39,7 +39,7 @@ class Workspace(object): self.changedObject = None self.objects = [] self.structures = [] - self.rule = None + self.rule = None # Only one rule? : LSaldyt self.initial = WorkspaceString(self.ctx, self.initialString) self.modified = WorkspaceString(self.ctx, self.modifiedString) self.target = WorkspaceString(self.ctx, self.targetString) @@ -99,6 +99,11 @@ class Workspace(object): # TODO: use entropy def getUpdatedTemperature(self): + ''' + Calculation of global tolerance towards irrelevance + + temp = weightedAverage(totalUnhappiness(.8), ruleWeakness(.2)) + ''' self.calculateIntraStringUnhappiness() self.calculateInterStringUnhappiness() self.calculateTotalUnhappiness()