标题:关于dff[random.choice(get_neighbors((i, j)))] += 1元胞动机的程序
取消只看楼主
leaf666666
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2022-4-6
 问题点数:0 回复次数:0 
关于dff[random.choice(get_neighbors((i, j)))] += 1元胞动机的程序
def update_DFF(dff, diff):
    #for cell in diff:
    #    assert walls[cell] > -10
    #     dff[cell] += 1

    dff += diff

    for i, j in it.chain(it.product(range(1, dim_x - 1), range(1, dim_y - 1)), exit_cells):
        for _ in range(int(dff[i, j])):
            if np.random.rand() < delta: # decay
                dff[i, j] -= 1
            elif np.random.rand() < alpha: # diffusion
                dff[i, j] -= 1
                dff[random.choice(get_neighbors((i, j)))] += 1
        assert walls[i, j] > -10 or dff[i, j] == 0, (dff, i, j)
    # dff[:] = np.ones((dim_x, dim_y))
这段程序不太懂,哪位大神帮帮忙,特别是 dff[random.choice(get_neighbors((i, j)))] += 1,assert walls[i, j] > -10 or dff[i, j] == 0, (dff, i, j)这两句,谢谢!
搜索更多相关主题的帖子: for cell choice assert random 
2022-04-06 17:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-508797-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.419591 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved