IMP  2.3.0
The Integrative Modeling Platform
gsl/simplex.py

The IMP::gsl::Simplex optimizer is a local optimizer that does not require derivatives.

1 ## \example gsl/simplex.py
2 # The IMP::gsl::Simplex optimizer is a local optimizer that does not
3 # require derivatives.
4 
5 import IMP
6 import IMP.test
7 import IMP.core
8 import IMP.gsl
9 import IMP.algebra
10 
11 
12 m = IMP.kernel.Model()
13 
14 # create two particles to optimize
19 d0.set_coordinates_are_optimized(True)
20 d1.set_coordinates_are_optimized(True)
21 
22 # restrain their distance to be 1
24 m.add_restraint(dist)
25 
26 opt = IMP.gsl.Simplex(m)
27 opt.set_minimum_size(.000001)
28 opt.set_initial_length(1)
29 
30 # probably more steps than are needed
31 e = opt.optimize(1000000)
32 print IMP.core.get_distance(d0, d1)