Esempio n. 1
0
 def __postBottomUpCodelets(self, codeletName):
     probability = workspaceFormulas.probabilityOfPosting(codeletName)
     howMany = workspaceFormulas.howManyToPost(codeletName)
     if self.speedUpBonds:
         if 'bond' in codeletName or 'group' in codeletName:
             howMany *= 3
     urgency = 3
     if codeletName == 'breaker':
         urgency = 1
     if formulas.Temperature < 25.0 and 'translator' in codeletName:
         urgency = 5
     for _ in range(0, howMany):
         if random.random() < probability:
             codelet = Codelet(codeletName, urgency, self.codeletsRun)
             self.post(codelet)
Esempio n. 2
0
 def __postBottomUpCodelets(self, codeletName):
     probability = workspaceFormulas.probabilityOfPosting(codeletName)
     howMany = workspaceFormulas.howManyToPost(codeletName)
     if self.speedUpBonds:
         if 'bond' in codeletName or 'group' in codeletName:
             howMany *= 3
     urgency = 3
     if codeletName == 'breaker':
         urgency = 1
     if formulas.Temperature < 25.0 and 'translator' in codeletName:
         urgency = 5
     for _ in range(0, howMany):
         if random.random() < probability:
             codelet = Codelet(codeletName, urgency, self.codeletsRun)
             self.post(codelet)
Esempio n. 3
0
 def postTopDownCodelets(self):
     for node in slipnet.slipnodes:
         #logging.info('Trying slipnode: %s' % node.get_name())
         if node.activation == 100.0:
             #logging.info('using slipnode: %s' % node.get_name())
             for codeletName in node.codelets:
                 probability = workspaceFormulas.probabilityOfPosting(codeletName)
                 howMany = workspaceFormulas.howManyToPost(codeletName)
                 #print '%s:%d' % (codeletName,howMany)
                 for unused in range(0, howMany):
                     if random.random() < probability:
                         urgency = self.getUrgencyBin(node.activation * node.conceptualDepth / 100.0)
                         codelet = Codelet(codeletName, urgency, self.codeletsRun)
                         codelet.arguments += [node]
                         logging.info('Post top down: %s, with urgency: %d' % (codelet.name, urgency))
                         #logging.info("From slipnode %s, activation: %s, depth: %s" %(node.get_name(),node.activation,node.conceptualDepth) )
                         self.post(codelet)
Esempio n. 4
0
 def postTopDownCodelets(self):
     for node in slipnet.slipnodes:
         logging.info('Trying slipnode: %s', node.get_name())
         if node.activation != 100.0:
             continue
         logging.info('using slipnode: %s', node.get_name())
         for codeletName in node.codelets:
             probability = workspaceFormulas.probabilityOfPosting(
                 codeletName)
             howMany = workspaceFormulas.howManyToPost(codeletName)
             for _ in range(0, howMany):
                 if random.random() >= probability:
                     continue
                 urgency = getUrgencyBin(
                     node.activation * node.conceptualDepth / 100.0)
                 codelet = Codelet(codeletName, urgency, self.codeletsRun)
                 codelet.arguments += [node]
                 logging.info('Post top down: %s, with urgency: %d',
                              codelet.name, urgency)
                 self.post(codelet)
Esempio n. 5
0
 def postTopDownCodelets(self):
     for node in slipnet.slipnodes:
         #logging.info('Trying slipnode: %s' % node.get_name())
         if node.activation != 100.0:
             continue
         #logging.info('using slipnode: %s' % node.get_name())
         for codeletName in node.codelets:
             probability = workspaceFormulas.probabilityOfPosting(
                 codeletName)
             howMany = workspaceFormulas.howManyToPost(codeletName)
             for _ in range(0, howMany):
                 if random.random() >= probability:
                     continue
                 urgency = getUrgencyBin(node.activation *
                                         node.conceptualDepth / 100.0)
                 codelet = Codelet(codeletName, urgency, self.codeletsRun)
                 codelet.arguments += [node]
                 logging.info('Post top down: %s, with urgency: %d',
                              codelet.name, urgency)
                 self.post(codelet)
Esempio n. 6
0
 def postTopDownCodelets(self):
     for node in slipnet.slipnodes:
         #logging.info('Trying slipnode: %s' % node.get_name())
         if node.activation == 100.0:
             #logging.info('using slipnode: %s' % node.get_name())
             for codeletName in node.codelets:
                 probability = workspaceFormulas.probabilityOfPosting(
                     codeletName)
                 howMany = workspaceFormulas.howManyToPost(codeletName)
                 #print '%s:%d' % (codeletName,howMany)
                 for unused in range(0, howMany):
                     if random.random() < probability:
                         urgency = self.getUrgencyBin(
                             node.activation * node.conceptualDepth / 100.0)
                         codelet = Codelet(codeletName, urgency,
                                           self.codeletsRun)
                         codelet.arguments += [node]
                         logging.info(
                             'Post top down: %s, with urgency: %d' %
                             (codelet.name, urgency))
                         #logging.info("From slipnode %s, activation: %s, depth: %s" %(node.get_name(),node.activation,node.conceptualDepth) )
                         self.post(codelet)