BulletinBoard

class negmas.situated.BulletinBoard[source]

Bases: negmas.events.EventSource, negmas.helpers.ConfigReader

The bulletin-board which carries all public information. It consists of sections each with a dictionary of records.

Attributes Summary

data

This property is intended for use only by the world manager.

Methods Summary

add_section(name)

Adds a section to the bulletin Board

query(section, query[, query_keys])

Returns all records in the given section/sections of the bulletin-board that satisfy the query

read(section, key)

Reads the value associated with given key

record(section, value[, key])

Records data in the given section of the bulletin-board

remove(section, *[, query, key, query_keys, …])

Removes a value or a set of values from the bulletin Board

satisfies(value, query)

Attributes Documentation

data

This property is intended for use only by the world manager. No other agent is allowed to use it

Methods Documentation

add_section(name: str)None[source]

Adds a section to the bulletin Board

Parameters

name – Section name

Returns:

query(section: Optional[Union[str, List[str]]], query: Any, query_keys=False)Optional[Dict[str, Any]][source]

Returns all records in the given section/sections of the bulletin-board that satisfy the query

Parameters
  • section – Either a section name, a list of sections or None specifying ALL public sections (see remarks)

  • query – The query which is USUALLY a dict with conditions on it when querying values and a RegExp when

  • keys (querying) –

  • query_keys – Whether the query is to be applied to the keys or values.

Returns

value pairs giving all records that satisfied the given requirements.

Return type

  • A dictionary with key

Remarks:

  • A public section is a section with a name that does not start with an underscore

  • If a set of sections is given, and two records in different sections had the same key, only one of them will be returned

  • Key queries use regular expressions and match from the beginning using the standard re.match function

read(section: str, key: str)Any[source]

Reads the value associated with given key

Parameters
  • section – section name

  • key – key

Returns

Content of that key in the bulletin-board

record(section: str, value: Any, key: Optional[str] = None)None[source]

Records data in the given section of the bulletin-board

Parameters
  • section – section name (can contain subsections separated by ‘/’)

  • key – The key

  • value – The value

remove(section: Optional[Union[str, List[str]]], *, query: Optional[Any] = None, key: Optional[str] = None, query_keys: bool = False, value: Optional[Any] = None)bool[source]

Removes a value or a set of values from the bulletin Board

Parameters
  • section – The section

  • query – the query to use to select what to remove

  • key – the key to remove (no need to give a full query)

  • query_keys – Whether to apply the query (if given) to keys or values

  • value – Value to be removed

Returns

Success of failure

Return type

bool

classmethod satisfies(value: Any, query: Any)bool[source]