JavaSAONegotiator

class negmas.sao.JavaSAONegotiator(java_object, java_class_name: Optional[str], auto_load_java: bool = False, outcome_type: Type = <class 'dict'>)[source]

Bases: negmas.sao.SAONegotiator, negmas.java.JavaCallerMixin

Represents a negotiator running on JNegMAS (depricated)

Parameters
  • java_object – The Java object if known

  • java_class_name – Name of the java negotiator class

  • auto_load_java – If true, jnemgas will be loaded if not running.

  • outcome_type – Type of outcome to use

Remarks:
  • You cannot pass a ufun here.

Methods Summary

from_dict(java_object, *args[, parent])

Creates a Java negotiator from an object returned from the JVM implementing PySAONegotiator

isin(negotiation_id)

Is that agent participating in the given negotiation? Tests if the agent is participating in the given negotiation.

join(ami, state, *[, ufun, role])

Called by the mechanism when the agent is about to enter a negotiation.

on_leave(state)

A call back called after leaving a negotiation.

on_mechanism_error(state)

A call back called whenever an error happens in the mechanism.

on_negotiation_end(state)

A call back called at each negotiation end

on_negotiation_start(state)

A call back called at each negotiation start

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

on_round_end(state)

A call back called at each negotiation round end

on_round_start(state)

A call back called at each negotiation round start

on_ufun_changed()

Called to inform the agent that its ufun has changed.

propose(state)

Propose an offer or None to refuse.

respond(state, offer)

Called to respond to an offer.

Methods Documentation

classmethod from_dict(java_object, *args, parent: Optional[negmas.negotiators.Controller] = None, **kwargs)negmas.sao.JavaSAONegotiator[source]

Creates a Java negotiator from an object returned from the JVM implementing PySAONegotiator

isin(negotiation_id: Optional[str])bool[source]

Is that agent participating in the given negotiation? Tests if the agent is participating in the given negotiation.

Parameters

negotiation_id (Optional[str]) – The negotiation ID tested. If None, it means ANY negotiation

Returns

True if participating in the given negotiation (or any

negotiation if it was None)

Return type

bool

join(ami: negmas.common.AgentMechanismInterface, state: negmas.common.MechanismState, *, ufun: Optional[negmas.utilities.UtilityFunction] = None, role: str = 'agent')bool[source]

Called by the mechanism when the agent is about to enter a negotiation. It can prevent the agent from entering

Parameters
Returns

bool indicating whether or not the agent accepts to enter. If False is returned it will not enter the negotiation

on_leave(state: negmas.common.MechanismState)None[source]

A call back called after leaving a negotiation.

Parameters

stateMechanismState giving current state of the negotiation.

Remarks:
  • MUST call the baseclass on_leave using super () if you are going to override this.

  • The default behavior is to do nothing.

  • Override this to hook some action

on_mechanism_error(state: negmas.common.MechanismState)None[source]

A call back called whenever an error happens in the mechanism. The error and its explanation are accessible in state

Parameters

stateMechanismState giving current state of the negotiation.

Remarks:
  • The default behavior is to do nothing.

  • Override this to hook some action

on_negotiation_end(state: negmas.common.MechanismState)None[source]

A call back called at each negotiation end

Parameters

stateMechanismState or one of its descendants giving the state at which the negotiation ended.

Remarks:
on_negotiation_start(state: negmas.common.MechanismState)None[source]

A call back called at each negotiation start

Parameters

stateMechanismState giving current state of the negotiation.

Remarks:

  • You MUST call the super() version of this function either before or after your code when you are overriding it.

  • on_negotiation_start and on_negotiation_end will always be called once for every agent.

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

on_round_end(state: negmas.common.MechanismState)None[source]

A call back called at each negotiation round end

Parameters

stateMechanismState giving current state of the negotiation.

Remarks:
  • The default behavior is to do nothing.

  • Override this to hook some action

on_round_start(state: negmas.common.MechanismState)None[source]

A call back called at each negotiation round start

Parameters

stateMechanismState giving current state of the negotiation.

Remarks:
  • The default behavior is to do nothing.

  • Override this to hook some action.

on_ufun_changed()[source]

Called to inform the agent that its ufun has changed.

Remarks:

  • You MUST call the super() version of this function either before or after your code when you are overriding it.

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

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]]])[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).