Class for storing model, its restraints, constraints, and particles.
The Model maintains a standard IMP container for each of Particle, ScoreState and Restraint object types.
Inheritance diagram for IMP::Model:Public Member Functions | |
| Model (std::string name="The Model") | |
| void | remove_particle (Particle *p) |
| Remove the particle from this model. | |
| void | restore_particle (Particle *p) |
| Sometimes it is useful to put a particle back into a model. | |
Filtering | |
We are typically only interested in "good" conformations of the model. These are described by specifying maximum scores per restraint (Restraint::set_maximum_score()) and for the whole model. Samplers, optimizers etc are free to ignore configurations they encounter which go outside these bounds. | |
| void | set_maximum_score (double s) |
| double | get_maximum_score () const |
| bool | get_has_good_score () const |
| Return true if thelast evaluate satisfied the thresholds. | |
Methods to debug particles | |
It is sometimes useful to inspect the list of all particles when debugging. These methods allow you to do that.
The value type for the iterators is a Particle*. | |
| unsigned int | get_number_of_particles () const |
| ParticleIterator | particles_begin () |
| ParticleIterator | particles_end () |
| ParticleConstIterator | particles_begin () const |
| ParticleConstIterator | particles_end () const |
Float Attribute Ranges | |
Each Float attribute has an associated range which reflects the range of values that it is expected to take on during optimization. The optimizer can use these ranges to make the optimization process more efficient. By default, the range estimates are simply the range of values for that attribute in the various particles, but it can be set to another value. For example, an attribute storing an angle could have the range set to (0,PI). The ranges are not enforced; they are just guidelines. In order to enforce ranges, see, for example, IMP::example::ExampleSingletonModifier. | |
| FloatRange | get_range (FloatKey k) const |
| void | set_range (FloatKey k, FloatRange range) |
Evaluation | |
Evaluation proceeds as follows:
All evaluate calls throw a ModelException if a Particle attribute value becomes invalid (NaN, infinite etc.) | |
| virtual double | evaluate (bool calc_derivs) |
| Evaluate all of the restraints in the model and return the score. | |
| void | update () |
| Sometimes it is useful to be able to make sure the model is up to date. | |
Incremental Updates | |
Control whether incremental updates are being used. See the incremental updates page for a more detailed description. | |
| void | set_is_incremental (bool tf) |
| bool | get_is_incremental () const |
Statistics | |
The Model can gather various statistics about the restraints and score states used. To use this feature, first turn on statistics gather and then run your optimization (or just call evaluate).
| |
| void | clear_all_statistics () |
| void | set_gather_statistics (bool tf) |
| void | show_all_statistics (std::ostream &out=std::cout) const |
| void | show_restraint_time_statistics (std::ostream &out=std::cout) const |
| void | show_restraint_score_statistics (std::ostream &out=std::cout) const |
| void | show_score_state_time_statistics (std::ostream &out=std::cout) const |
States | |
The Model stores a list of ScoreStates which are given an opportunity to update the stored Particles and their internal state before and after the restraints are evaluated. Use the methods below to manipulate the list of ScoreState objects.The value type for the iterators is a ScoreState*.
| |
| void | remove_score_state (ScoreState *d) |
| template<class F > | |
| void | remove_score_states_if (const F &f) |
| void | remove_score_states (const ScoreStates &d) |
| void | set_score_states (const ScoreStates &ps) |
| void | set_score_states_order (const ScoreStates &ps) |
| unsigned int | add_score_state (ScoreState *obj) |
| void | add_score_states (const ScoreStates &obj) |
| void | clear_score_states () |
| unsigned int | get_number_of_score_states () const |
| bool | get_has_score_states () const |
| ScoreState * | get_score_state (unsigned int i) const |
| void | reserve_score_states (unsigned int sz) |
| ScoreStateIterator | score_states_begin () |
| ScoreStateIterator | score_states_end () |
| ScoreStateConstIterator | score_states_begin () const |
| ScoreStateConstIterator | score_states_end () const |
Restraints | |
| The Model scores the current configuration using the stored Restraint objects. Use the methods below to manipulate the list.The value type for the iterators is a Restraint*. | |
|
typedef RestraintSet::RestraintIterator | RestraintIterator |
|
typedef RestraintSet::RestraintConstIterator | RestraintConstIterator |
| void | add_restraint (Restraint *r) |
| void | remove_restraint (Restraint *r) |
| unsigned int | get_number_of_restraints () const |
| Restraint * | get_restraint (unsigned int i) const |
| RestraintIterator | restraints_begin () |
| RestraintIterator | restraints_end () |
| RestraintConstIterator | restraints_begin () const |
| RestraintConstIterator | restraints_end () const |
| double | get_weight (Restraint *r) const |
| RestraintSet * | get_root_restraint_set () const |
| IMP::Model::Model | ( | std::string | name = "The Model" | ) |
Construct an empty model
| virtual double IMP::Model::evaluate | ( | bool | calc_derivs | ) | [virtual] |
Evaluate all of the restraints in the model and return the score.
| [in] | calc_derivs | If true, also evaluate the first derivatives. |
| bool IMP::Model::get_has_good_score | ( | ) | const |
Return true if thelast evaluate satisfied the thresholds.
Currently this ignores maximum scores on restraint sets. Sorry.
| void IMP::Model::remove_particle | ( | Particle * | p | ) |
Remove the particle from this model.
Since particles are ref counted the object will still be valid until all references are removed, however attributes of removed particles cannot be changed or inspected.
| void IMP::Model::restore_particle | ( | Particle * | p | ) |
Sometimes it is useful to put a particle back into a model.
When restoring the state of a Model, it is useful to be able to restore a particle back to the model it used to be part of.
| void IMP::Model::set_is_incremental | ( | bool | tf | ) |
Turn on or off incremental evaluation.
| void IMP::Model::update | ( | ) |
Sometimes it is useful to be able to make sure the model is up to date.
This method updates all the state but does not necessarily compute the score.