nmmo.task.task_api module#
- class nmmo.task.task_api.ADD(*tasks: Union[Task, Real], subject: Optional[Group] = None)#
Bases:
TaskOperator
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.AND(*tasks: Union[Task, Real], subject: Optional[Group] = None)#
Bases:
TaskOperator
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.IMPLY(p: Predicate, q: Predicate, subject: Optional[Group] = None)#
Bases:
TaskOperator
,Predicate
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- exception nmmo.task.task_api.InvalidTaskDefinition#
Bases:
Exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class nmmo.task.task_api.MUL(*tasks: Union[Task, Real], subject: Optional[Group] = None)#
Bases:
TaskOperator
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.NOT(*tasks: Union[Task, Real], subject: Optional[Group] = None)#
Bases:
TaskOperator
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.OR(*tasks: Union[Task, Real], subject: Optional[Group] = None)#
Bases:
TaskOperator
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.Once(task: Task, subject: Optional[Group] = None)#
Bases:
TaskOperator
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.PAND(*tasks: Predicate, subject: Optional[Group] = None)#
Bases:
TaskOperator
,Predicate
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.PNOT(task: Predicate, subject: Optional[Group] = None)#
Bases:
TaskOperator
,Predicate
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.POR(*tasks: Predicate, subject: Optional[Group] = None)#
Bases:
TaskOperator
,Predicate
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.Predicate(subject: Group, *args, constraints: Optional[List[Tuple[str, Optional[Constraint]]]] = None, **kwargs)#
Bases:
Task
A task with evaluate restricted to boolean values.
True = 1.0 False = 0.0
- check(config: Config)#
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **overload)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.Repeat(task: Task, subject: Optional[Group] = None)#
Bases:
TaskOperator
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.Task(subject: Group, *args, constraints: Optional[List[Tuple[str, Optional[Constraint]]]] = None, **kwargs)#
Bases:
ABC
A task is used to calculate rewards for agents in “assignee”
- check(config: Config)#
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, **overload)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- class nmmo.task.task_api.TaskOperator(n, *tasks: Union[Task, Real], subject: Optional[Group] = None)#
Bases:
Task
- check(config: Config) bool #
Checks whether the task is valid
A satisfiable task “makes sense” given a config ie. Not trying to reach target off the map
- compute_rewards(gs) Tuple[Dict[int, float], Dict[int, Dict]] #
Environment facing API
Returns rewards and infos for all agents in subject
- sample(config: Config, cls: type[nmmo.task.task_api.TaskOperator], **kwargs)#
Samples a concrete instance of a given task.
Allows overloading of previous parameters.
- property subject#
- nmmo.task.task_api.define_predicate(fn: Callable) type[nmmo.task.task_api.Predicate] #
- nmmo.task.task_api.define_task(fn: Callable) type[nmmo.task.task_api.Task] #
Syntactic sugar API for defining tasks
See examples at base_predicates.py