25 template <
class Model>
29 typedef boost::function1<void, double> Set_temperature_callback;
45 const Model& initial_state,
46 double initial_log_target) :
47 Base(initial_state, initial_log_target),
51 template <
class StepType>
56 boost::shared_ptr<StepType> tmp(
new StepType(step));
61 template <
class StepType>
69 template <
class StepType>
70 void add_annealing_step(
const boost::shared_ptr<StepType>& step,
double prob,
const std::string& name =
"")
74 step->set_temperature(temperature_);
76 m_temperature_setters.push_back(boost::bind(&StepType::set_temperature, step.get(), _1));
84 m_temperature_setters.push_back(cb);
106 if(temperature_ == temperature)
return;
108 temperature_ = temperature;
109 for(
size_t i = 0;
i < m_temperature_setters.size();
i++)
111 m_temperature_setters[
i](temperature_);
115 std::vector<Set_temperature_callback> m_temperature_setters;
120 template <
class Proposer,
class Model>
150 template<typename Model, typename Proposer = typename Mh_model_proposer<Model>::Type >
160 Base(log_target, proposer)
179 Base::operator=(step);
Annealing_proposer_wrapper(const Proposer &p)
Definition: sample_annealing.h:126
Definition: sample_annealing.h:151
Definition: sample_annealing.h:121
Annealing_mh_step & operator=(const Annealing_mh_step< Model, Proposer > &step)
Assignment.
Definition: sample_annealing.h:177
void add_step(const StepType &step, double prob, const std::string &name="")
Add a new step with associated probability. This does NOT make sure probabilities add up to 1...
Definition: sample_sampler.h:364
Definition: sample_concept.h:60
Proposer Proposer
Definition: sample_step.h:225
Indicates the result of an MH proposal. It is simply a pair of probabilities, forward and backward...
Definition: sample_base.h:334
Annealing_mh_step(const Annealing_mh_step< Model, Proposer > &step)
Copy-constructor.
Definition: sample_annealing.h:168
Annealing_mh_step(const Target_distribution &log_target, const Proposer &proposer)
Definition: sample_annealing.h:159
Definition: sample_step.h:219
void set_temperature(double temperature)
Definition: sample_annealing.h:104
void set_temperature(double T)
Definition: sample_step.h:333
Mh_proposal_result operator()(const Model &in, Model &out) const
Definition: sample_annealing.h:130
Annealing_sampler(const Model &initial_state, double initial_log_target)
Definition: sample_annealing.h:44
void add_temperature_changed_callback(const boost::function1< void, double > &cb)
Add an arbitrary function to be called when temperature changes.
Definition: sample_annealing.h:82
Definition: sample_sampler.h:281
void set_temperature(double t)
Definition: sample_annealing.h:136
void add_annealing_step(StepType *step, double prob, const std::string &name="")
Definition: sample_annealing.h:62
Parent::Target_distribution Target_distribution
Definition: sample_step.h:224
void add_annealing_step(const boost::shared_ptr< StepType > &step, double prob, const std::string &name="")
Definition: sample_annealing.h:70
Proposer m_proposer
Definition: sample_step.h:355
Definition: sample_concept.h:161
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
Definition: sample_sampler.h:284
void add_annealing_step(const StepType &step, double prob, const std::string &name="")
Definition: sample_annealing.h:52
void set_temperature(double T)
Definition: sample_annealing.h:185
BOOST_CONCEPT_ASSERT((BaseModel< Model >))
BOOST_CONCEPT_ASSERT((ModelProposer< Proposer, Model >))
Definition: sample_annealing.h:26