本文整理汇总了Python中problem.Problem.is_finished方法的典型用法代码示例。如果您正苦于以下问题:Python Problem.is_finished方法的具体用法?Python Problem.is_finished怎么用?Python Problem.is_finished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类problem.Problem
的用法示例。
在下文中一共展示了Problem.is_finished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_chimera_graph
# 需要导入模块: from problem import Problem [as 别名]
# 或者: from problem.Problem import is_finished [as 别名]
N = 4
g = make_chimera_graph(N)
magnet_frames = []
draw_chimera_graph(g, N, magnet_frames)
TEMP = 0.22
problem = Problem(g, TEMP)
xs = []
ys = []
# screenshot_schedule = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
# screen_index = 0
# sleep(5)
while not problem.is_finished():
prev_time = problem._time
problem.iterate()
# if prev_time <= screenshot_schedule[screen_index] and \
# problem._time >= screenshot_schedule[screen_index]:
# getoutput("xwd -name \"Chimera Graph\" | convert xwd:- images/image_{0:03}.png".format(int(problem._time * 100)))
# screen_index += 1
energy = problem.hamiltonian()
xs.append(problem._time)
ys.append(energy)
print(problem._time, energy)
xs = np.array(xs)
ys = np.array(ys)