scml.scml2020.agents.do_nothing

Implements an agent that does nothing

Classes

DoNothingAgent

An agent that does nothing for the whole length of the simulation

Module Contents

class scml.scml2020.agents.do_nothing.DoNothingAgent(name: str | None = None, type_postfix: str = '', preferences: negmas.preferences.Preferences | None = None, ufun: negmas.preferences.UtilityFunction | None = None)[source]

Bases: scml.scml2020.agent.SCML2020Agent

An agent that does nothing for the whole length of the simulation

respond_to_negotiation_request(initiator: str, issues: List[negmas.Issue], annotation: Dict[str, Any], mechanism: negmas.NegotiatorMechanismInterface) negmas.Negotiator | None[source]

Called whenever another agent requests a negotiation with this agent.

Parameters:
  • initiator – The ID of the agent that requested this negotiation

  • issues – Negotiation issues

  • annotation – Annotation attached with this negotiation

  • mechanism – The NegotiatorMechanismInterface interface to the mechanism to be used for this negotiation.

Returns:

None to reject the negotiation, otherwise a negotiator

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

Signs all contracts

on_contracts_finalized(signed: List[negmas.Contract], cancelled: List[negmas.Contract], rejectors: List[List[str]]) None[source]

Called for all contracts in a single step to inform the agent about which were finally signed and which were rejected by any agents (including itself)

Parameters:
  • signed – A list of signed contracts. These are binding

  • cancelled – A list of cancelled contracts. These are not binding

  • rejectors – A list of lists where each of the internal lists gives the rejectors of one of the cancelled contracts. Notice that it is possible that this list is empty which means that the contract other than being rejected by any agents (if that was possible in the specific world).

Remarks:

The default implementation is to call on_contract_signed for singed contracts and on_contract_cancelled for cancelled contracts

step()[source]

Called by the simulator at every simulation step

init()[source]

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

on_agent_bankrupt(agent: str, contracts: List[negmas.Contract], quantities: List[int], compensation_money: int) None[source]

Called whenever a contract is nullified (because the partner is bankrupt)

Parameters:
  • agent – The ID of the agent that went bankrupt.

  • contracts – All future contracts between this agent and the bankrupt agent.

  • quantities – The actual quantities that these contracts will be executed at.

  • compensation_money – The compensation money that is already added to the agent’s wallet (if ANY).

Remarks:

  • compensation_money will be nonzero iff immediate_compensation is enabled for this world

on_failures(failures: List[scml.scml2020.common.Failure]) None[source]

Called whenever there are failures either in production or in execution of guaranteed transactions

Parameters:

failures – A list of Failure s.

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

on_contract_cancelled(contract: negmas.Contract, rejectors: List[str]) None[source]

Called whenever at least a partner did not sign the contract

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.