#include <Roulette.h>
Public Member Functions | |
Roulette () | |
Default constructor. | |
Roulette (const Roulette &r) | |
Copy constructor. | |
const Roulette & | operator= (const Roulette &r) |
Assignment operator =. | |
void | setCapacity (int s) |
Sets number of Pockets of the Roulette. | |
void | addPocket (Pocket p) |
Add a pocket to the Roulette. | |
int | getNumPockets () const |
Gets the number of Pockets in the Roulette. | |
int | getSumPockets () const |
Gets the sum of the weights of the Pockets in the Roulette. | |
bool | weigthedExtraction (int &extracted, bool rep=true) |
Perform an extraction with probability of Pockets proportional to weights. | |
bool | unweigthedExtraction (int &extracted, bool rep=true) |
Perform an extraction with all Pockets with same probability. | |
void | resetRepetitions () |
Reset the repetitions in the extraction without repetition. | |
void | clearAll () |
Erase all pockets. | |
string | print () |
Print function. |
MipBaselib::Roulette::Roulette | ( | ) |
Default constructor.
MipBaselib::Roulette::Roulette | ( | const Roulette & | r | ) |
Copy constructor.
void MipBaselib::Roulette::setCapacity | ( | int | s | ) |
Sets number of Pockets of the Roulette.
void MipBaselib::Roulette::addPocket | ( | p | ) |
int MipBaselib::Roulette::getNumPockets | ( | ) | const |
int MipBaselib::Roulette::getSumPockets | ( | ) | const |
bool MipBaselib::Roulette::weigthedExtraction | ( | int & | extracted, | |
bool | rep = true | |||
) |
Perform an extraction with probability of Pockets proportional to weights.
[out] | &extracted | value in the extracted Pocket. |
[in] | rep | Allow repetitions if true. |
bool MipBaselib::Roulette::unweigthedExtraction | ( | int & | extracted, | |
bool | rep = true | |||
) |
Perform an extraction with all Pockets with same probability.
[out] | &extracted | value in the extracted Pocket. |
[in] | rep | Allow repetitions if true. |
void MipBaselib::Roulette::resetRepetitions | ( | ) |
Reset the repetitions in the extraction without repetition.
void MipBaselib::Roulette::clearAll | ( | ) |
Erase all pockets.
string MipBaselib::Roulette::print | ( | ) |
Print function.