![]() |
Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
|
Resevoir sampling is based on the 2005 paper "Weighted Random Sampling" by Efraimidis and Spirakis. More...
#include <duckdb.hpp>

Public Member Functions | |
| BaseReservoirSampling (int64_t seed) | |
| void | InitializeReservoirWeights (idx_t cur_size, idx_t sample_size) |
| void | SetNextEntry () |
| void | ReplaceElementWithIndex (idx_t entry_index, double with_weight, bool pop=true) |
| void | ReplaceElement (double with_weight=-1) |
| void | UpdateMinWeightThreshold () |
| void | FillWeights (SelectionVector &sel, idx_t &sel_size) |
| Go from the naive sampling to the reservoir sampling Naive samping will not collect weights, but when we serialize we need to serialize weights again. | |
| unique_ptr< BaseReservoirSampling > | Copy () |
| void | Serialize (Serializer &serializer) const |
Static Public Member Functions | |
| static unique_ptr< BaseReservoirSampling > | Deserialize (Deserializer &deserializer) |
Public Attributes | |
| ReservoirRNG | random |
| The random generator. | |
| idx_t | next_index_to_sample |
| The next element to sample. | |
| double | min_weight_threshold |
| The reservoir threshold of the current min entry. | |
| idx_t | min_weighted_entry_index |
| The reservoir index of the current min entry. | |
| idx_t | num_entries_to_skip_b4_next_sample |
| The current count towards next index (i.e. we will replace an entry in next_index - current_count tuples) The number of entries "seen" before choosing one that will go in our reservoir sample. | |
| idx_t | num_entries_seen_total |
| when collecting a sample in parallel, we want to know how many values each thread has seen so we can collect the samples from the thread local states in a uniform manner | |
| std::priority_queue< std::pair< double, idx_t > > | reservoir_weights |
| Priority queue of [random element, index] for each of the elements in the sample. | |
Friends | |
| class | BlockingSample |
Resevoir sampling is based on the 2005 paper "Weighted Random Sampling" by Efraimidis and Spirakis.
|
explicit |
| duckdb::BaseReservoirSampling::BaseReservoirSampling | ( | ) |
| void duckdb::BaseReservoirSampling::InitializeReservoirWeights | ( | idx_t | cur_size, |
| idx_t | sample_size ) |
1: The first m items of V are inserted into R first we need to check if the reservoir already has "m" elements

| void duckdb::BaseReservoirSampling::SetNextEntry | ( | ) |

| void duckdb::BaseReservoirSampling::ReplaceElementWithIndex | ( | idx_t | entry_index, |
| double | with_weight, | ||
| bool | pop = true ) |
now we insert the new weight into the reservoir
we update the min entry with the new min entry in the reservoir

| void duckdb::BaseReservoirSampling::ReplaceElement | ( | double | with_weight = -1 | ) |
replace the entry in the reservoir pop the minimum entry
now update the reservoir
if we are merging two reservoir samples use the weight passed
now we insert the new weight into the reservoir
we update the min entry with the new min entry in the reservoir

| void duckdb::BaseReservoirSampling::UpdateMinWeightThreshold | ( | ) |
| void duckdb::BaseReservoirSampling::FillWeights | ( | SelectionVector & | sel, |
| idx_t & | sel_size ) |
Go from the naive sampling to the reservoir sampling Naive samping will not collect weights, but when we serialize we need to serialize weights again.

| unique_ptr< BaseReservoirSampling > duckdb::BaseReservoirSampling::Copy | ( | ) |
| void duckdb::BaseReservoirSampling::Serialize | ( | Serializer & | serializer | ) | const |
|
static |