Domain

class pqp.data.Domain

Bases: ABC

Manages the possible values that a Variable can take on

Methods Summary

describe_assumptions()

Returns a human readable description of assumptions made about the domain

get_cardinality()

The number of possible values a variable can take on

validate(values)

Validates that a list of values is in the domain

validate_or_throw(values)

Validates that a list of values is in the domain, throws an error if not

Methods Documentation

abstract describe_assumptions()

Returns a human readable description of assumptions made about the domain

abstract get_cardinality()

The number of possible values a variable can take on

validate(values)

Validates that a list of values is in the domain

Parameters:

values (list) – a list of values to validate

Returns:

True if all values are in the domain, False otherwise

Return type:

bool

validate_or_throw(values)

Validates that a list of values is in the domain, throws an error if not

Parameters:

values (list) – a list of values to validate

Raises:

ValueError – if any value is not in the domain