nmmo.task.constraint module#

class nmmo.task.constraint.Constraint(systems=None)#

Bases: ABC

To check the validity of predicates and assist generating new predicates. Similar to gym spaces.

check(config: Config, value)#

Checks value is in bounds given config

abstract sample(config: Config)#

Generator to sample valid values given config

class nmmo.task.constraint.DiscreteConstraint(space, systems=None)#

Bases: Constraint

check(config: Config, value)#

Checks value is in bounds given config

sample(config: Config)#

Generator to sample valid values given config

class nmmo.task.constraint.GroupConstraint(sample_fn=<function GroupConstraint.<lambda>>, systems=None)#

Bases: Constraint

Ensures that all agents of a group exist in a config

check(config, value)#

Checks value is in bounds given config

sample(config)#

Generator to sample valid values given config

exception nmmo.task.constraint.InvalidConstraint#

Bases: Exception

args#
with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class nmmo.task.constraint.ScalarConstraint(low: ~typing.Union[~typing.Callable, ~numbers.Number] = 0, high: ~typing.Union[~typing.Callable, ~numbers.Number] = 1024, dtype=<class 'int'>, systems=None)#

Bases: Constraint

check(config, value)#

Checks value is in bounds given config

sample(config)#

Generator to sample valid values given config