While we do not recomment doing serious work using optimizer states written it python, it is often useful when prototyping or testing code. Copy this example and modify as needed.
9 IMP.OptimizerState.__init__(self)
11 self.get_optimizer().get_model().show_restraint_score_statistics()
17 r0=IMP.kernel._ConstRestraint(1)
18 r0.set_name(
"restraint 0")
20 r1=IMP.kernel._ConstRestraint(2)
21 r1.set_name(
"restraint 1")
24 os= MyOptimizerState()
25 os.set_name(
"python optimizer state")
27 co= IMP.kernel._ConstOptimizer(m)
28 co.add_optimizer_state(os)
29 m.set_gather_statistics(
True)
32 print co.optimize(100)
35 co.remove_optimizer_state(os)