You've already forked HeurAMS-legacy
32 lines
1.4 KiB
Python
32 lines
1.4 KiB
Python
# 单个原子处理器
|
|
|
|
import heurams.kernel.particles as pt
|
|
|
|
class Apparatus():
|
|
"""反应器对象, 决策一个原子的不同记忆方式, 并反馈到布局"""
|
|
def __init__(self, screen, reactor, atom, is_review = 0):
|
|
self.electron: pt.Electron = atom[0]
|
|
self.nucleon: pt.Nucleon = atom[1]
|
|
self.positron: dict = atom[2]
|
|
self.testdata = self.positron["testdata"]
|
|
self.procession: typing.List[comps.Composition] = list()
|
|
if self.positron["is_new_activation"] == 1:
|
|
self.positron["is_new_activation"] = 0
|
|
self.procession.append(comps.registry["recognition"](screen, reactor, atom))
|
|
return
|
|
for i in self.positron["testdata"].keys():
|
|
if i == "additional_inf":
|
|
continue
|
|
if i == "fill_blank_test": # 加深
|
|
self.procession.append(comps.registry[i](screen, reactor, atom))
|
|
# self.procession.append(comps.registry[i](screen, reactor, atom))
|
|
self.procession.append(comps.registry[i](screen, reactor, atom))
|
|
# self.procession.reverse()
|
|
random.shuffle(self.procession)
|
|
if self.positron["is_new_activation"] == 0:
|
|
self.procession.append(comps.registry['recognition'](screen, reactor, atom))
|
|
if is_review == 1:
|
|
self.procession = [self.procession[-2], self.procession[-1]]
|
|
def iterator(self):
|
|
yield from self.procession
|