IMP  2.0.1
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 require derivatives.
3 
4 import IMP, IMP.test
5 import IMP.core
6 import IMP.gsl
7 import IMP.algebra
8 
9 
10 m= IMP.Model()
11 
12 # create two particles to optimize
15 d0.set_coordinates_are_optimized(True)
16 d1.set_coordinates_are_optimized(True)
17 
18 # restrain their distance to be 1
20 m.add_restraint(dist)
21 
22 opt = IMP.gsl.Simplex(m)
23 opt.set_minimum_size(.000001)
24 opt.set_initial_length(1)
25 
26 # probably more steps than are needed
27 e = opt.optimize(1000000)
28 print IMP.core.get_distance(d0, d1)