Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

GreedySampler Class Reference

Iteratively samples over a one dimensional numeric region by subdividing the largest unsampled region. More...

#include <GreedySampler.h>


Detailed Description

Iteratively samples over a one dimensional numeric region by subdividing the largest unsampled region.

This could be implemented 'closed form' to compute the samples iteratively without explicitly storing the regions, but one of the goals of this class is to 'seed' the initial samples based on domain-specific heuristics, and then use the sampler to pick any additional samples to explore the remaining space efficiently.

Definition at line 14 of file GreedySampler.h.

List of all members.

Classes

struct  range

Public Member Functions

 GreedySampler (float min, float max, bool circ)
 Construct with the range to be sampled, and mark if the range is circular.
float sample ()
 Subdivides the largest region, returns the midpoint.
float resolution ()
 returns the span of the largest unsampled region
void remove (float x)
 Informs the sampler of an externally taken sample.
void reset ()
 remove sampled points, start fresh sampling
void reset (float min, float max, bool circ)
 remove sampled points, start fresh sampling

Protected Member Functions

float normalize (float x)
 assumes a circular range, puts x in the range which is being sampled (full) not the requested (reqMin)

Protected Attributes

range full
 the range being sampled (may differ from reqMin for circular regions with initial samples removed)
float reqMin
 requested output range (may differ from full.min for circular regions with initial samples removed)
std::vector< rangeranges
 stores the unsampled regions
bool circular
 if true, affects initialization and first sample, also causes remove to normalize its argument

Friends

std::ostream & operator<< (std::ostream &os, const GreedySampler &gs)
 output for debugging, displays regions in the heap

Constructor & Destructor Documentation

GreedySampler::GreedySampler ( float  min,
float  max,
bool  circ 
)

Construct with the range to be sampled, and mark if the range is circular.

Definition at line 17 of file GreedySampler.h.


Member Function Documentation

float GreedySampler::normalize ( float  x  )  [protected]

assumes a circular range, puts x in the range which is being sampled (full) not the requested (reqMin)

Definition at line 83 of file GreedySampler.cc.

Referenced by remove().

void GreedySampler::remove ( float  x  ) 

Informs the sampler of an externally taken sample.

If using a circular region, x will be internally normalized for processing, but it is still more efficient to pass a 'close' value

Definition at line 35 of file GreedySampler.cc.

void GreedySampler::reset ( float  min,
float  max,
bool  circ 
)

remove sampled points, start fresh sampling

Definition at line 74 of file GreedySampler.cc.

void GreedySampler::reset (  ) 

remove sampled points, start fresh sampling

Definition at line 67 of file GreedySampler.cc.

float GreedySampler::resolution (  ) 

returns the span of the largest unsampled region

Definition at line 27 of file GreedySampler.cc.

float GreedySampler::sample (  ) 

Subdivides the largest region, returns the midpoint.

Definition at line 6 of file GreedySampler.cc.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const GreedySampler gs 
) [friend]

output for debugging, displays regions in the heap

Definition at line 105 of file GreedySampler.cc.


Member Data Documentation

bool GreedySampler::circular [protected]

if true, affects initialization and first sample, also causes remove to normalize its argument

Definition at line 54 of file GreedySampler.h.

Referenced by GreedySampler(), remove(), and reset().

the range being sampled (may differ from reqMin for circular regions with initial samples removed)

Definition at line 51 of file GreedySampler.h.

Referenced by GreedySampler(), normalize(), remove(), reset(), resolution(), and sample().

std::vector<range> GreedySampler::ranges [protected]

stores the unsampled regions

Definition at line 53 of file GreedySampler.h.

Referenced by GreedySampler(), operator<<(), remove(), reset(), resolution(), and sample().

requested output range (may differ from full.min for circular regions with initial samples removed)

Definition at line 52 of file GreedySampler.h.

Referenced by reset(), and sample().


The documentation for this class was generated from the following files:

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:09 2016 by Doxygen 1.6.3