Class schedule::Schedule
A schedule maps an input interval to values for parametrization. This can be employed to, e.g.,
- specify a temperature set or schedule (tempering, annealing)
- define how a parameter should evolve over time (substochastic MC)
The schedule can be specified in different forms:
constant
valuelinear
orgeometric
interpolation for a rangeinitial
..final
- By explicitly listing the temperatures as an array
Examples:
- Geometric interpolation of the range
inital
tofinal
:
"schedule": {
"type": "geometric",
"initial": 1.0
"final": 0.3,
}
- 20 steps with equal spacing from
initial
tofinal
:
"schedule": {
"type": "linear",
"initial": 1.0,
"final": 3.0
"count": 20
}
- An explicit set of values:
"schedule": [0.1, 0.2, 0.3, 0.4]
Note
Without a prior call to configure, an object of this class is uninitialized and will throw an access to nullptr exception.
Constructors
Schedule()
Declaration
schedule::Schedule::Schedule()
Schedule()
Declaration
schedule::Schedule::Schedule(const Schedule©)
Methods
~Schedule()
Declaration
virtual schedule::Schedule::~Schedule()
operator=()
Declaration
Schedule&schedule::Schedule::operator=(const Schedule&)=delete
get_value()
Assuming the simulation runs from [0 .. max_steps
] (inclusive), returns the temperature to be used at step
.
Declaration
double schedule::Schedule::get_value(double input) const
get_discretized_values()
Return a set of values for equidistributed inputs over the schedule.
Declaration
std::vector<double>schedule::Schedule::get_discretized_values(int count=-1) const
get_start()
Get the starting input value.
Declaration
double schedule::Schedule::get_start() const
get_stop()
Get the stopping input value.
Declaration
double schedule::Schedule::get_stop() const
get_initial()
Get the initial value (at start)
Declaration
double schedule::Schedule::get_initial() const
get_final()
Get the final value (at stop)
Declaration
double schedule::Schedule::get_final() const
get_count()
Query how many equidistributed inputs this schedule would "naturally" have (for an explicit set of values, this is the length of the array, for a generator it is derived from the (rounded) input range.
Declaration
int schedule::Schedule::get_count() const
set_stop()
Force a specific number of steps to be queried from the schedule.
Declaration
void schedule::Schedule::set_stop(int stop)
configure()
Serialization will instantiate the correct schedule_generator_
according to / the configuration it is passed.
Declaration
void schedule::Schedule::configure(const utils::Json&json) override
make_linear()
Manually create an linear schedule.
Declaration
void schedule::Schedule::make_linear(double initial_value, double final_value)
make_geometric()
Manually create an geometric schedule.
Declaration
void schedule::Schedule::make_geometric(double beta_start, double beta_stop)
make_list()
Declaration
void schedule::Schedule::make_list(const std::vector<double>&values)
make_constant()
Declaration
void schedule::Schedule::make_constant(double value)
render()
render the object in structured form
Return a structured representation of the object. This is intended for output purposes. For instance, the solution your solver finds should have a render method which allows it to be returned as part of the result. Example:
{c++}
MySolution : public Component {
public:
// Represent the internal bool vector as +-1 output.
utils::Structure render() const override {
utils::Structure rendered;
for (bool item : solution_) rendered.push_back(item ? 1 : -1);
return rendered;
}
private:
std::vector<bool> solution_;
}
MySolution solution;
std::cout << solution.render().to_string() << std::endl;
Declaration
utils::Structure schedule::Schedule::render() const override