Found entry points for the research project
This commit is contained in:
130343
copycat.log
130343
copycat.log
File diff suppressed because it is too large
Load Diff
@ -75,8 +75,10 @@ def __structureVsStructure(structure1, weight1, structure2, weight2):
|
|||||||
temperature = ctx.temperature
|
temperature = ctx.temperature
|
||||||
structure1.updateStrength()
|
structure1.updateStrength()
|
||||||
structure2.updateStrength()
|
structure2.updateStrength()
|
||||||
|
#TODO: use entropy
|
||||||
weightedStrength1 = temperature.getAdjustedValue(
|
weightedStrength1 = temperature.getAdjustedValue(
|
||||||
structure1.totalStrength * weight1)
|
structure1.totalStrength * weight1)
|
||||||
|
#TODO: use entropy
|
||||||
weightedStrength2 = temperature.getAdjustedValue(
|
weightedStrength2 = temperature.getAdjustedValue(
|
||||||
structure2.totalStrength * weight2)
|
structure2.totalStrength * weight2)
|
||||||
return random.weighted_greater_than(weightedStrength1, weightedStrength2)
|
return random.weighted_greater_than(weightedStrength1, weightedStrength2)
|
||||||
@ -112,6 +114,7 @@ def __slippability(ctx, conceptMappings):
|
|||||||
temperature = ctx.temperature
|
temperature = ctx.temperature
|
||||||
for mapping in conceptMappings:
|
for mapping in conceptMappings:
|
||||||
slippiness = mapping.slippability() / 100.0
|
slippiness = mapping.slippability() / 100.0
|
||||||
|
#TODO: use entropy
|
||||||
probabilityOfSlippage = temperature.getAdjustedProbability(slippiness)
|
probabilityOfSlippage = temperature.getAdjustedProbability(slippiness)
|
||||||
if random.coinFlip(probabilityOfSlippage):
|
if random.coinFlip(probabilityOfSlippage):
|
||||||
return True
|
return True
|
||||||
@ -123,6 +126,7 @@ def breaker(ctx, codelet):
|
|||||||
random = ctx.random
|
random = ctx.random
|
||||||
temperature = ctx.temperature
|
temperature = ctx.temperature
|
||||||
workspace = ctx.workspace
|
workspace = ctx.workspace
|
||||||
|
#TODO: use entropy
|
||||||
probabilityOfFizzle = (100.0 - temperature.value()) / 100.0
|
probabilityOfFizzle = (100.0 - temperature.value()) / 100.0
|
||||||
if random.coinFlip(probabilityOfFizzle):
|
if random.coinFlip(probabilityOfFizzle):
|
||||||
return
|
return
|
||||||
@ -139,6 +143,7 @@ def breaker(ctx, codelet):
|
|||||||
breakObjects += [structure.source.group]
|
breakObjects += [structure.source.group]
|
||||||
# Break all the objects or none of them; this matches the Java
|
# Break all the objects or none of them; this matches the Java
|
||||||
for structure in breakObjects:
|
for structure in breakObjects:
|
||||||
|
#TODO: use entropy
|
||||||
breakProbability = temperature.getAdjustedProbability(
|
breakProbability = temperature.getAdjustedProbability(
|
||||||
structure.totalStrength / 100.0)
|
structure.totalStrength / 100.0)
|
||||||
if random.coinFlip(breakProbability):
|
if random.coinFlip(breakProbability):
|
||||||
@ -161,6 +166,7 @@ def similarPropertyLinks(ctx, slip_node):
|
|||||||
result = []
|
result = []
|
||||||
for slip_link in slip_node.propertyLinks:
|
for slip_link in slip_node.propertyLinks:
|
||||||
association = slip_link.degreeOfAssociation() / 100.0
|
association = slip_link.degreeOfAssociation() / 100.0
|
||||||
|
#TODO:use entropy
|
||||||
probability = temperature.getAdjustedProbability(association)
|
probability = temperature.getAdjustedProbability(association)
|
||||||
if random.coinFlip(probability):
|
if random.coinFlip(probability):
|
||||||
result += [slip_link]
|
result += [slip_link]
|
||||||
@ -216,6 +222,7 @@ def description_strength_tester(ctx, codelet):
|
|||||||
description.descriptor.buffer = 100.0
|
description.descriptor.buffer = 100.0
|
||||||
description.updateStrength()
|
description.updateStrength()
|
||||||
strength = description.totalStrength
|
strength = description.totalStrength
|
||||||
|
#TODO: use entropy
|
||||||
probability = temperature.getAdjustedProbability(strength / 100.0)
|
probability = temperature.getAdjustedProbability(strength / 100.0)
|
||||||
assert random.coinFlip(probability)
|
assert random.coinFlip(probability)
|
||||||
coderack.newCodelet('description-builder', strength, [description])
|
coderack.newCodelet('description-builder', strength, [description])
|
||||||
@ -361,6 +368,7 @@ def rule_strength_tester(ctx, codelet):
|
|||||||
temperature = ctx.temperature
|
temperature = ctx.temperature
|
||||||
rule = codelet.arguments[0]
|
rule = codelet.arguments[0]
|
||||||
rule.updateStrength()
|
rule.updateStrength()
|
||||||
|
#TODO: use entropy
|
||||||
probability = temperature.getAdjustedProbability(rule.totalStrength / 100.0)
|
probability = temperature.getAdjustedProbability(rule.totalStrength / 100.0)
|
||||||
if random.coinFlip(probability):
|
if random.coinFlip(probability):
|
||||||
coderack.newCodelet('rule-builder', rule.totalStrength, [rule])
|
coderack.newCodelet('rule-builder', rule.totalStrength, [rule])
|
||||||
@ -463,6 +471,7 @@ def bond_strength_tester(ctx, codelet):
|
|||||||
__showWhichStringObjectIsFrom(bond)
|
__showWhichStringObjectIsFrom(bond)
|
||||||
bond.updateStrength()
|
bond.updateStrength()
|
||||||
strength = bond.totalStrength
|
strength = bond.totalStrength
|
||||||
|
#Todo: use entropy
|
||||||
probability = temperature.getAdjustedProbability(strength / 100.0)
|
probability = temperature.getAdjustedProbability(strength / 100.0)
|
||||||
logging.info('bond strength = %d for %s', strength, bond)
|
logging.info('bond strength = %d for %s', strength, bond)
|
||||||
assert random.coinFlip(probability)
|
assert random.coinFlip(probability)
|
||||||
@ -745,6 +754,7 @@ def group_strength_tester(ctx, codelet):
|
|||||||
__showWhichStringObjectIsFrom(group)
|
__showWhichStringObjectIsFrom(group)
|
||||||
group.updateStrength()
|
group.updateStrength()
|
||||||
strength = group.totalStrength
|
strength = group.totalStrength
|
||||||
|
#TODO: use entropy
|
||||||
probability = temperature.getAdjustedProbability(strength / 100.0)
|
probability = temperature.getAdjustedProbability(strength / 100.0)
|
||||||
if random.coinFlip(probability):
|
if random.coinFlip(probability):
|
||||||
# it is strong enough - post builder & activate nodes
|
# it is strong enough - post builder & activate nodes
|
||||||
@ -872,6 +882,7 @@ def rule_translator(ctx, codelet):
|
|||||||
bondDensity = min(bondDensity, 1.0)
|
bondDensity = min(bondDensity, 1.0)
|
||||||
weights = __getCutoffWeights(bondDensity)
|
weights = __getCutoffWeights(bondDensity)
|
||||||
cutoff = 10.0 * random.weighted_choice(list(range(1, 11)), weights)
|
cutoff = 10.0 * random.weighted_choice(list(range(1, 11)), weights)
|
||||||
|
#TODO: use entropy
|
||||||
if cutoff >= temperature.actual_value:
|
if cutoff >= temperature.actual_value:
|
||||||
result = workspace.rule.buildTranslatedRule()
|
result = workspace.rule.buildTranslatedRule()
|
||||||
if result is not None:
|
if result is not None:
|
||||||
@ -928,6 +939,7 @@ def important_object_correspondence_scout(ctx, codelet):
|
|||||||
coderack = ctx.coderack
|
coderack = ctx.coderack
|
||||||
random = ctx.random
|
random = ctx.random
|
||||||
slipnet = ctx.slipnet
|
slipnet = ctx.slipnet
|
||||||
|
#TODO: use entropy
|
||||||
temperature = ctx.temperature
|
temperature = ctx.temperature
|
||||||
workspace = ctx.workspace
|
workspace = ctx.workspace
|
||||||
objectFromInitial = chooseUnmodifiedObject(ctx, 'relativeImportance',
|
objectFromInitial = chooseUnmodifiedObject(ctx, 'relativeImportance',
|
||||||
@ -998,6 +1010,7 @@ def correspondence_strength_tester(ctx, codelet):
|
|||||||
objectFromTarget.flipped_version())))
|
objectFromTarget.flipped_version())))
|
||||||
correspondence.updateStrength()
|
correspondence.updateStrength()
|
||||||
strength = correspondence.totalStrength
|
strength = correspondence.totalStrength
|
||||||
|
#TODO: use entropy
|
||||||
probability = temperature.getAdjustedProbability(strength / 100.0)
|
probability = temperature.getAdjustedProbability(strength / 100.0)
|
||||||
if random.coinFlip(probability):
|
if random.coinFlip(probability):
|
||||||
# activate some concepts
|
# activate some concepts
|
||||||
|
|||||||
@ -83,6 +83,7 @@ class Coderack(object):
|
|||||||
if 'correspondence' in codeletName:
|
if 'correspondence' in codeletName:
|
||||||
return workspace.interStringUnhappiness / 100.0
|
return workspace.interStringUnhappiness / 100.0
|
||||||
if 'description' in codeletName:
|
if 'description' in codeletName:
|
||||||
|
#TODO: use entropy
|
||||||
return (temperature.value() / 100.0) ** 2
|
return (temperature.value() / 100.0) ** 2
|
||||||
return workspace.intraStringUnhappiness / 100.0
|
return workspace.intraStringUnhappiness / 100.0
|
||||||
|
|
||||||
@ -161,6 +162,8 @@ class Coderack(object):
|
|||||||
urgency = 3
|
urgency = 3
|
||||||
if codeletName == 'breaker':
|
if codeletName == 'breaker':
|
||||||
urgency = 1
|
urgency = 1
|
||||||
|
|
||||||
|
#TODO: use entropy
|
||||||
if temperature.value() < 25.0 and 'translator' in codeletName:
|
if temperature.value() < 25.0 and 'translator' in codeletName:
|
||||||
urgency = 5
|
urgency = 5
|
||||||
for _ in range(howMany):
|
for _ in range(howMany):
|
||||||
@ -287,6 +290,8 @@ class Coderack(object):
|
|||||||
random = self.ctx.random
|
random = self.ctx.random
|
||||||
temperature = self.ctx.temperature
|
temperature = self.ctx.temperature
|
||||||
assert self.codelets
|
assert self.codelets
|
||||||
|
|
||||||
|
#TODO: use entropy
|
||||||
scale = (100.0 - temperature.value() + 10.0) / 15.0
|
scale = (100.0 - temperature.value() + 10.0) / 15.0
|
||||||
chosen = random.weighted_choice(self.codelets, [codelet.urgency ** scale for codelet in self.codelets])
|
chosen = random.weighted_choice(self.codelets, [codelet.urgency ** scale for codelet in self.codelets])
|
||||||
self.removeCodelet(chosen)
|
self.removeCodelet(chosen)
|
||||||
|
|||||||
@ -239,6 +239,7 @@ class CursesReporter(Reporter):
|
|||||||
w.border()
|
w.border()
|
||||||
w.refresh()
|
w.refresh()
|
||||||
|
|
||||||
|
#TODO: use entropy
|
||||||
def report_temperature(self, temperature):
|
def report_temperature(self, temperature):
|
||||||
self.do_keyboard_shortcuts()
|
self.do_keyboard_shortcuts()
|
||||||
w = self.temperatureWindow
|
w = self.temperatureWindow
|
||||||
|
|||||||
@ -96,6 +96,7 @@ class Group(WorkspaceObject):
|
|||||||
support = self.localSupport() / 100.0
|
support = self.localSupport() / 100.0
|
||||||
activation = slipnet.length.activation / 100.0
|
activation = slipnet.length.activation / 100.0
|
||||||
supportedActivation = (support * activation) ** exp
|
supportedActivation = (support * activation) ** exp
|
||||||
|
#TODO: use entropy
|
||||||
return temperature.getAdjustedProbability(supportedActivation)
|
return temperature.getAdjustedProbability(supportedActivation)
|
||||||
|
|
||||||
def flippedVersion(self):
|
def flippedVersion(self):
|
||||||
@ -130,6 +131,7 @@ class Group(WorkspaceObject):
|
|||||||
cubedlength = length ** 3
|
cubedlength = length ** 3
|
||||||
fred = cubedlength * (100.0 - slipnet.length.activation) / 100.0
|
fred = cubedlength * (100.0 - slipnet.length.activation) / 100.0
|
||||||
probability = 0.5 ** fred
|
probability = 0.5 ** fred
|
||||||
|
#TODO: use entropy
|
||||||
value = temperature.getAdjustedProbability(probability)
|
value = temperature.getAdjustedProbability(probability)
|
||||||
if value < 0.06:
|
if value < 0.06:
|
||||||
value = 0.0
|
value = 0.0
|
||||||
|
|||||||
@ -82,6 +82,7 @@ class Workspace(object):
|
|||||||
self.initial.updateIntraStringUnhappiness()
|
self.initial.updateIntraStringUnhappiness()
|
||||||
self.target.updateIntraStringUnhappiness()
|
self.target.updateIntraStringUnhappiness()
|
||||||
|
|
||||||
|
#TODO: use entropy
|
||||||
def getUpdatedTemperature(self):
|
def getUpdatedTemperature(self):
|
||||||
self.calculateIntraStringUnhappiness()
|
self.calculateIntraStringUnhappiness()
|
||||||
self.calculateInterStringUnhappiness()
|
self.calculateInterStringUnhappiness()
|
||||||
|
|||||||
Reference in New Issue
Block a user