SAONegotiator

class negmas.sao.SAONegotiator(assume_normalized=True, ufun: Optional[negmas.utilities.base.UtilityFunction] = None, name: Optional[str] = None, parent: negmas.negotiators.Controller = None, owner: Agent = None, id: Optional[str] = None, rational_proposal=True)[source]

Bases: negmas.negotiators.Negotiator

Base class for all SAO negotiators.

Parameters
  • name – Negotiator name

  • parent – Parent controller if any

  • ufun – The ufun of the negotiator

  • assume_normalized – If true, the negotiator can assume that the ufun is normalized between zreo and one.

  • rational_proposal – If True, the negotiator will never propose something with a utility value less than its reserved value. If propose returned such an outcome, a NO_OFFER will be returned instead.

  • owner – The Agent that owns the negotiator.

Remarks:
  • The only method that must be implemented by any SAONegotiator is propose.

  • The default respond method, accepts offers with a utility value no less than whatever propose returns with the same mechanism state.

Methods Summary

counter(state, offer)

Called by the mechanism to counter the offer.

on_notification(notification, notifier)

Called whenever a notification is received

on_partner_proposal(state, partner_id, offer)

A callback called by the mechanism when a partner proposes something

on_partner_refused_to_propose(state, agent_id)

A callback called by the mechanism when a partner refuses to propose

on_partner_response(state, partner_id, ...)

A callback called by the mechanism when a partner responds to some offer

propose(state)

Propose an offer or None to refuse.

propose_(state)

The method directly called by the mechanism (through counter ) to ask for a proposal

respond(state, offer)

Called to respond to an offer.

respond_(state, offer)

The method to be called directly by the mechanism (through counter ) to respond to an offer.

Methods Documentation

counter(state: negmas.common.MechanismState, offer: Optional[Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]]) negmas.sao.common.SAOResponse[source]

Called by the mechanism to counter the offer. It just calls respond_ and propose_ as needed.

Parameters
  • stateMechanismState giving current state of the negotiation.

  • offer – The offer to be countered. None means no offer and the agent is requested to propose an offer

Returns

The response to the given offer with a counter offer if the response is REJECT

Return type

Tuple[ResponseType, Outcome]

on_notification(notification: negmas.events.Notification, notifier: str)[source]

Called whenever a notification is received

Parameters
  • notification – The notification

  • notifier – The notifier entity

Remarks:
  • The default implementation only responds to end_negotiation by ending the negotiation

on_partner_proposal(state: negmas.common.MechanismState, partner_id: str, offer: Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]) None[source]

A callback called by the mechanism when a partner proposes something

Parameters
  • stateMechanismState giving the state of the negotiation when the offer was porposed.

  • partner_id – The ID of the agent who proposed

  • offer – The proposal.

Remarks:
  • Will only be called if enable_callbacks is set for the mechanism

on_partner_refused_to_propose(state: negmas.common.MechanismState, agent_id: str) None[source]

A callback called by the mechanism when a partner refuses to propose

Parameters
  • stateMechanismState giving the state of the negotiation when the partner refused to offer.

  • agent_id – The ID of the agent who refused to propose

Remarks:
  • Will only be called if enable_callbacks is set for the mechanism

on_partner_response(state: negmas.common.MechanismState, partner_id: str, outcome: Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]], response: negmas.outcomes.ResponseType) None[source]

A callback called by the mechanism when a partner responds to some offer

Parameters
  • stateMechanismState giving the state of the negotiation when the partner responded.

  • partner_id – The ID of the agent who responded

  • outcome – The proposal being responded to.

  • response – The response

Remarks:
  • Will only be called if enable_callbacks is set for the mechanism

abstract propose(state: negmas.common.MechanismState) Optional[Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]][source]

Propose an offer or None to refuse.

Parameters

stateMechanismState giving current state of the negotiation.

Returns

The outcome being proposed or None to refuse to propose

Remarks:
  • This function guarantees that no agents can propose something with a utility value

propose_(state: negmas.common.MechanismState) Optional[Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]][source]

The method directly called by the mechanism (through counter ) to ask for a proposal

Parameters

state – The mechanism state

Returns

An outcome to offer or None to refuse to offer

Remarks:
  • Depending on the SAOMechanism settings, refusing to offer may be interpreted as ending the negotiation

  • The negotiator will only receive this call if it has the ‘propose’ capability.

  • Rational proposal is implemented in this method.

respond(state: negmas.common.MechanismState, offer: Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]) negmas.outcomes.ResponseType[source]

Called to respond to an offer. This is the method that should be overriden to provide an acceptance strategy.

Parameters
  • state – a MechanismState giving current state of the negotiation.

  • offer – offer being tested

Returns

The response to the offer

Return type

ResponseType

Remarks:
  • The default implementation never ends the negotiation

  • The default implementation asks the negotiator to propose`() and accepts the `offer if its utility was at least as good as the offer that it would have proposed (and above the reserved value).

respond_(state: negmas.common.MechanismState, offer: Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]) negmas.outcomes.ResponseType[source]

The method to be called directly by the mechanism (through counter ) to respond to an offer.

Parameters
  • state – a MechanismState giving current state of the negotiation.

  • offer – the offer being responded to.

Returns

The response to the offer. Possible values are:

  • NO_RESPONSE: refuse to offer. Depending on the mechanism settings this may be interpreted as ending

    the negotiation.

  • ACCEPT_OFFER: Accepting the offer.

  • REJECT_OFFER: Rejecting the offer. The negotiator will be given the chance to counter this

    offer through a call of propose_ later if this was not the last offer to be evaluated by the mechanism.

  • END_NEGOTIATION: End the negotiation

  • WAIT: Instructs the mechanism to wait for this negotiator more. It may lead to cycles so use with care.

Return type

ResponseType

Remarks:
  • The default implementation never ends the negotiation except if an earler end_negotiation notification is sent to the negotiator

  • The default implementation asks the negotiator to propose`() and accepts the `offer if its utility was at least as good as the offer that it would have proposed (and above the reserved value).