NegMAS wrappers for NegoLog negotiating agents
Project description
negmas-negolog
A bridge between NegMAS and NegoLog negotiation frameworks, allowing NegoLog agents to be used as NegMAS SAONegotiator instances.
NegoLog Attribution
This package vendors NegoLog — an integrated Python-based automated negotiation framework.
- Source Repository: https://github.com/aniltrue/NegoLog
- License: GPL-3.0
- Copyright: (C) 2024 Anıl Doğru, M. Onur Keskin & Reyhan Aydoğan
NegoLog was presented at IJCAI 2024. If you use this package, please cite the original NegoLog paper as well as NegMAS (see Citation):
@inproceedings{ijcai2024p998,
title = {NegoLog: An Integrated Python-based Automated Negotiation Framework with Enhanced Assessment Components},
author = {Doğru, Anıl and Keskin, Mehmet Onur and Jonker, Catholijn M. and Baarslag, Tim and Aydoğan, Reyhan},
booktitle = {Proceedings of the Thirty-Third International Joint Conference on
Artificial Intelligence, {IJCAI-24}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {Kate Larson},
pages = {8640--8643},
year = {2024},
month = {8},
note = {Demo Track},
doi = {10.24963/ijcai.2024/998},
url = {https://doi.org/10.24963/ijcai.2024/998},
}
Features
- 25 NegoLog agents available as NegMAS negotiators
- Seamless integration with NegMAS mechanisms and tournaments
- Full compatibility with NegMAS utility functions and outcome spaces
- Zero configuration - agents work out of the box
Installation
pip install negmas-negolog
Or with uv:
uv add negmas-negolog
Development Installation
git clone https://github.com/yasserfarouk/negmas-negolog.git
cd negmas-negolog
uv sync --dev
Quick Start
from negmas.outcomes import make_issue
from negmas.preferences import LinearAdditiveUtilityFunction
from negmas.sao import SAOMechanism
from negmas_negolog import BoulwareAgent, ConcederAgent
# Define negotiation issues
issues = [
make_issue(values=["low", "medium", "high"], name="price"),
make_issue(values=["1", "2", "3"], name="quantity"),
]
# Create utility functions
buyer_ufun = LinearAdditiveUtilityFunction(
values={
"price": {"low": 1.0, "medium": 0.5, "high": 0.0},
"quantity": {"1": 0.0, "2": 0.5, "3": 1.0},
},
weights={"price": 0.6, "quantity": 0.4},
)
seller_ufun = LinearAdditiveUtilityFunction(
values={
"price": {"low": 0.0, "medium": 0.5, "high": 1.0},
"quantity": {"1": 1.0, "2": 0.5, "3": 0.0},
},
weights={"price": 0.6, "quantity": 0.4},
)
# Create mechanism and add agents
mechanism = SAOMechanism(issues=issues, n_steps=100)
mechanism.add(BoulwareAgent(name="buyer"), preferences=buyer_ufun)
mechanism.add(ConcederAgent(name="seller"), preferences=seller_ufun)
# Run negotiation
state = mechanism.run()
if state.agreement:
print(f"Agreement reached: {state.agreement}")
print(f"Buyer utility: {buyer_ufun(state.agreement):.3f}")
print(f"Seller utility: {seller_ufun(state.agreement):.3f}")
else:
print("No agreement reached")
Available Agents
Time-Based Concession Agents
| Agent | Description |
|---|---|
BoulwareAgent |
Concedes slowly (sub-linearly), using Bezier curve-based target utility |
ConcederAgent |
Concedes quickly (super-linearly) |
LinearAgent |
Concedes linearly over time |
ANAC Competition Agents
| Agent | Description |
|---|---|
Atlas3Agent |
ANAC 2015 competition winner |
HardHeaded |
ANAC 2011 competition winner, uses frequency-based opponent modeling |
NiceTitForTat |
Tit-for-tat strategy aiming for Nash point, uses Bayesian opponent modeling |
AgentGG |
ANAC competition agent |
AgentKN |
ANAC competition agent |
AgentBuyog |
ANAC competition agent |
AhBuNeAgent |
ANAC competition agent |
Caduceus |
ANAC competition agent |
Caduceus2015 |
ANAC 2015 competition agent |
CUHKAgent |
ANAC agent from Chinese University of Hong Kong |
HybridAgent |
Combines multiple negotiation strategies |
IAMhaggler |
ANAC agent from University of Southampton |
Kawaii |
ANAC competition agent |
LuckyAgent2022 |
ANAC 2022 competition agent |
MICROAgent |
ANAC agent using opponent modeling |
ParsAgent |
ANAC agent from Amirkabir University |
ParsCatAgent |
ANAC agent from Amirkabir University |
PonPokoAgent |
ANAC competition agent |
RandomDance |
ANAC competition agent |
Rubick |
ANAC competition agent |
SAGAAgent |
Uses genetic algorithm for bid selection |
YXAgent |
ANAC competition agent |
Mixing with NegMAS Agents
NegoLog agents can negotiate with native NegMAS agents:
from negmas.sao import AspirationNegotiator
from negmas_negolog import BoulwareAgent
mechanism = SAOMechanism(issues=issues, n_steps=100)
mechanism.add(BoulwareAgent(name="negolog_agent"), preferences=ufun1)
mechanism.add(AspirationNegotiator(name="negmas_agent"), preferences=ufun2)
state = mechanism.run()
Running Tournaments
from negmas.sao import SAOMechanism
from negmas_negolog import (
BoulwareAgent, ConcederAgent, LinearAgent,
Atlas3Agent, HardHeaded, NiceTitForTat
)
agents = [
BoulwareAgent, ConcederAgent, LinearAgent,
Atlas3Agent, HardHeaded, NiceTitForTat
]
# Run round-robin tournament
results = []
for i, AgentA in enumerate(agents):
for AgentB in agents[i+1:]:
mechanism = SAOMechanism(issues=issues, n_steps=100)
mechanism.add(AgentA(name="A"), preferences=ufun1)
mechanism.add(AgentB(name="B"), preferences=ufun2)
state = mechanism.run()
results.append({
"agent_a": AgentA.__name__,
"agent_b": AgentB.__name__,
"agreement": state.agreement is not None,
})
API Reference
Base Classes
NegologNegotiatorWrapper
Base class for all NegoLog agent wrappers. Inherits from negmas.sao.SAONegotiator.
class NegologNegotiatorWrapper(SAONegotiator):
def __init__(
self,
preferences: BaseUtilityFunction | None = None,
ufun: BaseUtilityFunction | None = None,
name: str | None = None,
session_time: int = 180, # Session time in seconds for NegoLog agent
**kwargs,
): ...
NegologPreferenceAdapter
Adapts NegMAS utility functions to NegoLog's Preference interface. Used internally by the wrappers.
Creating Custom Wrappers
To wrap additional NegoLog agents:
from negmas_negolog import NegologNegotiatorWrapper
from agents.MyAgent.MyAgent import MyAgent as NLMyAgent
class MyAgent(NegologNegotiatorWrapper):
"""NegMAS wrapper for NegoLog's MyAgent."""
negolog_agent_class = NLMyAgent
Development
Running Tests
uv run pytest tests/ -v
Running Specific Test Files
uv run pytest tests/test_wrapper.py -v # Wrapper functionality tests
uv run pytest tests/test_equivalence.py -v # Native vs wrapped comparison tests
Architecture
negmas-negolog/
├── src/negmas_negolog/
│ ├── __init__.py # Package exports
│ └── wrapper.py # Wrapper implementation
├── vendor/NegoLog/ # Vendored NegoLog library
│ ├── agents/ # NegoLog agent implementations
│ └── nenv/ # NegoLog environment
└── tests/
├── test_wrapper.py # Wrapper tests
└── test_equivalence.py # Equivalence tests
How It Works
-
Preference Adaptation:
NegologPreferenceAdapterwraps NegMAS utility functions to provide NegoLog'sPreferenceinterface, allowing NegoLog agents to evaluate bids using NegMAS utility functions. -
Bid/Outcome Conversion: The wrapper handles conversion between NegMAS
Outcometuples and NegoLogBidobjects. -
Time Mapping: NegMAS relative time (0 to 1) is passed directly to NegoLog agents, which use it for their concession strategies.
-
Action Translation: NegoLog
OfferandAcceptactions are translated to NegMASpropose()returns andResponseTypevalues.
License
AGPL-3.0 License - see LICENSE for details.
Acknowledgments
- NegMAS - Negotiation Managed by Situated Agents
- NegoLog - Negotiation Environment for Learning and Optimization (see NegoLog Attribution above)
Citation
If you use this library in your research, please cite this wrapper, NegMAS, and the original NegoLog paper:
@software{negmas_negolog,
title = {negmas-negolog: Bridge between NegMAS and NegoLog},
author = {Mohammad, Yasser},
year = {2024},
url = {https://github.com/yasserfarouk/negmas-negolog}
}
@inproceedings{mohammad2018negmas,
title = {NegMAS: A Platform for Situated Negotiations},
author = {Mohammad, Yasser and Greenwald, Amy and Nakadai, Shinji},
booktitle = {ACAN Workshop at IJCAI},
year = {2018},
url = {https://github.com/yasserfarouk/negmas}
}
@inproceedings{ijcai2024p998,
title = {NegoLog: An Integrated Python-based Automated Negotiation Framework with Enhanced Assessment Components},
author = {Doğru, Anıl and Keskin, Mehmet Onur and Jonker, Catholijn M. and Baarslag, Tim and Aydoğan, Reyhan},
booktitle = {Proceedings of the Thirty-Third International Joint Conference on
Artificial Intelligence, {IJCAI-24}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {Kate Larson},
pages = {8640--8643},
year = {2024},
month = {8},
note = {Demo Track},
doi = {10.24963/ijcai.2024/998},
url = {https://doi.org/10.24963/ijcai.2024/998},
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file negmas_negolog-0.1.2.tar.gz.
File metadata
- Download URL: negmas_negolog-0.1.2.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2b09f23c8bc15893fb44a874e17fff94b014ea8fcb127aa7842749062136a14
|
|
| MD5 |
ebf998ac89df7926bbe806eb90471f93
|
|
| BLAKE2b-256 |
b80c6687250d64898d3573234b987cdb8bbba264542c908c9dfbc97b285e44ec
|
Provenance
The following attestation bundles were made for negmas_negolog-0.1.2.tar.gz:
Publisher:
publish.yml on autoneg/negmas-negolog
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
negmas_negolog-0.1.2.tar.gz -
Subject digest:
f2b09f23c8bc15893fb44a874e17fff94b014ea8fcb127aa7842749062136a14 - Sigstore transparency entry: 813112709
- Sigstore integration time:
-
Permalink:
autoneg/negmas-negolog@328794162254737ec9099b668ed61ab8651c12f7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/autoneg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@328794162254737ec9099b668ed61ab8651c12f7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file negmas_negolog-0.1.2-py3-none-any.whl.
File metadata
- Download URL: negmas_negolog-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61ab6039bdce2fb50a880ec757d517605380876489e737b908ffeaf6083a7148
|
|
| MD5 |
195d79488f13ed38f0d239f28a87084a
|
|
| BLAKE2b-256 |
4435e6f57abe7179e042a0a9fa0754fd9eb0334802c90bc12a2e24d9b1479e28
|
Provenance
The following attestation bundles were made for negmas_negolog-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on autoneg/negmas-negolog
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
negmas_negolog-0.1.2-py3-none-any.whl -
Subject digest:
61ab6039bdce2fb50a880ec757d517605380876489e737b908ffeaf6083a7148 - Sigstore transparency entry: 813112710
- Sigstore integration time:
-
Permalink:
autoneg/negmas-negolog@328794162254737ec9099b668ed61ab8651c12f7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/autoneg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@328794162254737ec9099b668ed61ab8651c12f7 -
Trigger Event:
push
-
Statement type: