我试图做一个递归实时模拟,看看它在simpy框架中是否可行。 该函数用于跟踪日志字典。。。 当我运行此代码时,jupyter内核停止工作并关闭,为什么
def simStudy(env,AVERAGE_PROGRAMME_LENGTH):
i = 0
while i < int(3000/TYPING_RATE):
ans = input("Target achieved?")
log[env.now] = int(bool(ans))
print(log)
AVERAGE_PROGRAMME_LENGTH -= TYPING_RATE
yield env.timeout(1)
env = sim.rt.RealtimeEnvironment(factor = 10,strict = True)
def startSim():
try:
env.process(simStudy(env,AVERAGE_PROGRAMME_LENGTH))
env.run()
except RuntimeError as e:
startSim()
print(str(e)[-8:-3])
startSim()
我不经常在模拟中使用递归。我的大多数进程都会有一个队列,如果一个实体需要相同的进程,我只需将它放回队列中,让队列处理器对其进行多次处理
例如,一次一层剥一层洋葱
这里是递归
这是没有递归的同一个sim卡
相关问题 更多 >
编程相关推荐