ConsoleUser
Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com
This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.
All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.
- class ChooserBase.ChooserBase(dist, args, seed, config)¶
This is an abstract class that provides setup for managing the distribution that will inform choices. Subclasses will have to decide what to do with those values.
Parameters:
dist: the name of the distrbution to use
args: a tuple of any arguments the distribution needs during initialization
seed: the seed to give to the random number generator
- get_all_choices()¶
Return a set of all the potential choices, regardless of how likely each is.
- next_choice()¶
Return: the next choice
- num_choices()¶
Return the number of possible choices this instance might consider.
- set_dist(dist, args=None, seed=None)¶
Set the distribution for this chooser to be of the given type, if args and seed are both None and dist is a string that contains commas it will be split on comma to get the args
Parameters:
dist: the name of the distrbution to use
args: a tuple of any arguments the distribution needs during initialization
seed: the seed to give to the random number generator
- set_logger(logger)¶
Set the logger that should be used by this instance. This is expected to be a subclass of <no title>
Parameters:
logger: an instance of <no title> to write messages to
- set_seed(seed)¶
Set the seed for the underlying distribution to the correct value
Parameters:
seed: the new seed to use
- ChooserBase.test()¶
Run a simple unittest to make sure all the implemented functions work