AgentMechanismInterface

class negmas.common.AgentMechanismInterface(id: str, outcome_type: Type, n_outcomes: Optional[int], issues: List[Issue], outcomes: Optional[List[Outcome]], time_limit: float, step_time_limit: float, negotiator_time_limit: float, n_steps: int, dynamic_entry: bool, max_n_agents: int, imap: Dict[Union[str, int], Union[str, int]], annotation: Dict[str, Any] = <factory>)[source]

Bases: object

All information of a negotiation visible to negotiators.

Attributes Summary

agent_ids

Gets the IDs of all agents owning all negotiators

agent_names

Gets the names of all agents owning all negotiators

n_negotiators

Syntactic sugar for state.n_negotiators

negotiator_ids

Gets the IDs of all negotiators

negotiator_names

Gets the namess of all negotiators

params

Returns the parameters used to initialize the mechanism.

participants

requirements

The protocol requirements

state

Access the current state of the mechanism.

Methods Summary

asdict()

Converts the object to a dict containing all fields

discrete_outcomes([n_max, astype])

A discrete set of outcomes that spans the outcome space

keys()

outcome_index(outcome)

The index of an outcome

random_outcomes([n, astype])

A set of random outcomes from the issues of this negotiation

values()

Attributes Documentation

agent_ids

Gets the IDs of all agents owning all negotiators

agent_names

Gets the names of all agents owning all negotiators

n_negotiators

Syntactic sugar for state.n_negotiators

negotiator_ids

Gets the IDs of all negotiators

negotiator_names

Gets the namess of all negotiators

params

Returns the parameters used to initialize the mechanism.

participants
requirements

The protocol requirements

Returns

  • A dict of str/Any pairs giving the requirements

state

Access the current state of the mechanism.

Remarks:

  • Whenever a method receives a AgentMechanismInterface object, it can always access the current state of the protocol by accessing this property.

Methods Documentation

asdict()[source]

Converts the object to a dict containing all fields

discrete_outcomes(n_max: int = None, astype: Type[Outcome] = None)List[Outcome][source]

A discrete set of outcomes that spans the outcome space

Parameters
  • n_max – The maximum number of outcomes to return. If None, all outcomes will be returned for discrete issues

  • astype – A type to cast the resulting outcomes to. None means use the default type for this mechanism

Returns

List of n or less outcomes

Return type

List[Outcome]

keys()[source]
outcome_index(outcome: Outcome)Optional[int][source]

The index of an outcome

Parameters

outcome – The outcome asked about

Returns

The index of this outcome in the list of outcomes. Only valid if n_outcomes is finite and not None.

Return type

int

random_outcomes(n: int = 1, astype: Type[Outcome] = None)List[Outcome][source]

A set of random outcomes from the issues of this negotiation

Parameters
  • n – number of outcomes requested

  • astype – A type to cast the resulting outcomes to.

Returns

List of n or less outcomes

Return type

List[Outcome]

values()[source]