scml.oneshot.adapter

Module Contents

Classes

OneShotSCML2020Adapter

Base class for adapters allowing SCML std agents to run as Oneshot agents in SCML2020Oneshot worlds

class scml.oneshot.adapter.OneShotSCML2020Adapter(*args, **kwargs)[source]

Bases: scml.oneshot.sysagents.DefaultOneShotAdapter

Base class for adapters allowing SCML std agents to run as Oneshot agents in SCML2020Oneshot worlds

reset()[source]
is_clean() bool[source]
on_negotiation_failure(partners, annotation, mechanism, state)[source]

Called whenever a negotiation ends without agreement

on_negotiation_success(contract, mechanism)[source]

Called whenever a negotiation ends with agreement

on_contract_executed(contract: negmas.Contract) None[source]

Called after successful contract execution for which the agent is one of the partners.

on_contract_breached(contract: negmas.Contract, breaches: List[negmas.Breach], resolution: negmas.Contract | None) None[source]

Called after complete processing of a contract that involved a breach.

Parameters:
  • contract – The contract

  • breaches – All breaches committed (even if they were resolved)

  • resolution – The resolution contract if re-negotiation was successful. None if not.

init()[source]

Override this method to modify initialization logic

before_step()[source]
to_dict()[source]
_respond_to_negotiation_request(initiator, partners, issues, annotation, mechanism, role, req_id)[source]

Called by the mechanism to ask for joining a negotiation. The agent can refuse by returning a None

Parameters:
  • initiator – The ID of the agent that initiated the negotiation request

  • partners – The partner list (will include this agent)

  • issues – The list of issues

  • annotation – Any annotation specific to this negotiation.

  • mechanism – The mechanism that started the negotiation

  • role – The role of this agent in the negotiation

  • req_id – The req_id passed to the AWI when starting the negotiation (only to the initiator).

Returns:

None to refuse the negotiation or a Negotiator object appropriate to the given mechanism to accept it.

Remarks:

  • It is expected that world designers will introduce a better way to respond and override this function to call it

set_renegotiation_agenda(contract, breaches)[source]

Received by partners in ascending order of their total breach levels in order to set the renegotiation agenda when contract execution fails

Parameters:
  • contract – The contract being breached

  • breaches – All breaches on contract

Returns:

Renegotiation agenda (issues to negotiate about to avoid reporting the breaches).

respond_to_renegotiation_request(contract, breaches, agenda)[source]

Called to respond to a renegotiation request

Parameters:
  • agenda

  • contract

  • breaches

Returns:

on_neg_request_rejected(req_id, by)[source]

Called when a requested negotiation is rejected

Parameters:
  • req_id – The request ID passed to _request_negotiation

  • by – A list of agents that refused to participate or None if the failure was for another reason

on_neg_request_accepted(req_id, mechanism)[source]

Called when a requested negotiation is accepted