18 def create_scoring(m, ps):
19 pairs = [[0, 1], [0, 2], [1, 3], [2, 3], [3, 4], [4, 5], [1, 5]]
23 [(ps[p[0]], ps[p[1]])
for p
in pairs],
26 pr.set_maximum_score(.01)
32 def create_representation(m):
35 p = m.add_particle(
"P%d" % i)
41 def create_discrete_states(m, ps):
48 vs = vs + [-v
for v
in vs]
49 print(len(vs),
"states for each particle")
54 pst.set_particle_states(m.get_particle(p), states)
64 def __init__(self, pos, value):
66 IMP.domino.SubsetFilter.__init__(
67 self,
"MF" + str(pos) +
" " + str(value))
71 def get_next_state(self, pos, s):
75 if s[self.pos] > self.value:
81 def get_is_ok(self, state):
83 ret = state[self.pos] == self.value
86 def get_strength(self, s, excluded):
90 def __init__(self, p, s):
92 IMP.domino.SubsetFilterTable.__init__(
93 self,
"MFT" + p.get_name() +
" at " + str(s))
97 def get_subset_filter(self, subset, excluded):
99 if self.p
in subset
and self.p
not in sum([list(x)
for x
in excluded], []):
101 return self.MyFilter(list(subset).index(self.p), self.s)
106 def create_sampler(m, ps, rs, pst):
116 rc.add_restraints(rs)
120 mf = MyFilterTable(m.get_particle(ps[1]), 0)
125 s.set_assignments_table(states)
126 s.set_subset_filter_tables(filters)
131 m.set_log_level(IMP.SILENT)
133 print(
"creating representation")
134 ps = create_representation(m)
135 print(
"creating discrete states")
136 pst = create_discrete_states(m, ps)
137 print(
"creating score function")
138 rs = create_scoring(m, ps)
140 print(
"creating sampler")
141 s = create_sampler(m, ps, rs, pst)
145 cs = s.create_sample()
147 print(
"found ", cs.get_number_of_configurations(),
"solutions")
149 for i
in range(cs.get_number_of_configurations()):
150 cs.load_configuration(i)
151 print(
"solution number:", i,
" is:", sf.evaluate(
False))
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
Various classes to hold sets of particles.
Upper bound harmonic function (non-zero when feature > mean)
Sample best solutions using Domino.
Filter a configuration of the subset using the Model thresholds.
static XYZ setup_particle(Model *m, ParticleIndex pi)
Class for storing model, its restraints, constraints, and particles.
Do not allow two particles to be in the same state.
Store a list of ParticleIndexPairs.
Apply a function to the distance to a fixed point.
A decorator for a particle with x,y,z coordinates.
void set_log_level(LogLevel l)
Set the current global log level.
Basic functionality that is expected to be used by a wide variety of IMP users.
Applies a PairScore to each Pair in a list.
Divide-and-conquer inferential optimization in discrete space.