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 print [(p[0].get_name(), p[1].get_name())
for p
in lpc.get_particle_pairs()]
20 r.set_maximum_score(.1)
26 pst.set_particle_states(p, space)
28 m.set_log_level(IMP.base.SILENT)
35 print "Unable to display graph using 'dot'"
39 ds.set_scoring_function([r])
41 ds.set_log_level(IMP.base.SILENT)
44 def get_assignments(vertex):
45 on= mt.get_out_neighbors(vertex)
48 ret= ds.get_vertex_assignments(vertex)
54 a0= get_assignments(on[0])
55 a1= get_assignments(on[1])
56 ret= ds.get_vertex_assignments(vertex, a0, a1)
57 print mt.get_vertex_name(vertex), [str(r)
for r
in ret]
61 get_assignments(mt.get_vertices()[-1])
66 def schedule_job(vertex):
69 on= mt.get_out_neighbors(vertex)
72 max_child_time=max(schedule_job(n), max_child_time)
73 my_time=max_child_time+1
74 while len(schedule) < my_time+1:
77 schedule[my_time].append(vertex)
80 schedule_job(mt.get_vertices()[-1])
81 print "The merging can be scheduled as", schedule