scml.scml2019.insurance ======================= .. py:module:: scml.scml2019.insurance Classes ------- .. autoapisummary:: scml.scml2019.insurance.InsuranceCompany scml.scml2019.insurance.DefaultInsuranceCompany Module Contents --------------- .. py:class:: InsuranceCompany(*args, **kwargs) Bases: :py:obj:`negmas.situated.Agent`, :py:obj:`abc.ABC` Base class for all insurance companies .. py:attribute:: _world :type: Optional[scml.scml2019.world.SCML2019World] :value: None .. py:method:: _respond_to_negotiation_request(initiator: str, partners: List[str], issues: List[negmas.outcomes.Issue], annotation: Dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface, role: Optional[str], req_id: Optional[str]) -> Optional[negmas.negotiators.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:: 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: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.situated.Contract, mechanism: negmas.NegotiatorMechanismInterface) -> None Called whenever a negotiation ends with agreement .. py:method:: on_contract_signed(contract: negmas.situated.Contract) -> None Called whenever a contract is signed by all partners .. py:method:: on_contract_cancelled(contract: negmas.situated.Contract, rejectors: List[str]) -> None Called whenever at least a partner did not sign the contract .. py:method:: sign_contract(contract: negmas.situated.Contract) -> Optional[str] Called after the signing delay from contract conclusion to sign the contract. Contracts become binding only after they are signed. .. py:method:: respond_to_negotiation_request(initiator: str, partners: List[str], issues: List[negmas.outcomes.Issue], annotation: Dict[str, Any], mechanism: negmas.Mechanism, role: Optional[str], req_id: str) -> Optional[negmas.negotiators.Negotiator] .. py:method:: on_contract_breached(contract: negmas.situated.Contract, breaches: List[negmas.situated.Breach], resolution: Optional[negmas.situated.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:: on_contract_executed(contract: negmas.situated.Contract) -> None Called after successful contract execution for which the agent is one of the partners. .. py:class:: DefaultInsuranceCompany(premium: float, premium_breach_increment: float, premium_time_increment: float, a2f: Dict[str, scml.scml2019.common.Factory], disabled=False, name: str = None) Bases: :py:obj:`InsuranceCompany` Represents an insurance company in the world .. py:attribute:: premium_breach_increment .. py:attribute:: premium .. py:attribute:: disabled :value: False .. py:attribute:: premium_time_increment .. py:attribute:: insured_contracts :type: Dict[Tuple[negmas.situated.Contract, str], scml.scml2019.common.InsurancePolicy] .. py:attribute:: storage :type: Dict[int, int] .. py:attribute:: wallet :type: float :value: 0.0 .. py:attribute:: a2f .. py:method:: init() Called to initialize the agent **after** the world is initialized. the AWI is accessible at this point. .. py:method:: set_renegotiation_agenda(contract: negmas.situated.Contract, breaches: List[negmas.situated.Breach]) -> Optional[negmas.situated.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.situated.Contract, breaches: List[negmas.situated.Breach], agenda: negmas.situated.RenegotiationRequest) -> Optional[negmas.negotiators.Negotiator] Called to respond to a renegotiation request :param agenda: :param contract: :param breaches: Returns: .. py:method:: evaluate_insurance(contract: negmas.situated.Contract, insured: scml.scml2019.agent.SCML2019Agent, against: scml.scml2019.agent.SCML2019Agent, t: int = None) -> Optional[float] Can be called to evaluate the premium for insuring the given contract against breaches committed by others :param against: The `SCML2019Agent` to insure against :param contract: hypothetical contract :param insured: The `SCML2019Agent` to buy the insurance :param t: time at which the policy is to be bought. If None, it means current step Remarks: - The premium returned is relative to the contract price. To actually calculate the cost of buying this insurance, you need to multiply this by the contract value (quantity * unit_price). .. py:method:: buy_insurance(contract: negmas.situated.Contract, insured: scml.scml2019.agent.SCML2019Agent, against: scml.scml2019.agent.SCML2019Agent) -> Optional[scml.scml2019.common.InsurancePolicy] Buys insurance for the contract at the premium calculated by the insurance company. Remarks: The agent can call `evaluate_insurance` to find the premium that will be used. .. seealso:: `evaluate_premium` .. py:method:: is_insured(contract: negmas.situated.Contract, perpetrator: scml.scml2019.agent.SCML2019Agent) -> bool :param contract: :param perpetrator: Returns: .. py:method:: step() does nothing