29#ifndef __BASE_DUELING_HH__
30#define __BASE_DUELING_HH__
90 bool isSample(uint64_t
id,
bool& team)
const;
167 DuelingMonitor(std::size_t constituency_size, std::size_t team_size = 1,
168 unsigned num_bits = 10,
double low_threshold = 0.5,
169 double high_threshold = 0.5);
A dueler is an entry that may or may not be accounted for sampling.
virtual ~Dueler()=default
uint64_t _team
If entry is a sample, it belongs to one of two possible teams.
void setSample(uint64_t id, bool team)
Make this entry a sampling entry for a specific Dueling instance.
bool isSample(uint64_t id, bool &team) const
Check if entry is a sample for the given instance.
uint64_t _isSample
Whether this entry is a sample or a follower.
Dueler()
By default initializes entries as followers.
Duel between two sampled options to determine which is the winner.
~DuelingMonitor()=default
const std::size_t constituencySize
Given a table containing X entries, a constituency is a region of the table such that it contains X/c...
const uint64_t id
Unique identifier of this instance.
int regionCounter
Counts the number of entries have been initialized in the current constituency.
SatCounter32 selector
Counter that determines which dueler is winning.
const std::size_t teamSize
Number of entries that belong to each team within a constituency.
bool winner
The team that is currently winning.
bool getWinner() const
Get the team that is currently winning the duel.
bool isSample(const Dueler *dueler, bool &team) const
Check if the given dueler is a sample for this instance.
void sample(const Dueler *dueler)
If given dueler is a sampling entry, sample it and check if the winning team must be updated.
const double lowThreshold
If the winning team was "True", and the counter is decreased further than this threshold,...
static unsigned numInstances
Number of times this class has been instantiated.
DuelingMonitor(std::size_t constituency_size, std::size_t team_size=1, unsigned num_bits=10, double low_threshold=0.5, double high_threshold=0.5)
const double highThreshold
If the winning team was "False", and the counter is increased further than this threshold,...
void initEntry(Dueler *dueler)
Initialize a dueler entry, deciding wether it is a sample or not.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.