scml.oneshot.sysagents

Implements the one shot version of SCML

Module Contents

Classes

DefaultOneShotAdapter

The base class of all agents running in OneShot based on OneShotAgent.

_StdSystemAgent

Implements an agent for handling system operations

class scml.oneshot.sysagents.DefaultOneShotAdapter(*args, **kwargs)[source]

Bases: negmas.Adapter, scml.oneshot.mixins.OneShotUFunCreatorMixin

The base class of all agents running in OneShot based on OneShotAgent.

Remarks:

  • It inherits from Adapter allowing it to just pass any calls not defined explicity in it to the internal _obj object representing the OneShotAgent.

property awi: scml.oneshot.awi.OneShotAWI[source]

Gets the Agent-world interface.

property short_type_name[source]

Returns a short name of the type of this entity

make_ufun(add_exogenous: bool, in_adapter=False)[source]
on_negotiation_failure(partners, annotation, mechanism, state)[source]

Called whenever a negotiation ends without agreement

on_negotiation_success(contract: negmas.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]

Called to initialize the agent after the world is initialized. the AWI is accessible at this point.

init()[source]

Override this method to modify initialization logic

reset()[source]
is_clean() bool[source]
before_step()[source]
step()[source]

Override this method to modify stepping logic

to_dict()[source]
_respond_to_negotiation_request(initiator: str, partners: list[str], issues: list[negmas.Issue], annotation: dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface, role: str | None, req_id: str | None) negmas.Negotiator | None[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: negmas.Contract, breaches: list[negmas.Breach]) negmas.RenegotiationRequest | None[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: negmas.Contract, breaches: list[negmas.Breach], agenda: negmas.RenegotiationRequest) negmas.Negotiator | None[source]

Called to respond to a renegotiation request

Parameters:
  • agenda

  • contract

  • breaches

Returns:

on_neg_request_rejected(req_id: str, by: list[str] | None)[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: str, mechanism: negmas.NegotiatorMechanismInterface)[source]

Called when a requested negotiation is accepted

class scml.oneshot.sysagents._StdSystemAgent(*args, role, **kwargs)[source]

Bases: DefaultOneShotAdapter

Implements an agent for handling system operations

property type_name[source]

Returns a short name of the type of this entity

property short_type_name[source]

Returns a short name of the type of this entity

respond_to_negotiation_request(initiator: str, issues: list[negmas.Issue], annotation: dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface) negmas.Negotiator | None[source]
before_step()[source]
step()[source]

Override this method to modify stepping logic

init()[source]

Override this method to modify initialization logic

on_negotiation_failure(partners: list[str], annotation: dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface, state: negmas.MechanismState) None[source]

Called whenever a negotiation ends without agreement

on_negotiation_success(contract: negmas.Contract, mechanism: negmas.NegotiatorMechanismInterface) None[source]

Called whenever a negotiation ends with agreement

sign_all_contracts(contracts: list[negmas.Contract]) list[str | None][source]

Signs all contracts