The Optimizer maintains a list of OptimizerStates which are updated each time the conformation is changed.
The optimizers have one key method Optimizer::optimize() which takes the number of steps to perform. The optimizers can have other stopping conditions as appropriate.
A typical optimization loop proceeds by:
Public Member Functions | |
def | __del__ |
def | __disown__ |
Model * | get_model () const |
Get the model being optimized. | |
virtual VersionInfo | get_version_info () const =0 |
virtual Float | optimize (unsigned int max_steps)=0 |
Optimizer (Model *m=NULL, std::string name="Optimizer %1%") | |
void | set_model (Model *m) |
Set the model being optimized. | |
virtual void | show (std::ostream &out=std::cout) const |
Print info about the optimizer state. | |
States | |
The stored OptimizerState objects are updated each time the Optimizer decides to accept a new configuration of the Model. To manipulate the list of optimizer states use the methods below. | |
unsigned int | add_optimizer_state (OptimizerState *obj) |
void | add_optimizer_states (const OptimizerStates &obj) |
void | clear_optimizer_states () |
bool | get_has_optimizer_states () const |
return true if there are any objects in the container | |
unsigned int | get_number_of_optimizer_states () const |
OptimizerState * | get_optimizer_state (unsigned int i) const |
OptimizerStateConstIterator | optimizer_states_begin () const |
OptimizerStateIterator | optimizer_states_begin () |
OptimizerStateConstIterator | optimizer_states_end () const |
OptimizerStateIterator | optimizer_states_end () |
void | remove_optimizer_state (OptimizerState *d) |
Remove any occurences of d from the container. | |
void | remove_optimizer_states (const OptimizerStates &d) |
Remove any occurences of each item in d. | |
template<class F > | |
void | remove_optimizer_states_if (const F &f) |
Remove any occurrences for which f is true. | |
void | reserve_optimizer_states (unsigned int sz) |
void | set_optimizer_states (const OptimizerStates &ps) |
Protected Types | |
typedef std::vector< FloatIndex > | FloatIndexes |
Protected Member Functions | |
void | update_states () const |
Update optimizer state, should be called at each successful step. | |
double | width (FloatKey k) const |
Methods to get and set scaled optimizable values | |
Certain optimizers benefit from having all the optimized values scaled to vary over a similar range. These accessors use the Model::get_range ranges to scale the values before returning them and unscale them before setting them. | |
void | clear_range_cache () |
Clear the cache of range information. Do this at the start of optimization. | |
double | get_scaled_derivative (FloatIndex fi) const |
double | get_scaled_value (FloatIndex fi) const |
void | set_scaled_value (FloatIndex fi, Float v) const |
Methods for getting and setting optimized attributes | |
Optimizers don't have to go through the particles themselves looking for values to optimize unless they care about special properties of the optimized values. Instead they can iterate through the list of optimized attributes, each of which is identified by a FloatIndex. With these FloatIndex objects they can get and set the values and derivatives as needed. | |
FloatIndexIterator | float_indexes_begin () const |
FloatIndexIterator | float_indexes_end () const |
Float | get_derivative (FloatIndex fi) const |
Float | get_value (FloatIndex fi) const |
void | set_value (FloatIndex fi, Float v) const |
Package Attributes | |
__pad0__:VectorStorage<internal::FloatAttributeTableTraits> FloatTable | |
WeakPointer< Model > | model_ |
FloatTable | widths_ |
Friends | |
template<class T > | |
void | IMP::internal::unref (T *) |
Related Functions | |
(Note that these are not member functions.) | |
IMP_OPTIMIZER(Name) | |
Define the basic things you need for an Optimizer. |
unsigned int IMP::Optimizer::add_optimizer_state | ( | OptimizerState * | obj | ) |
void IMP::Optimizer::add_optimizer_states | ( | const OptimizerStates & | obj | ) |
Add several objects to the container. They are not necessarily added at the end.
OptimizerState* IMP::Optimizer::get_optimizer_state | ( | unsigned int | i | ) | const |
Get the object refered to by the index
IndexException | in Python if the index is out of range |
virtual VersionInfo IMP::Optimizer::get_version_info | ( | ) | const [pure virtual] |
virtual Float IMP::Optimizer::optimize | ( | unsigned int | max_steps | ) | [pure virtual] |
Optimize the model
[in] | max_steps | The maximum number of iterations of the optimizer to perform. Increasing this number will generally make the optimizer spend more time searching for a solution, but beyond that, the details of what changes will vary. |
void IMP::Optimizer::set_model | ( | Model * | m | ) |
Set the model being optimized.
void IMP::Optimizer::set_optimizer_states | ( | const OptimizerStates & | ps | ) |
Set the contents of the container to ps removing all its current contents.
virtual void IMP::Optimizer::show | ( | std::ostream & | out = std::cout |
) | const [virtual] |