negmas.situated Package

This module defines the base classes for worlds within which multiple agents engage in situated negotiations

The Agent class encapsulates the managing entity that creates negotiators to engage in negotiations within a world Simulation in order to maximize its own total utility.

Remarks:

  • When immediate_negotiations is true, negotiations start in the same step they are registered in (they may also end in that step) and negotiation_speed_multiple steps of it are conducted. That entails that requesting a negotiation may result in new contracts in the same time-step only of immediate_negotiations is true.

Simulation steps:

It is possible to control the order of the simulation steps differently using the operations parameter to the world constructor. this is the default order

  1. prepare custom stats (call _pre_step_stats)

  2. step all existing negotiations negotiation_speed_multiple times handling any failed negotiations and creating contracts for any resulting agreements

  3. Allow custom simulation (call simulation_step ) with stage 0

  4. run all Entity objects registered (i.e. all agents) in the predefined simulation_order.

  5. sign contracts that are to be signed at this step calling on_contracts_finalized / on_contract_signed as needed

  6. execute contracts that are executable at this time-step handling any breaches

  7. allow custom simulation steps to run (call simulation_step ) with stage 1

  8. remove any negotiations that are completed!

  9. update basic stats

  10. update custom stats (call _post_step_stats)

Monitoring a simulation:

You can monitor a running simulation using a WorldMonitor or StatsMonitor object. The former monitors events in the world while the later monitors the statistics of the simulation. This is a list of some of the events that can be monitored by WorldMonitor . World designers can add new events either by announcing them using announce or as a side-effect of logging them using any of the log functions.

Event

Data

extra-step

none

mechanism-creation-exception

exception: Exception

zero-outcomes-negotiation

caller: Agent, partners: List[Agent] , annotation: Dictionary displays [ str, Any ]

entity-exception

exception: Exception

contract-exception

contract: Contract, exception: Exception

agent-exception

method: str , exception: Exception

agent-joined

agent: Agent

negotiation-request

caller: Agent , partners: List [ Agent ], issues: List [ Issue ] , mechanism_name: str , annotation: Dictionary displays [ str, Any ], req_id: str

negotiation-request-immediate

caller: Agent , partners: List [ Agent ], issues: List [ Issue ] , mechanism_name: str , annotation: Dictionary displays [ str, Any ]

negotiation-request-rejected

caller: Agent , partners: List [ Agent ] , req_id: str , rejectors: List [ Agent ] , annotation: Dictionary displays [ str, Any ]

negotiation-request-accepted

caller: Agent , partners: List [ Agent ] , req_id: str , mechanism: Mechanism , annotation: Dictionary displays [ str, Any ]

negotiation-success

mechanism: Mechanism , contract: Contract , partners: List [ Agent ]

negotiation-failure

mechanism: Mechanism , partners: List [ Agent ]

contract-executing

contract: Contract

contract-nullified

contract: Contract

contract-breached

contract: Contract, breach: Breach

breach-resolved

contract: Contract, breaches: List[Breach], resolution

contract-executed

contract: Contract

dropped-contract

contract: Contract

Functions

safe_min(a, b)

Returns min(a, b) assuming None is less than anything.

deflistdict()

show_edge_colors()

Plots the edge colors used with their meaning

save_stats(world, log_dir[, params, ...])

Saves the statistics of a world run.

Classes

RunningNegotiationInfo(negotiator, ...)

Keeps track of running negotiations for an agent

NegotiationRequestInfo(partners, issues, ...)

Keeps track to negotiation requests that an agent sent

RenegotiationRequest(publisher, issues[, ...])

A request for renegotiation.

NegotiationInfo(mechanism, partners, ...[, ...])

Saves information about a negotiation

Operations(value[, names, module, qualname, ...])

Action(type, params)

An action that an Agent can execute in a World through the Simulator.

Adapter(obj[, include_adapter_type_name, ...])

Represents an adapter agent that makes some included object act as an agent in some world.

Agent([name, type_postfix, preferences, ufun])

Base class for all agents that can run within a World and engage in situated negotiations

Entity([type_postfix])

Defines an entity that is a part of the world but does not participate in the simulation

AgentWorldInterface(world, agent)

Agent World Interface class

BreachProcessing(value[, names, module, ...])

The way breaches are to be handled

Breach(contract, perpetrator, type[, ...])

BulletinBoard()

The bulletin-board which carries all public information.

Contract([agreement, partners, annotation, ...])

A agreement definition which encapsulates an agreement with partners and extra information

MechanismFactory(world, mechanism_name, ...)

A mechanism creation class.

TimeInAgreementMixin()

NoContractExecutionMixin()

A mixin to add when there is no contract execution

NoResponsesMixin()

A mixin that can be added to Agent to minimize the number of abstract methods

StatsMonitor([type_postfix])

A monitor object capable of receiving stats of a world

WorldMonitor([type_postfix])

A monitor object capable of monitoring a world.

World([bulletin_board, n_steps, time_limit, ...])

Base world class encapsulating a world that runs a simulation with several agents interacting within some dynamically changing environment.

SimpleWorld([bulletin_board, n_steps, ...])

Represents a simple world with no simulation and sane values for most callbacks and methods.

NegWorld(*args, scenario, types[, params, ...])

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

NegAgent(*args, negotiator_type[, ...])

Wraps a negotiator for evaluaton

Condition(name, issues, ufuns, partner_types)

A representation of a negotiation scenario in which a negotiator can be evaluated

Class Inheritance Diagram

Inheritance diagram of negmas.situated.common.RunningNegotiationInfo, negmas.situated.common.NegotiationRequestInfo, negmas.situated.common.RenegotiationRequest, negmas.situated.common.NegotiationInfo, negmas.situated.common.Operations, negmas.situated.action.Action, negmas.situated.adapter.Adapter, negmas.situated.agent.Agent, negmas.situated.entity.Entity, negmas.situated.awi.AgentWorldInterface, negmas.situated.breaches.BreachProcessing, negmas.situated.breaches.Breach, negmas.situated.bulletinboard.BulletinBoard, negmas.situated.contract.Contract, negmas.situated.mechanismfactory.MechanismFactory, negmas.situated.mixins.TimeInAgreementMixin, negmas.situated.mixins.NoContractExecutionMixin, negmas.situated.mixins.NoResponsesMixin, negmas.situated.monitors.StatsMonitor, negmas.situated.monitors.WorldMonitor, negmas.situated.world.World, negmas.situated.simple.SimpleWorld, negmas.situated.neg.NegWorld, negmas.situated.neg.NegAgent, negmas.situated.neg.Condition