8 #ifndef IMPCORE_MONTE_CARLO_H
9 #define IMPCORE_MONTE_CARLO_H
11 #include "core_config.h"
18 #include <IMP/internal/container_helpers.h>
22 #include <boost/random/uniform_real.hpp>
24 IMPCORE_BEGIN_NAMESPACE
51 void set_return_best(
bool tf) {
61 void set_kt(
Float t) {
65 Float get_kt()
const {
71 double get_last_accepted_energy()
const {
77 double get_best_accepted_energy()
const {
79 <<
" requires return best being on.");
89 void set_move_probability(
Float p) {
93 double get_move_probability()
const {
100 unsigned int get_number_of_forward_steps()
const {
101 return stat_forward_steps_taken_;
104 unsigned int get_number_of_upward_steps()
const {
105 return stat_upward_steps_taken_;
114 void set_maximum_difference(
double d) {
118 double get_maximum_difference()
const {
119 return max_difference_;
129 {obj->set_optimizer(
this);
130 obj->set_was_used(
true);
131 },{},{obj->set_optimizer(
nullptr);});
143 void set_incremental_scoring_function(IncrementalScoringFunction *isf);
144 bool get_use_incremental_scoring_function()
const {
147 IncrementalScoringFunction* get_incremental_scoring_function()
const {
156 bool do_accept_or_reject_move(
double score,
double last);
157 bool do_accept_or_reject_move(
double score)
159 return do_accept_or_reject_move(score, get_last_accepted_energy());
162 ParticlesTemp do_move(
double probability);
164 virtual void do_step();
178 virtual double do_evaluate(
const ParticlesTemp &moved)
const {
181 isf_->set_moved_particles(moved);
183 if (get_maximum_difference() < NO_MAX) {
185 ->evaluate_if_below(
false, last_energy_+max_difference_);
195 double max_difference_;
197 unsigned int stat_forward_steps_taken_;
198 unsigned int stat_upward_steps_taken_;
199 unsigned int stat_num_failures_;
202 ::boost::uniform_real<> rand_;
204 Pointer<IncrementalScoringFunction> isf_;
210 class IMPCOREEXPORT MonteCarloWithLocalOptimization:
public MonteCarlo
213 unsigned int num_local_;
215 MonteCarloWithLocalOptimization(Optimizer *opt,
218 unsigned int get_number_of_steps()
const {
222 Optimizer* get_local_optimizer()
const {
237 class IMPCOREEXPORT MonteCarloWithBasinHopping:
238 public MonteCarloWithLocalOptimization
241 MonteCarloWithBasinHopping(Optimizer *opt,
unsigned int ns);
247 IMPCORE_END_NAMESPACE