A Monte Carlo optimizer.
The optimizer uses a set of Mover objects to propose steps. Currently each Mover is called at each Monte Carlo iteration. If you only want to use one mover at a time, use a SerialMover. The movers propose some modification, which is then accepted or rejected based on the Metropolis criterion. Optionally, a number of local optimization steps are taken before the MonteCarlo step is accepted or rejected.
By default, the lowest score state encountered is returned.
Examples: display log, dock with crosslinks, optimize balls
Inheritance diagram for IMP::core::MonteCarlo:Public Member Functions | |
| MonteCarlo (Model *m=nullptr) | |
| double | get_average_number_of_incremental_restraints () const |
| Return the average number of restraints per evaluate. | |
| double | get_best_accepted_energy () const |
| double | get_last_accepted_energy () const |
| double | get_maximum_difference () const |
| double | get_move_probability () const |
| void | set_maximum_difference (double d) |
| void | set_move_probability (Float p) |
| Set the probability of each move being made. | |
| void | set_return_best (bool tf) |
Static Public Member Functions | |
| static MonteCarlo * | get_from (IMP::base::Object *o) |
kT | |
The kT value has to be on the same scale as the differences in energy between good and bad states (and so the default is likely to not be a good choice). | |
| void | set_kt (Float t) |
| Float | get_kt () const |
Statistics | |
| unsigned int | get_number_of_forward_steps () const |
| Return how many times the optimizer has succeeded in taking a step. | |
| unsigned int | get_number_of_upward_steps () const |
| Return how many times the optimizer has stepped to higher energy. | |
Movers | |
The following methods are used to manipulate the list of Movers. Each mover is called at each optimization step, giving it a chance to change the current configuration. | |
| void | remove_mover (Mover *d) |
| template<class F > | |
| void | remove_movers_if (const F &f) |
| template<class List > | |
| void | remove_movers (List d) |
| template<class List > | |
| void | set_movers (List ps) |
| template<class List > | |
| void | set_movers_order (List ps) |
| unsigned int | add_mover (Mover *obj) |
| template<class List > | |
| void | add_movers (List objs) |
| void | clear_movers () |
| unsigned int | get_number_of_movers () const |
| bool | get_has_movers () const |
| Mover * | get_mover (unsigned int i) const |
| Movers | get_movers () const |
| void | reserve_movers (unsigned int sz) |
| MoverIterator | movers_begin () |
| MoverIterator | movers_end () |
| MoverConstIterator | movers_begin () const |
| MoverConstIterator | movers_end () const |
Incremental | |
Efficient evaluation of non-bonded list based restraints is a bit tricky with incremental evaluation. To aid this, we offer a temporary solution where by you give a PairScore and a display upper bound (on the centers for the time being) to the MC object. It will then make sure this is applied properly. | |
| void | set_use_incremental_evaluate (bool tf) |
| bool | get_use_incremental_evaluate () const |
| void | set_close_pair_score (PairScore *ps, double distance, const ParticlesTemp &particles, const PairFilters &filters) |
| This is experimental and unstable. | |
Protected Member Functions | |
| bool | do_accept_or_reject_move (double score, double last) |
| bool | do_accept_or_reject_move (double score) |
| virtual double | do_evaluate (const ParticlesTemp &moved) const |
| Get the current energy. | |
| ParticlesTemp | do_move (double probability) |
| virtual void | do_step () |
| a class that inherits from this should override this method | |
| double | evaluate_non_bonded (const ParticleIndexes &moved) const |
| Only for incremental evaluation. | |
| bool IMP::core::MonteCarlo::do_accept_or_reject_move | ( | double | score, |
| double | last | ||
| ) | [protected] |
Note that if return best is true, this will save the current state of the model. Also, if the move is accepted, the optimizer states will be updated.
| virtual double IMP::core::MonteCarlo::do_evaluate | ( | const ParticlesTemp & | moved | ) | const [protected, virtual] |
Get the current energy.
By default it just calls Optimizer::evaluate() if there is no maximum allowed difference or Optimizer::evaluate_if_below() if there is. Classes which override this method should be similarly aware for efficiency.
The list of moved particles is passed.
Reimplemented in IMP::isd::HybridMonteCarlo.
| virtual void IMP::core::MonteCarlo::do_step | ( | ) | [protected, virtual] |
a class that inherits from this should override this method
| double IMP::core::MonteCarlo::evaluate_non_bonded | ( | const ParticleIndexes & | moved | ) | const [protected] |
Only for incremental evaluation.
| double IMP::core::MonteCarlo::get_average_number_of_incremental_restraints | ( | ) | const |
Return the average number of restraints per evaluate.
| double IMP::core::MonteCarlo::get_best_accepted_energy | ( | ) | const |
If return best is on, you can get the best energy found so far.
| double IMP::core::MonteCarlo::get_last_accepted_energy | ( | ) | const |
Return the energy of last accepted state.
| unsigned int IMP::core::MonteCarlo::get_number_of_forward_steps | ( | ) | const |
Return how many times the optimizer has succeeded in taking a step.
| unsigned int IMP::core::MonteCarlo::get_number_of_upward_steps | ( | ) | const |
Return how many times the optimizer has stepped to higher energy.
| void IMP::core::MonteCarlo::set_close_pair_score | ( | PairScore * | ps, |
| double | distance, | ||
| const ParticlesTemp & | particles, | ||
| const PairFilters & | filters | ||
| ) |
This is experimental and unstable.
| void IMP::core::MonteCarlo::set_maximum_difference | ( | double | d | ) |
Computations can be acceletating by throwing out the tails of the distribution of accepted moves. To do this, specific a maximum acceptable difference between the before and after scores.
| void IMP::core::MonteCarlo::set_move_probability | ( | Float | p | ) |
Set the probability of each move being made.
Make this low if the space is rough and there are many particles. The movers should make each individual move with this probability. That is, a NormalMover with 100 particles will move each particle with probability p.
| void IMP::core::MonteCarlo::set_return_best | ( | bool | tf | ) |
By default, the optimizer returns the lowest score state found so far. If, instead, you wish to return the last accepted state, set return best to false.
| void IMP::core::MonteCarlo::set_use_incremental_evaluate | ( | bool | tf | ) |
Set whether to use incremental evaluate or evaluate all restraints each time. This cannot be changed during optimization.