scml.oneshot.sysagents ====================== .. py:module:: scml.oneshot.sysagents .. autoapi-nested-parse:: Implements the one shot version of SCML Classes ------- .. autoapisummary:: scml.oneshot.sysagents.DefaultOneShotAdapter scml.oneshot.sysagents._StdSystemAgent Module Contents --------------- .. py:class:: DefaultOneShotAdapter(*args, **kwargs) Bases: :py:obj:`negmas.Adapter`, :py:obj:`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. .. py:attribute:: _obj :type: scml.oneshot.agent.OneShotAgent .. py:method:: make_ufun(add_exogenous: bool, in_adapter=False) .. py:method:: on_negotiation_failure(partners, annotation, mechanism, state) Called whenever a negotiation ends without agreement .. py:method:: on_negotiation_success(contract: negmas.Contract, mechanism) Called whenever a negotiation ends with agreement .. py:method:: on_contract_executed(contract: negmas.Contract) -> None Called after successful contract execution for which the agent is one of the partners. .. py:method:: on_contract_breached(contract: negmas.Contract, breaches: list[negmas.Breach], resolution: Optional[negmas.Contract]) -> None Called after complete processing of a contract that involved a breach. :param contract: The contract :param breaches: All breaches committed (even if they were resolved) :param resolution: The resolution contract if re-negotiation was successful. None if not. .. py:method:: init_() Called to initialize the agent **after** the world is initialized. the AWI is accessible at this point. .. py:method:: init() Override this method to modify initialization logic .. py:method:: reset() .. py:method:: is_clean() -> bool .. py:method:: before_step() .. py:method:: step() Override this method to modify stepping logic .. py:method:: to_dict() .. py:method:: _respond_to_negotiation_request(initiator: str, partners: list[str], issues: list[negmas.Issue], annotation: dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface, role: Optional[str], req_id: Optional[str]) -> Optional[negmas.Negotiator] Called by the mechanism to ask for joining a negotiation. The agent can refuse by returning a None :param initiator: The ID of the agent that initiated the negotiation request :param partners: The partner list (will include this agent) :param issues: The list of issues :param annotation: Any annotation specific to this negotiation. :param mechanism: The mechanism that started the negotiation :param role: The role of this agent in the negotiation :param 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 .. py:method:: set_renegotiation_agenda(contract: negmas.Contract, breaches: list[negmas.Breach]) -> Optional[negmas.RenegotiationRequest] Received by partners in ascending order of their total breach levels in order to set the renegotiation agenda when contract execution fails :param contract: The contract being breached :param breaches: All breaches on `contract` :returns: Renegotiation agenda (issues to negotiate about to avoid reporting the breaches). .. py:method:: respond_to_renegotiation_request(contract: negmas.Contract, breaches: list[negmas.Breach], agenda: negmas.RenegotiationRequest) -> Optional[negmas.Negotiator] Called to respond to a renegotiation request :param agenda: :param contract: :param breaches: Returns: .. py:method:: on_neg_request_rejected(req_id: str, by: Optional[list[str]]) Called when a requested negotiation is rejected :param req_id: The request ID passed to _request_negotiation :param by: A list of agents that refused to participate or None if the failure was for another reason .. py:method:: on_neg_request_accepted(req_id: str, mechanism: negmas.NegotiatorMechanismInterface) Called when a requested negotiation is accepted .. py:property:: awi :type: scml.oneshot.awi.OneShotAWI Gets the Agent-world interface. .. py:property:: short_type_name Returns a short name of the type of this entity .. py:class:: _StdSystemAgent(*args, role, **kwargs) Bases: :py:obj:`DefaultOneShotAdapter` Implements an agent for handling system operations .. py:attribute:: id The unique ID of this entity .. py:attribute:: name A convenient name of the entity (intended primarily for printing/logging/debugging). .. py:attribute:: profile :value: None .. py:property:: type_name Returns a short name of the type of this entity .. py:property:: short_type_name Returns a short name of the type of this entity .. py:method:: respond_to_negotiation_request(initiator: str, issues: list[negmas.Issue], annotation: dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface) -> Optional[negmas.Negotiator] .. py:method:: before_step() .. py:method:: step() Override this method to modify stepping logic .. py:method:: init() Override this method to modify initialization logic .. py:method:: on_negotiation_failure(partners: list[str], annotation: dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface, state: negmas.MechanismState) -> None Called whenever a negotiation ends without agreement .. py:method:: on_negotiation_success(contract: negmas.Contract, mechanism: negmas.NegotiatorMechanismInterface) -> None Called whenever a negotiation ends with agreement .. py:method:: sign_all_contracts(contracts: list[negmas.Contract]) -> list[Optional[str]] Signs all contracts