IMP::domino::DominoSampler supports an interactive mode where by each step of the sampling process is called explicitly and all intermediate results are exposed. This usage mode can be used to help understand how domino behaves as well as to distribute a domino computation to multiple cores or multiple machines. For the latter, it is useful to use the IMP::domino::get_assignments() and IMP::domino::set_assignments() functions to save the states to a file.
17 [(ps[i[0]], ps[i[1]])
for i
in [(0, 1), (1, 2)]])
18 print([(p[0].get_name(), p[1].get_name())
for p
in lpc.get_particle_pairs()])
20 r.set_maximum_score(.1)
27 pst.set_particle_states(p, space)
29 m.set_log_level(IMP.base.SILENT)
36 print(
"Unable to display graph using 'dot'")
40 ds.set_scoring_function([r])
42 ds.set_log_level(IMP.base.SILENT)
47 def get_assignments(vertex):
48 on = mt.get_out_neighbors(vertex)
51 ret = ds.get_vertex_assignments(vertex)
58 a0 = get_assignments(on[0])
59 a1 = get_assignments(on[1])
60 ret = ds.get_vertex_assignments(vertex, a0, a1)
61 print(mt.get_vertex_name(vertex), [str(r)
for r
in ret])
65 get_assignments(mt.get_vertices()[-1])
72 def schedule_job(vertex):
75 on = mt.get_out_neighbors(vertex)
78 max_child_time = max(schedule_job(n), max_child_time)
79 my_time = max_child_time + 1
80 while len(schedule) < my_time + 1:
83 schedule[my_time].append(vertex)
86 schedule_job(mt.get_vertices()[-1])
87 print(
"The merging can be scheduled as", schedule)