negmas.concurrent

Implements Concurrent Negotiation Mechanisms and their agents

class negmas.concurrent.ChainNegotiationsMechanism(initial_state: MechanismState | None = None, *args, **kwargs)[source]

Bases: Mechanism[ChainNMI, MechanismState, MechanismAction, ChainNegotiator]

ChainNegotiations mechanism.

add(negotiator: ChainNegotiator, *, preferences: Preferences | None = None, role: str | None = None, **kwargs) bool | None[source]

Add.

Parameters:
  • negotiator – Negotiator.

  • **kwargs – Additional keyword arguments.

Returns:

The result.

Return type:

bool | None

on_confirm(level: int, left: bool) bool[source]

Called by negotiators to confirm their temporary accepted agreements

Parameters:
  • level – The caller level

  • left – Whether to confirm its left or right temporary accepted agreement

class negmas.concurrent.ChainNegotiator(*args, **kwargs)[source]

Bases: Negotiator, ABC

Base class for all nested negotiations negotiator

confirm(left: bool) bool[source]

Called to confirm a offer to either the left or the right

Parameters:

left – If true confirm the offer sent to the left (otherwise the right)

Returns:

join(nmi: NegotiatorMechanismInterface, state: MechanismState, *, preferences: Preferences | None = None, ufun: BaseUtilityFunction | None = None, role: str = 'negotiator') bool[source]

Join.

Parameters:
  • nmi – Nmi.

  • state – Current state.

Returns:

The result.

Return type:

bool

abstractmethod on_acceptance(state: MechanismState, offer: Offer) Offer[source]

Called when one of the negotiator’s proposals gets accepted

Parameters:
  • state – mechanism state

  • offer – The offer accepted

Returns:

A new offer (possibly to another negotiator)

abstractmethod propose(state: MechanismState, dest: str | None = None) Offer[source]

Called to allow the agent to propose to either its left or its right in the chain

Parameters:

state – Mechanism state

Returns:

The offer

abstractmethod respond(state: MechanismState, outcome: tuple, from_left: bool, temp: bool) ResponseType[source]

Called to respond to an offer

Parameters:
  • state – Mechanism state

  • outcome – The offer to respond to

  • from_left – Whether the offer is coming from the left

  • temp – Whether the offer is a temporary offer

Returns:

A response type which can only be ACCEPT_OFFER, REJECT_OFFER, or END_NEGOTIATION

class negmas.concurrent.MultiChainNegotiationsMechanism(*args, **kwargs)[source]

Bases: Mechanism[ChainNMI, MechanismState, MechanismAction, MultiChainNegotiator]

MultiChainNegotiations mechanism.

add(negotiator: MultiChainNegotiator, *, preferences: Preferences | None = None, role: str | None = None, **kwargs) bool | None[source]
on_confirm(level: int, left: bool) bool[source]

Called by negotiators to confirm their temporary accepted agreements

Parameters:
  • level – The caller level

  • left – Whether to confirm its left or right temporary accepted agreement

class negmas.concurrent.MultiChainNegotiator(*args, **kwargs)[source]

Bases: Negotiator, ABC

Base class for all nested negotiations negotiator

confirm(left: bool) bool[source]

Called to confirm a offer to either the left or the right

Parameters:

left – If true confirm the offer sent to the left (otherwise the right)

Returns:

join(nmi: NegotiatorMechanismInterface, state: MechanismState, *, preferences: Preferences | None = None, ufun: BaseUtilityFunction | None = None, role: str = 'negotiator') bool[source]

Join.

Parameters:
  • nmi – Nmi.

  • state – Current state.

Returns:

The result.

Return type:

bool

abstractmethod on_acceptance(state: MechanismState, offer: Offer) Offer[source]

Called when one of the negotiator’s proposals gets accepted

Parameters:
  • state – mechanism state

  • offer – The offer accepted

Returns:

A new offer (possibly to another negotiator)

abstractmethod propose(state: MechanismState, dest: str | None = None) Offer[source]

Called to allow the agent to propose to either its left or its right in the chain

Parameters:

state – Mechanism state

Returns:

The offer

abstractmethod respond(state: MechanismState, outcome: tuple, from_left: bool, temp: bool, source: str) ResponseType[source]

Called to respond to an offer

Parameters:
  • state – Mechanism state

  • outcome – The offer to respond to

  • from_left – Whether the offer is coming from the left

  • temp – Whether the offer is a temporary offer

  • source – The ID of the source agent

Returns:

A response type which can only be ACCEPT_OFFER, REJECT_OFFER, or END_NEGOTIATION