13 "An optimizer state which prints out the last scores of some restraints"
15 def __init__(self, rs):
16 super().__init__(rs[0].get_model(),
"MyOptimizerState%1%")
21 print(r.get_name(), r.get_last_score())
28r0 = IMP._ConstRestraint(m, [], 1)
29r0.set_name(
"restraint 0")
31r1 = IMP._ConstRestraint(m, [], 2)
32r1.set_name(
"restraint 1")
35sf = rs.create_scoring_function()
37os = MyOptimizerState([r0, r1])
38os.set_name(
"Python optimizer state")
40co = IMP._ConstOptimizer(m)
41co.set_scoring_function(sf)
42co.add_optimizer_state(os)
43print(co.optimize(100))
46co.remove_optimizer_state(os)
Class for storing model, its restraints, constraints, and particles.
Shared optimizer state that is invoked upon commitment of new coordinates.
Object used to hold a set of restraints.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.