Class observe::Batched
Batched observable.
This creates a "batched" version of any observable which records a timeline with batches of size batch_size
. I.e., after a total weight of batch_size
has been recorded, the observable is rendered to the timeline of batches and the observable itself is reset.
Example: Batched(BinWidthDistribution(0.2), 1000) records the evolution of a histogram:
- 1000 values are recorded into each histogram
- the histogram is grouped into bins of width 0.2
- after each 1000, the histogram is stored and a new one started.
Inherited Members
Constructors
Batched()
Declaration
observe::Batched::Batched(std::unique_ptr<Observable>&&observable, double batch_size)
Batched()
Declaration
observe::Batched::Batched(Observable *observable, double batch_size)
Batched()
Declaration
observe::Batched::Batched(const Batched&)=delete
Methods
operator=()
Declaration
Batched&observe::Batched::operator=(const Batched&)=delete
reset()
Declaration
void observe::Batched::reset() override
record()
Declaration
void observe::Batched::record(double value, double weight) override
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
Structure observe::Batched::render() const override
record()
Declaration
void observe::Observable::record(double value)
record()
Declaration
void observe::Observable::record(int value)
record()
Declaration
void observe::Observable::record(size_t value)
record()
Declaration
virtual void observe::Observable::record(double value, double weight)=0