Class observe::Windowed
Windowed observable.
This creates a "windowed" version of any observable such that the current state of the contained observable always reflects the last window_size
values recorded. This is implemented by keeping track of the recorded values in the queue and removing them when the window_size
is exceeded.
Note
The window_size
is implemented as a weight; if all your recorded values have a weight of 1, this translates to window_size
observables being tracked; if they differ it can be more or less, accordingly.
Inherited Members
Constructors
Windowed()
Declaration
observe::Windowed::Windowed(std::unique_ptr<Observable>&&observable, double window_size)
Windowed()
Declaration
observe::Windowed::Windowed(const Windowed&)=delete
Methods
operator=()
Declaration
Windowed&observe::Windowed::operator=(const Windowed&)=delete
reset()
Declaration
void observe::Windowed::reset() override
record()
Declaration
void observe::Windowed::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::Windowed::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