NegWorld

class negmas.situated.NegWorld(*args, domain: negmas.situated.NegDomain, types: List[Union[negmas.negotiators.Negotiator, negmas.situated.NegAgent]], params: Optional[List[Optional[Dict[str, Any]]]] = None, agent_names_reveal_type: bool = True, compact: bool = False, no_logs: bool = False, normalize_scores: bool = False, **kwargs)[source]

Bases: negmas.situated.NoContractExecutionMixin, negmas.situated.World

A world that runs a list of negotiators in a given domain to evaluate them

Parameters
  • domain – The NegDomain specifying all information about the situation in which negotiators are to be evaluated including the partners.

  • types – The negotiator types to be evaluated

  • params – Any parameters needed to create negotiators

  • agent_names_reveal_type – if given the agent name for each negotiator will simply be the negotiator’s type

  • compact – If given the system will strive to save memory and minimize logging

  • no_logs – disables all logging

  • kwargs – Any extra arguments to be passed to the World constructor

Attributes Summary

competitors

partners

Methods Summary

breach_record(breach)

Converts a breach to a record suitable for storage during the simulation

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.

delete_executed_contracts()

Called after processing executable contracts at every simulation step to delete processed contracts

executable_contracts()

Called at every time-step to get the contracts that are executable at this point of the simulation

execute_action(action, agent[, callback])

Executes the given action by the given agent

get_private_state(agent)

Reads the private state of the given agent

order_contracts_for_execution(contracts)

Orders the contracts in a specific time-step that are about to be executed

partner_advantage(aid)

partner_utility(aid)

post_step_stats()

Called at the end of the simulation step to update all stats

pre_step_stats()

Called at the beginning of the simulation step to prepare stats or update them

received_advantage(aid)

received_utility(aid)

simulation_step(stage)

A single step of the simulation.

start_contract_execution(contract)

Tries to execute the contract

Attributes Documentation

competitors
partners

Methods Documentation

breach_record(breach: negmas.situated.Breach)Dict[str, Any][source]

Converts a breach to a record suitable for storage during the simulation

complete_contract_execution(contract: negmas.situated.Contract, breaches: List[negmas.situated.Breach], resolution: negmas.situated.Contract)None[source]

Called after breach resolution is completed for contracts for which some potential breaches occurred.

Parameters
  • contract – The contract considered.

  • breaches – The list of potential breaches that was generated by _execute_contract.

  • resolution – The agreed upon resolution

Returns:

contract_record(contract: negmas.situated.Contract)Dict[str, Any][source]

Converts a contract to a record suitable for permanent storage

contract_size(contract: negmas.situated.Contract)float[source]

Returns an estimation of the activity level associated with this contract. Higher is better :param contract:

Returns:

delete_executed_contracts()None[source]

Called after processing executable contracts at every simulation step to delete processed contracts

executable_contracts()Collection[negmas.situated.Contract][source]

Called at every time-step to get the contracts that are executable at this point of the simulation

execute_action(action: negmas.situated.Action, agent: negmas.situated.Agent, callback: Optional[Callable] = None)bool[source]

Executes the given action by the given agent

get_private_state(agent: negmas.situated.Agent)dict[source]

Reads the private state of the given agent

order_contracts_for_execution(contracts: Collection[negmas.situated.Contract])Collection[negmas.situated.Contract][source]

Orders the contracts in a specific time-step that are about to be executed

partner_advantage(aid: str)[source]
partner_utility(aid: str)[source]
post_step_stats()[source]

Called at the end of the simulation step to update all stats

Kept for backward compatibility and will be dropped. Override update_stats ins

pre_step_stats()[source]

Called at the beginning of the simulation step to prepare stats or update them

Kept for backward compatibility and will be dropped. Override update_stats instead

received_advantage(aid: str)[source]
received_utility(aid: str)[source]
simulation_step(stage)[source]

A single step of the simulation.

Parameters

stage – How many times so far was this method called within the current simulation step

Remarks:

  • Using the stage parameter, it is possible to have Operations . SimulationStep several times with the list of operations while differentiating between these calls.

start_contract_execution(contract: negmas.situated.Contract)Set[negmas.situated.Breach][source]

Tries to execute the contract

Parameters

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

  • It is possible to return None which indicates that the contract was nullified (i.e. not executed due to a reason other than an execution exeception).