10 def create_scoring(m, ps):
11 pairs=[[0,1],[0,2],[1,3],[2,3],[3,4],[4,5],[1,5]]
17 pr.set_maximum_score(.01)
23 def create_representation(m):
31 def create_discrete_states(ps):
38 vs= vs+[-v
for v
in vs]
39 print len(vs),
"states for each particle"
44 pst.set_particle_states(p, states)
50 def __init__(self, pos, value):
52 IMP.domino.SubsetFilter.__init__(self,
"MF"+str(pos) +
" " +str(value))
55 def get_next_state(self, pos, s):
59 if s[self.pos] > self.value:
64 def get_is_ok(self, state):
66 ret= state[self.pos]==self.value
68 def get_strength(self, s, excluded):
71 def __init__(self, p, s):
73 IMP.domino.SubsetFilterTable.__init__(self,
"MFT"+p.get_name()+
" at "+str(s))
76 def get_subset_filter(self, subset, excluded):
78 if self.p
in subset
and self.p
not in sum([list(x)
for x
in excluded], []):
80 return self.MyFilter(list(subset).index(self.p), self.s)
85 def create_sampler(m, ps, rs, pst):
98 mf=MyFilterTable(ps[1], 0)
103 s.set_assignments_table(states)
104 s.set_subset_filter_tables(filters)
109 m.set_log_level(IMP.base.SILENT)
111 print "creating representation"
112 ps=create_representation(m)
113 print "creating discrete states"
114 pst=create_discrete_states(ps)
115 print "creating score function"
116 rs=create_scoring(m, ps)
118 print "creating sampler"
119 s=create_sampler(m, ps, rs, pst)
125 print "found ", cs.get_number_of_configurations(),
"solutions"
126 for i
in range(cs.get_number_of_configurations()):
127 cs.load_configuration(i)
128 print "solution number:",i,
" is:", m.evaluate(
False)