54 std::string_view aDesc,
55 const std::vector< int >&
domain) :
58 for (
const auto value:
domain) {
61 "Value '" << value <<
"' is not allowed for variable " <<
toString())
73 std::string_view aDesc,
82 double step = (last - first) /
double(nb - 1);
85 "With nb=" << nb <<
", increment is less (or equal) than 1 ! (" << step <<
")")
91 double current = first;
92 for (
Idx i = 1; i < nb - 1; i++) {
110 for (
Idx i = 1; i < size; ++i)
111 s += std::format(
"|{}",
_domain_[i]);
Exception base for argument error.
Exception : default in label.
DiscreteVariable(std::string_view aName, std::string_view aDesc)
Default constructor.
std::string toString() const
string version of *this
std::vector< int > _domain_
the domain of the variable
Size domainSize() const override
returns the domain size of the discrete random variable
bool isValue(int value) const
does this value exist in the domain ?
IntegerVariable(std::string_view aName, std::string_view aDesc="")
constructor
std::string domain() const override
Returns the domain as a string.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Base class for integer discrete random variables.
Base class for Integer discrete random variables.
gum is the global namespace for all aGrUM entities