Skip to main content

NEGotiations Managed by Agent Simulations

Project description

Python Pypi License Downloads Coveage Code Quality Pypi Build Status Documentation Status

NegMAS is a python library for developing autonomous negotiation agents embedded in simulation environments. The name negmas stands for either NEGotiation MultiAgent System or NEGotiations Managed by Agent Simulations (your pick). The main goald of NegMAS is to advance the state of the art in situated simultaneous negotiations. Nevertheless, it can; and was used; in modeling simpler bilateral and multi-lateral negotiations, preference elicitation , etc.

Introduction

This package was designed to help advance the state-of-art in negotiation research by providing an easy-to-use yet powerful platform for autonomous negotiation targeting situated simultaneous negotiations. It grew out of the NEC-AIST collaborative laboratory project.

By situated negotiations, we mean those for which utility functions are not pre-ordained by fiat but are a natural result of a simulated business-like process.

By simultaneous negotiations, we mean sessions of dependent negotiations for which the utility value of an agreement of one session is affected by what happens in other sessions.

The documentation is available at: documentation

Main Features

This platform was designed with both flexibility and scalability in mind. The key features of the NegMAS package are:

  1. The public API is decoupled from internal details allowing for scalable implementations of the same interaction protocols.

  2. Supports agents engaging in multiple concurrent negotiations.

  3. Provides support for inter-negotiation synchronization either through coupled utility functions or through central control agents.

  4. The package provides sample negotiators that can be used as templates for more complex negotiators.

  5. The package supports both mediated and unmediated negotiations.

  6. Supports both bilateral and multilateral negotiations.

  7. Novel negotiation protocols and simulated worlds can be added to the package as easily as adding novel negotiators.

  8. Allows for non-traditional negotiation scenarios including dynamic entry/exit from the negotiation.

  9. A large variety of built in utility functions.

  10. Utility functions can be active dynamic entities which allows the system to model a much wider range of dynamic ufuns compared with existing packages.

  11. A distributed system with the same interface and industrial-strength implementation is being created allowing agents developed for NegMAS to be seemingly employed in real-world business operations.

To use negmas in a project

import negmas

The package was designed for many uses cases. On one extreme, it can be used by an end user who is interested in running one of the built-in negotiation protocols. On the other extreme, it can be used to develop novel kinds of negotiation agents, negotiation protocols, multi-agent simulations (usually involving situated negotiations), etc.

Running existing negotiators/negotiation protocols

Using the package for negotiation can be as simple as the following code snippet:

from negmas import SAOMechanism, AspirationNegotiator, MappingUtilityFunction
session = SAOMechanism(outcomes=10, n_steps=100)
negotiators = [AspirationNegotiator(name=f'a{_}') for _ in range(5)]
for negotiator in negotiators:
    session.add(negotiator, ufun=MappingUtilityFunction(lambda x: random.random() * x[0]))

session.run()

In this snippet, we created a mechanism session with an outcome-space of 10 discrete outcomes that would run for 10 steps. Five agents with random utility functions are then created and added to the session. Finally the session is run to completion. The agreement (if any) can then be accessed through the state member of the session. The library provides several analytic and visualization tools to inspect negotiations. See the first tutorial on Running a Negotiation for more details.

Developing a negotiator

Developing a novel negotiator slightly more difficult by is still doable in few lines of code:

from negmas.sao import SAONegotiator
from negmas import ResponseType
class MyAwsomeNegotiator(SAONegotiator):
    def __init__(self):
        # initialize the parents
        super().__init__(self)

    def respond(self, offer, state):
        # decide what to do when receiving an offer
        return ResponseType.ACCEPT_OFFER

    def propose(self, state):
        # proposed the required number of proposals (or less)
        pass

By just implementing respond() and propose(). This negotiator is now capable of engaging in alternating offers negotiations. See the documentation of Negotiator for a full description of available functionality out of the box.

Developing a negotiation protocol

Developing a novel negotiation protocol is actually even simpler:

from negmas.mechanisms import Mechanism

class MyNovelProtocol(Mechanism):
    def __init__(self):
        super().__init__()

    def round(self):
        # one step of the protocol
        pass

By implementing the single round() function, a new protocol is created. New negotiators can be added to the negotiation using add() and removed using remove(). See the documentation for a full description of Mechanism available functionality out of the box [Alternatively you can use Protocol instead of Mechanism].

Running a world simulation

The raison d’être for NegMAS is to allow you to develop negotiation agents capable of behaving in realistic business like simulated environments. These simulations are called worlds in NegMAS. Agents interact with each other within these simulated environments trying to maximize some intrinsic utility function of the agent through several possibly simultaneous negotiations.

The situated module provides all that you need to create such worlds. An example can be found in the scml package. This package implements a supply chain management system in which factory managers compete to maximize their profits in a market with only negotiations as the means of securing contracts.

Acknowledgement

NegMAS tests use scenarios used in ANAC 2010 to ANAC 2018 competitions obtained from the Genius Platform. These domains can be found in the tests/data and notebooks/data folders.

Project details


Release history Release notifications | RSS feed

This version

0.2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

negmas-0.2.0.tar.gz (437.7 kB view details)

Uploaded Source

Built Distribution

negmas-0.2.0-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file negmas-0.2.0.tar.gz.

File metadata

  • Download URL: negmas-0.2.0.tar.gz
  • Upload date:
  • Size: 437.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/3.7.1 Darwin/18.2.0

File hashes

Hashes for negmas-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3b29cdd8b2370821f7ca445accfa79832a9ebdf01c97a72a1f183b60448fdd68
MD5 1deb657acb4739d1e38e61141f23d276
BLAKE2b-256 2bc46c5bfbc4253d6b2873e37ec73a3eaac3514aeaab1d2d0d69a22a41970df2

See more details on using hashes here.

File details

Details for the file negmas-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: negmas-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/3.7.1 Darwin/18.2.0

File hashes

Hashes for negmas-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef848b64f3cd19de7d922cb76647d18e7837134dce69a04add0d41b32fb36d64
MD5 d5ab6d6bf7a93f7a52ebe3d31ab09ea3
BLAKE2b-256 35fdccc199aedb59f6bae9cd9745909a481bda2f3c3ec65439ee56628290656f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page