DoNothingAgent

class scml.scml2020.DoNothingAgent(name=None, type_postfix='', ufun=None)[source]

Bases: scml.SCML2020Agent

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

Methods Summary

init()

Called to initialize the agent after the world is initialized.

on_agent_bankrupt(agent, contracts, …)

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

on_contract_breached(contract, breaches, …)

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

on_contract_cancelled(contract, rejectors)

Called whenever at least a partner did not sign the contract

on_contract_executed(contract)

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

on_contracts_finalized(signed, cancelled, …)

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)

on_failures(failures)

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

on_negotiation_failure(partners, annotation, …)

Called whenever a negotiation ends without agreement

on_negotiation_success(contract, mechanism)

Called whenever a negotiation ends with agreement

respond_to_negotiation_request(initiator, …)

Called whenever another agent requests a negotiation with this agent.

sign_all_contracts(contracts)

Signs all contracts

step()

Called by the simulator at every simulation step

Methods Documentation

init()[source]

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

on_agent_bankrupt(agent, contracts, quantities, compensation_money)[source]

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

Parameters
  • agent (str) – The ID of the agent that went bankrupt.

  • contracts (List[Contract]) – All future contracts between this agent and the bankrupt agent.

  • quantities (List[int]) – The actual quantities that these contracts will be executed at.

  • compensation_money (int) – 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

Return type

None

on_contract_breached(contract, breaches, resolution)[source]

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

Parameters
  • contract (Contract) – The contract

  • breaches (List[Breach]) – All breaches committed (even if they were resolved)

  • resolution (Optional[Contract]) – The resolution contract if re-negotiation was successful. None if not.

Return type

None

on_contract_cancelled(contract, rejectors)[source]

Called whenever at least a partner did not sign the contract

Return type

None

on_contract_executed(contract)[source]

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

Return type

None

on_contracts_finalized(signed, cancelled, rejectors)[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 (List[Contract]) – A list of signed contracts. These are binding

  • cancelled (List[Contract]) – A list of cancelled contracts. These are not binding

  • rejectors (List[List[str]]) – 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

Return type

None

on_failures(failures)[source]

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

Parameters

failures (List[Failure]) – A list of Failure s.

Return type

None

on_negotiation_failure(partners, annotation, mechanism, state)[source]

Called whenever a negotiation ends without agreement

Return type

None

on_negotiation_success(contract, mechanism)[source]

Called whenever a negotiation ends with agreement

Return type

None

respond_to_negotiation_request(initiator, issues, annotation, mechanism)[source]

Called whenever another agent requests a negotiation with this agent.

Parameters
  • initiator (str) – The ID of the agent that requested this negotiation

  • issues (List[Issue]) – Negotiation issues

  • annotation (Dict[str, Any]) – Annotation attached with this negotiation

  • mechanism (AgentMechanismInterface) – The AgentMechanismInterface interface to the mechanism to be used for this negotiation.

Return type

Optional[Negotiator]

Returns

None to reject the negotiation, otherwise a negotiator

sign_all_contracts(contracts)[source]

Signs all contracts

Return type

List[Optional[str]]

step()[source]

Called by the simulator at every simulation step