SCML2020World¶
-
class
scml.scml2020.
SCML2020World
(process_inputs, process_outputs, catalog_prices, profiles, agent_types, agent_params=None, initial_balance=1000, buy_missing_products=True, borrow_on_breach=True, bankruptcy_limit=0.2, breach_penalty=0.15, financial_report_period=5, interest_rate=0.05, compensation_fraction=1.0, compensate_immediately=False, compensate_before_past_debt=False, external_force_max=True, external_no_borrow=False, external_no_bankruptcy=False, external_penalty=0.15, external_supply_limit=None, external_sales_limit=None, production_no_borrow=False, production_no_bankruptcy=False, production_penalty=0.15, compact=False, no_logs=False, n_steps=1000, time_limit=5400, neg_n_steps=20, neg_time_limit=120, neg_step_time_limit=60, negotiation_speed=21, signing_delay=1, name=None, **kwargs)[source]¶ Bases:
negmas.situated.TimeInAgreementMixin
,negmas.situated.World
A Supply Chain SCML2020World Simulation as described for the SCML league of ANAC @ IJCAI 2020.
- Parameters
process_inputs (
ndarray
) – An n_processes vector specifying the number of inputs from each product needed to execute each process.process_outputs (
ndarray
) – An n_processes vector specifying the number of inputs from each product generated by executing each process.catalog_prices (
ndarray
) – An n_products vector (i.e. n_processes+1 vector) giving the catalog price of all productsprofiles (
List
[FactoryProfile
]) – An n_agents list ofFactoryProfile
objects specifying the private profile of the factory associated with each agent.agent_types (
List
[Type
[SCML2020Agent
]]) – An n_agents list of strings/SCML2020Agent
classes specifying the type of each agentagent_params (
Optional
[List
[Dict
[str
,Any
]]]) – An n_agents dictionaries giving the parameters of each agentinitial_balance (
Union
[ndarray
,Tuple
[int
,int
],int
]) – The initial balance in each agent’s wallet. All agents will start with this same value.breach_penalty – The total penalty paid upon a breach will be calculated as (breach_level * breach_penalty * contract_quantity * contract_unit_price).
external_supply_limit (
Optional
[ndarray
]) – An n_steps * n_products array giving the total supply available of each product over time. Only affects guaranteed supply.external_sales_limit (
Optional
[ndarray
]) – An n_steps * n_products array giving the total sales to happen for each product over time. Only affects guaranteed sales.financial_report_period – The number of steps between financial reports. If < 1, it is a fraction of n_steps
borrow_on_breach – If true, agents will be forced to borrow money on breach as much as possible to honor the contract
interest_rate – The interest at which loans grow over time (it only affect a factory when its balance is negative)
bankruptcy_limit – The maximum amount that be be borrowed (including interest). The balance of any factory cannot go lower than - borrow_limit or the agent will go bankrupt immediately
compensation_fraction – Fraction of a contract to be compensated (at most) if a partner goes bankrupt. Notice that this fraction is not guaranteed because the bankrupt agent may not have enough assets to pay all of its standing contracts to this level of compensation. In such cases, a smaller fraction will be used.
compensate_immediately – If true, compensation will happen immediately when an agent goes bankrupt and in in money. This means that agents with contracts involving the bankrupt agent will just have these contracts be nullified and receive monetary compensation immediately . If false, compensation will not happen immediately but at the contract execution time. In this case, agents with contracts involving the bankrupt agent will be informed of the compensation fraction (instead of the compensation money) at the time of bankruptcy and will receive the compensation in kind (money if they are sellers and products if they are buyers) at the normal execution time of the contract. In the special case of no-compensation (i.e.
compensation_fraction
is zero or the bankrupt agent has no assets), the two options will behave similarity.compensate_before_past_debt – If true, then compensations will be paid before past debt is considered, otherwise, the money from liquidating bankrupt agents will first be used to pay past debt then whatever remains will be used for compensation. Notice that in all cases, the trigger of bankruptcy will be paid before compensation and past debts.
external_force_max – If true, agents are not asked to confirm guaranteed transactions and they are carried out up to bankruptcy
external_no_borrow – If true, agents will not borrow if they fail to satisfy an external transaction. The transaction will just fail silently
external_no_bankruptcy – If true, agents will not go bankrupt because of an external transaction. The transaction will just fail silently
external_penalty – The penalty paid for failure to honor external contracts
production_no_borrow – If true, agents will not borrow if they fail to satisfy its production need to execute a scheduled production command
production_no_bankruptcy – If true, agents will not go bankrupt because of an production related transaction.
production_penalty – The penalty paid when buying from spotmarket to satisfy production needs
compact – If True, no logs will be kept and the whole simulation will use a smaller memory footprint
n_steps – Number of simulation steps (can be considered as days).
time_limit – Total time allowed for the complete simulation in seconds.
neg_n_steps – Number of negotiation steps allowed for all negotiations.
neg_time_limit – Total time allowed for a complete negotiation in seconds.
neg_step_time_limit – Total time allowed for a single step of a negotiation. in seconds.
negotiation_speed – The number of negotiation steps that pass in every simulation step. If 0, negotiations will be guaranteed to finish within a single simulation step
signing_delay – The number of simulation steps to pass between a contract is concluded and signed
**kwargs – Other parameters that are passed directly to
SCML2020World
constructor.
Attributes Summary
Fraction of negotiations ending in agreement and leading to signed contracts
Fraction of signed contracts that led to breaches
The total business size defined as the total money transferred within the system
Fraction of negotiations ending in agreement and leading to signed contracts
Fraction of signed contracts successfully executed
The unique ID of this entity
Average number of rounds in a successful negotiation
Average number of rounds in a successful negotiation
A convenient name of the entity (intended primarily for printing/logging/debugging).
Returns a number between
0
and1
indicating elapsed relative time or steps.Returns the remaining number of steps until the end of the mechanism run.
Returns remaining time in seconds.
Elapsed time since mechanism started in seconds.
The unique ID of this entity
The winners of this world (factory managers with maximum wallet balance
Methods Summary
add_financial_report
(agent, factory, …)Records a financial report for the given agent in the agent indexed reports and time indexed reports
announce
(event)Raises an event and informs all event sinks that are registerd for notifications on this event type
breach_record
(breach)Converts a breach to a record suitable for storage during the simulation
checkpoint
(path[, file_name, info, …])Saves a checkpoint of the current object at the given path.
Should be called at the end of the simulation to save the final state
checkpoint_info
(file_name)Returns the information associated with a dump of the object saved in the given file
checkpoint_init
([step_attrib, every, …])Initializes the object to automatically save a checkpoint
Should be called on every step to save checkpoints as needed.
compensate
(available, factory)Called by a factory when it is going bankrupt after liquidation
complete_contract_execution
(contract, …)Called after breach resolution is completed for contracts for which some potential breaches occurred.
contract_record
(contract)Converts a contract to a record suitable for permanent storage
contract_size
(contract)Returns an estimation of the activity level associated with this contract.
create
(*args, **kwargs)Creates an object and returns a proxy to it.
- rtype
None
Called at every time-step to get the contracts that are
executable
at this point of the simulationexecute_action
(action, agent[, callback])Executes the given action by the given agent
from_checkpoint
(file_name[, return_info])Creates an object from a saved checkpoint
from_config
(config[, section, …])Creates an object of this class given the configuration info
generate
(agent_types[, agent_params, …])Generates the configuration for a world
get_private_state
(agent)Reads the private state of the given agent
init
([time_field])join
(x[, simulation_priority])Add an agent to the world.
logdebug
(s[, event])logs debug-level information
logerror
(s[, event])logs error-level information
loginfo
(s[, event])logs info-level information
logwarning
(s[, event])logs warning-level information
nullify_contract
(contract)on_contract_cancelled
(contract)Called whenever a concluded contract is not signed (cancelled)
on_contract_concluded
(contract, to_be_signed_at)Called to add a contract to the existing set of contract after it is signed
on_contract_signed
(contract)Called to add a contract to the existing set of contract after it is signed
on_event
(event, sender)order_contracts_for_execution
(contracts)Orders the contracts in a specific time-step that are about to be executed
Called at the end of the simulation step to update all stats
Called at the beginning of the simulation step to prepare stats or update them
read_config
(config[, section])Reads the configuration from a file or a dict and prepares it for parsing
record_bankrupt
(factory)Records agent bankruptcy
register
(x[, simulation_priority])Registers an entity in the world so it can be looked up by name.
register_listener
(event_type, listener)request_negotiation_about
(req_id, caller, …)Requests to start a negotiation with some other agents
run
()Runs the simulation until it ends
run_negotiation
(caller, issues, partners, …)Runs a negotiation until completion
run_negotiations
(caller, issues, partners, …)Requests to run a set of negotiations simultaneously.
save_config
(file_name)Saves the config of the world as a yaml file
set_bulletin_board
(bulletin_board)A single step of the simulation if any
start_contract_execution
(contract)Tries to execute the contract
step
()A single simulation step
Attributes Documentation
-
agreement_rate
¶ Fraction of negotiations ending in agreement and leading to signed contracts
- Return type
-
business_size
¶ The total business size defined as the total money transferred within the system
- Return type
-
cancellation_rate
¶ Fraction of negotiations ending in agreement and leading to signed contracts
- Return type
-
current_step
¶
-
id
¶ The unique ID of this entity
-
log_folder
¶
-
n_negotiation_rounds_successful
¶ Average number of rounds in a successful negotiation
- Return type
-
name
¶ A convenient name of the entity (intended primarily for printing/logging/debugging).
-
relative_time
¶ Returns a number between
0
and1
indicating elapsed relative time or steps.- Return type
-
remaining_steps
¶ Returns the remaining number of steps until the end of the mechanism run. None if unlimited
-
remaining_time
¶ Returns remaining time in seconds. None if no time limit is given.
-
time
¶ Elapsed time since mechanism started in seconds. None if the mechanism did not start running
-
uuid
¶ The unique ID of this entity
-
winners
¶ The winners of this world (factory managers with maximum wallet balance
Methods Documentation
-
add_financial_report
(agent, factory, reports_agent, reports_time)[source]¶ Records a financial report for the given agent in the agent indexed reports and time indexed reports
- Parameters
agent (
SCML2020Agent
) – The agentfactory (
Factory
) – Its factoryreports_agent – A dictionary of financial reports indexed by agent id
reports_time – A dictionary of financial reports indexed by time
Returns:
- Return type
None
-
announce
(event)¶ Raises an event and informs all event sinks that are registerd for notifications on this event type
-
append_stats
()¶
-
breach_record
(breach)[source]¶ Converts a breach to a record suitable for storage during the simulation
-
checkpoint
(path, file_name=None, info=None, exist_ok=False, single_checkpoint=True, step_attribs=('current_step', '_current_step', '_Entity__current_step', '_step'))¶ Saves a checkpoint of the current object at the given path.
- Parameters
path (
Union
[Path
,str
]) – Full path to a directory to store the checkpointfile_name (
Optional
[str
]) – Name of the file to dump into. If not given, a unique name is createdinfo (
Optional
[Dict
[str
,Any
]]) – Information to save with the checkpoint (must be json serializable)exist_ok (
bool
) – If true, override existing dumpsingle_checkpoint (
bool
) – If true, keep a single checkpoint for the last stepstep_attribs (
Tuple
[str
]) – Attributes to represent the time-step of the object. Any of the given attributes will be used in the file name generated if single_checkpoint is False. If single_checkpoint is True, the filename will not contain time-step information
- Return type
- Returns
full path to the file used to save the checkpoint
-
checkpoint_final_step
()¶ Should be called at the end of the simulation to save the final state
- Remarks:
Should be called after all processing of the final step is conducted.
-
classmethod
checkpoint_info
(file_name)¶ Returns the information associated with a dump of the object saved in the given file
Returns:
-
checkpoint_init
(step_attrib='current_step', every=1, folder=None, filename=None, info=None, exist_ok=True, single=True)¶ Initializes the object to automatically save a checkpoint
- Parameters
step_attrib (
str
) – The attribute that defines the current step. If None, there is no step conceptevery (
int
) – Number of steps per checkpoint. If < 1 no checkpoints will be savedfolder (
Union
[str
,Path
,None
]) – The directory to store checkpoints underfilename (
Optional
[str
]) – Name of the file to save the checkpoint under. If None, a unique name will be choosen. Ifsingle_checkpoint
was False, then multiple files will be used prefixed with the step numberinfo (
Optional
[Dict
[str
,Any
]]) – Any extra information to save in the json file associated with each checkpointexist_ok (
bool
) – Override existing files if anysingle (
bool
) – If True, only the most recent checkpoint will be kept
Remarks:
single_checkpoint implies exist_ok
-
checkpoint_on_step_started
()¶ Should be called on every step to save checkpoints as needed.
- Return type
- Returns
The path on which the checkpoint is stored if one is stored. None otherwise.
Remarks:
Should be called at the BEGINNING of every step before any processing takes place
-
compensate
(available, factory)[source]¶ Called by a factory when it is going bankrupt after liquidation
- Parameters
Returns:
- Return type
None
-
complete_contract_execution
(contract, breaches, resolution)[source]¶ Called after breach resolution is completed for contracts for which some potential breaches occurred.
- Parameters
contract (
Contract
) – The contract considered.breaches (
List
[Breach
]) – The list of potential breaches that was generated by_execute_contract
.resolution (
Contract
) – The agreed upon resolution
Returns:
- Return type
None
-
contract_size
(contract)[source]¶ Returns an estimation of the activity level associated with this contract. Higher is better :type contract:
Contract
:param contract:Returns:
- Return type
-
classmethod
create
(*args, **kwargs)¶ Creates an object and returns a proxy to it.
-
delete_executed_contracts
()¶ - Return type
None
-
executable_contracts
()¶ Called at every time-step to get the contracts that are
executable
at this point of the simulation- Return type
Collection
[Contract
]
-
execute_action
(action, agent, callback=None)[source]¶ Executes the given action by the given agent
- Return type
-
classmethod
from_checkpoint
(file_name, return_info=False)¶ Creates an object from a saved checkpoint
- Parameters
- Return type
- Returns
Either the object or the object and dump-info as a dict (if return_info was true)
Remarks:
- If info is returned, it is guaranteed to have the following members:
time: Dump time
type: Type of the dumped object
id: ID
name: name
-
classmethod
from_config
(config, section=None, ignore_children=True, try_parsing_children=True, scope=None)¶ Creates an object of this class given the configuration info
- Parameters
config (
Union
[str
,dict
]) – Either a file name or a dictionarysection (
Optional
[str
]) – A section in the file or a key in the dictionary to use for loading paramsignore_children (
bool
) – If true then children will be ignored and there will be a single returntry_parsing_children (
bool
) – If true the children will first be parsed asConfigReader
classes if they are nottypes (e.g. int, str, float, Iterable[int|str|float] (simple) –
scope – The scope at which to evaluate any child classes. This MUST be passed as scope=globals() if you are
any children that are to be parsed. (having) –
- Returns
An object of cls if ignore_children is True or a tuple with an object of cls and a dictionary with children that were not parsed.
Remarks:
This function will return an object of its class after passing the key-value pairs found in the config to the init function.
Requiring passing scope=globals() to this function is to get around the fact that in python eval() will be called with a globals dictionary based on the module in which the function is defined not called. This means that in general when eval() is called to create the children, it will not have access to the class definitions of these children (except if they happen to be imported in this file). To avoid this problem causing an undefined_name exception, the caller must pass her globals() as the scope.
-
classmethod
generate
(agent_types, agent_params=None, n_steps=100, n_processes=4, n_lines=10, n_agents_per_process=3, process_inputs=1, process_outputs=1, production_costs=(1, 10), profit_means=0.15, profit_stddevs=0.05, max_productivity=(0.8, 1.0), initial_balance=10000, cost_increases_with_level=False, equal_external_supply=False, equal_external_sales=False, cash_availability=1.0, profit_basis=<function mean>, **kwargs)[source]¶ Generates the configuration for a world
- Parameters
agent_types (
List
[Type
[SCML2020Agent
]]) – All agent typesagent_params (
Optional
[List
[Dict
[str
,Any
]]]) – Agent parameters used to initialize themn_steps – Number of simulation steps
n_processes – Number of processes in the production chain
n_lines (
Union
[ndarray
,Tuple
[int
,int
],int
]) – Number of lines per factoryprocess_inputs (
Union
[ndarray
,Tuple
[int
,int
],int
]) – Number of input units per processprocess_outputs (
Union
[ndarray
,Tuple
[int
,int
],int
]) – Number of output units per processproduction_costs (
Union
[ndarray
,Tuple
[int
,int
],int
]) – Production cost per factoryprofit_means (
Union
[ndarray
,Tuple
[float
,float
],float
]) – Mean profitability per production level (i.e. process).profit_stddevs (
Union
[ndarray
,Tuple
[float
,float
],float
]) – Std. Dev. of the profitability of every level (i.e. process).max_productivity (
Union
[ndarray
,Tuple
[float
,float
],float
]) – Maximum possible productivity per level (i.e. process).initial_balance (
Union
[ndarray
,Tuple
[int
,int
],int
,None
]) – The initial balance of all agentsn_agents_per_process (
Union
[ndarray
,Tuple
[int
,int
],int
]) – Number of agents per processcost_increases_with_level – If true, production cost will be higher for processes nearer to the final product.
profit_basis – The statistic used when controlling catalog prices by profit arguments. It can be np.mean, np.median, np.min, np.max or any Callable[[list[float]], float] and is used to summarize production costs at every level.
equal_external_supply – If true, external supply will be distributed equally among all agents in the first layer
equal_external_sales – If true, external sales will be distributed equally among all agents in the last layer
cash_availability – The fraction of the total money needs of the agent to work at maximum capacity that is available as
initial_balance
. This is only effective ifinitial_balance
is set toNone
.**kwargs –
- Return type
- Returns
world configuration as a Dict[str, Any]. A world can be generated from this dict by calling SCML2020World(**d)
Remarks:
Most parameters (i.e.
process_inputs
,process_outputs
,n_agents_per_process
,costs
) can take a single value, a tuple of two values, or a list of values. If it has a single value, it is repeated for all processes/factories as appropriate. If it is a tuple of two numbers $(i, j)$, each process will take a number sampled from a uniform distribution supported on $[i, j]$ inclusive. If it is a list of values, of the lengthn_processes
, it is used as it is otherwise, it is used to sample values for each process.
-
init
(time_field='time')¶
-
join
(x, simulation_priority=0)¶ Add an agent to the world.
- Parameters
x (
Agent
) – The agent to be registeredsimulation_priority (
int
) – The simulation periority. Entities with lower periorities will be stepped first during
Returns:
-
logdebug
(s, event=None)¶ logs debug-level information
- Parameters
s (str) – The string to log
event (Event) – The event to announce after logging
- Return type
None
-
logerror
(s, event=None)¶ logs error-level information
- Parameters
s (str) – The string to log
event (Event) – The event to announce after logging
- Return type
None
-
loginfo
(s, event=None)¶ logs info-level information
- Parameters
s (str) – The string to log
event (Event) – The event to announce after logging
- Return type
None
-
logwarning
(s, event=None)¶ logs warning-level information
- Parameters
s (str) – The string to log
event (Event) – The event to announce after logging
- Return type
None
-
on_contract_cancelled
(contract)¶ Called whenever a concluded contract is not signed (cancelled)
- Parameters
contract – The contract to add
Remarks:
By default this function just adds the contract to the set of contracts maintaned by the world.
You should ALWAYS call this function when overriding it.
-
on_contract_concluded
(contract, to_be_signed_at)[source]¶ Called to add a contract to the existing set of contract after it is signed
- Parameters
contract (
Contract
) – The contract to addto_be_signed_at (
int
) – The timestep at which the contract is to be signed
Remarks:
By default this function just adds the contract to the set of contracts maintaned by the world.
You should ALWAYS call this function when overriding it.
- Return type
None
-
on_contract_signed
(contract)[source]¶ Called to add a contract to the existing set of contract after it is signed
- Parameters
contract (
Contract
) – The contract to add
Remarks:
By default this function just adds the contract to the set of contracts maintaned by the world.
You should ALWAYS call this function when overriding it.
-
on_event
(event, sender)¶
-
order_contracts_for_execution
(contracts)[source]¶ Orders the contracts in a specific time-step that are about to be executed
- Return type
Collection
[Contract
]
-
pre_step_stats
()[source]¶ Called at the beginning of the simulation step to prepare stats or update them
-
classmethod
read_config
(config, section=None)¶ Reads the configuration from a file or a dict and prepares it for parsing
- Parameters
- Return type
- Returns
A dict ready to be parsed by from_config
Remarks:
-
register
(x, simulation_priority=0)¶ Registers an entity in the world so it can be looked up by name. Should not be called directly
- Parameters
x (
Entity
) – The entity to be registeredsimulation_priority (
int
) – The simulation periority. Entities with lower periorities will be stepped first during
Returns:
-
register_listener
(event_type, listener)¶
-
register_stats_monitor
(m)¶
-
register_world_monitor
(m)¶
-
request_negotiation_about
(req_id, caller, issues, partners, roles=None, annotation=None, mechanism_name=None, mechanism_params=None)¶ Requests to start a negotiation with some other agents
- Parameters
req_id (
str
) – An ID For the request that is unique to the callercaller (
Agent
) – The agent requesting the negotiationpartners (
List
[Agent
]) – The list of partners that the agent wants to negotiate with. Roles will be determined by these agents.issues (
List
[Issue
]) – Negotiation issuesannotation (
Optional
[Dict
[str
,Any
]]) – Extra information to be passed to thepartners
when asking them to join the negotiationpartners – A list of partners to participate in the negotiation
roles (
Optional
[List
[str
]]) – The roles of different partners. If None then each role for each partner will be Nonemechanism_name (
Optional
[str
]) – Name of the mechanism to use. It must be one of the mechanism_names that are supported by theor None which means that the World should select the mechanism. If None, then roles and my_role (World) –
also be None (must) –
mechanism_params (
Optional
[Dict
[str
,Any
]]) – A dict of parameters used to initialize the mechanism object
- Return type
- Returns
None. The caller will be informed by a callback function
on_neg_request_accepted
oron_neg_request_rejected
about the status of the negotiation.
-
run
()¶ Runs the simulation until it ends
-
run_negotiation
(caller, issues, partners, negotiator, ufun=None, caller_role=None, roles=None, annotation=None, mechanism_name=None, mechanism_params=None)¶ Runs a negotiation until completion
- Parameters
caller (
Agent
) – The agent requesting the negotiationpartners (
Collection
[Agent
]) – The list of partners that the agent wants to negotiate with. Roles will be determined by these agents.negotiator (
Negotiator
) – The negotiator to be used in the negotiationufun (
Optional
[UtilityFunction
]) – The utility function. Only needed if the negotiator does not already know itcaller_role (
Optional
[str
]) – The role of the caller in the negotiationissues (
Collection
[Issue
]) – Negotiation issuesannotation (
Optional
[Dict
[str
,Any
]]) – Extra information to be passed to thepartners
when asking them to join the negotiationpartners – A list of partners to participate in the negotiation
roles (
Optional
[Collection
[str
]]) – The roles of different partners. If None then each role for each partner will be Nonemechanism_name (
Optional
[str
]) – Name of the mechanism to use. It must be one of the mechanism_names that are supported by theor None which means that the World should select the mechanism. If None, then roles and my_role (World) –
also be None (must) –
mechanism_params (
Optional
[Dict
[str
,Any
]]) – A dict of parameters used to initialize the mechanism object
- Return type
- Returns
A Tuple of a contract and the ami of the mechanism used to get it in case of success. None otherwise
-
run_negotiations
(caller, issues, partners, negotiators, ufuns=None, caller_roles=None, roles=None, annotations=None, mechanism_names=None, mechanism_params=None, all_or_none=False)¶ Requests to run a set of negotiations simultaneously. Returns after all negotiations are run to completion
- Parameters
caller (
Agent
) – The agent requesting the negotiationpartners (
List
[List
[Agent
]]) – The list of partners that the agent wants to negotiate with. Roles will be determined by these agents.issues (
Union
[List
[Issue
],List
[List
[Issue
]]]) – Negotiation issuesnegotiators (
List
[Negotiator
]) – The negotiator to be used in the negotiationufuns (
Optional
[List
[UtilityFunction
]]) – The utility function. Only needed if the negotiator does not already know itcaller_roles (
Optional
[List
[str
]]) – The role of the caller in the negotiationannotations (
Optional
[List
[Optional
[Dict
[str
,Any
]]]]) – Extra information to be passed to thepartners
when asking them to join the negotiationpartners – A list of partners to participate in the negotiation
roles (
Optional
[List
[Optional
[List
[str
]]]]) – The roles of different partners. If None then each role for each partner will be Nonemechanism_names (
Union
[str
,List
[str
],None
]) – Name of the mechanism to use. It must be one of the mechanism_names that are supported by theor None which means that the World should select the mechanism. If None, then roles and my_role (World) –
also be None (must) –
mechanism_params (
Union
[Dict
[str
,Any
],List
[Dict
[str
,Any
]],None
]) – A dict of parameters used to initialize the mechanism objectall_of_none – If True, ALL partners must agree to negotiate to go through.
- Returns
contract (None for failure) and ami (The mechanism info [None if the partner refused the negotiation])
- Return type
A list of tuples each with two values
-
save_config
(file_name)¶ Saves the config of the world as a yaml file
- Parameters
file_name (
str
) – Name of file to save the config to
Returns:
-
set_bulletin_board
(bulletin_board)¶
-
start_contract_execution
(contract)[source]¶ Tries to execute the contract
- Parameters
contract (
Contract
) –- Returns
The set of breaches committed if any. If there are no breaches return an empty set
- Return type
Set[Breach]
Remarks:
You must call super() implementation of this method before doing anything
-
unregister_stats_monitor
(m)¶
-
unregister_world_monitor
(m)¶