Python reimplementations of Genius negotiating agents for NegMAS
Project description
negmas-genius-agents
Python reimplementations of Genius negotiating agents for use with the NegMAS framework.
IMPORTANT NOTICE: AI-ASSISTED IMPLEMENTATION
The agents in this package were reimplemented from Java to Python with the assistance of AI (Large Language Models). While efforts have been made to faithfully reproduce the original agent behaviors, these implementations may not behave identically to the original Genius agents in all cases.
If you require guaranteed behavioral equivalence with the original Java implementations, please use the GeniusNegotiator wrapper in NegMAS, which runs the actual Java agents via a bridge.
Bug reports and contributions to improve behavioral fidelity are welcome.
Genius Attribution
This package provides Python reimplementations of agents originally developed for Genius (General Environment for Negotiation with Intelligent multi-purpose Usage Simulation) — a Java-based automated negotiation framework developed at TU Delft.
- Original Source: http://ii.tudelft.nl/genius/
- Original License: GPL-3.0
- Original Version: 10.4
Genius has been the standard platform for the ANAC (Automated Negotiating Agents Competition) since 2010. The agents in this package have been reimplemented in Python to provide native NegMAS compatibility without requiring Java.
If you use this package, please cite Genius:
@article{lin2014genius,
title={Genius: An integrated environment for supporting the design of generic automated negotiators},
author={Lin, Raz and Kraus, Sarit and Baarslag, Tim and Tykhonov, Dmytro and Hindriks, Koen and Jonker, Catholijn M},
journal={Computational Intelligence},
volume={30},
number={1},
pages={48--70},
year={2014},
publisher={Wiley Online Library}
}
Features
- Pure Python - No Java dependency required
- ANAC Competition Agents from 2010-2019 reimplemented as native NegMAS negotiators
- Seamless integration with NegMAS mechanisms and tournaments
- Full compatibility with NegMAS utility functions and outcome spaces
- Faithful reimplementations - Behavior matches the original Java agents
Installation
pip install negmas-genius-agents
Or with uv:
uv add negmas-genius-agents
Requirements
- Python >= 3.10
- NegMAS >= 0.10.0
Development Installation
git clone https://github.com/yasserfarouk/negmas-genius-agents.git
cd negmas-genius-agents
uv sync --dev
Quick Start
from negmas.outcomes import make_issue
from negmas.preferences import LinearAdditiveUtilityFunction
from negmas.sao import SAOMechanism
from negmas_genius_agents 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 (e=0.2), tough negotiator |
ConcederAgent |
Concedes quickly (e=2.0), cooperative negotiator |
LinearAgent |
Linear concession over time (e=1.0) |
HardlinerAgent |
Never concedes (e=0), always offers maximum utility |
ANAC 2011 Agents
| Agent | Description |
|---|---|
HardHeaded |
Winner - Frequency-based opponent modeling |
Gahboninho |
Runner-up - Adaptive strategy |
NiceTitForTat |
Tit-for-tat strategy aiming for Nash point |
ANAC 2012 Agents
| Agent | Description |
|---|---|
CUHKAgent |
Winner - Chinese University of Hong Kong |
AgentLG |
Competition agent |
(More agents will be added in future releases)
Mixing with NegMAS Agents
Genius agents can negotiate with native NegMAS agents:
from negmas.sao import AspirationNegotiator
from negmas_genius_agents import HardHeaded
mechanism = SAOMechanism(issues=issues, n_steps=100)
mechanism.add(HardHeaded(name="genius_agent"), preferences=ufun1)
mechanism.add(AspirationNegotiator(name="negmas_agent"), preferences=ufun2)
state = mechanism.run()
Running Tournaments
from negmas.sao import SAOMechanism
from negmas_genius_agents import (
BoulwareAgent, ConcederAgent, LinearAgent, HardlinerAgent
)
agents = [BoulwareAgent, ConcederAgent, LinearAgent, HardlinerAgent]
# 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,
})
Architecture
negmas-genius-agents/
├── src/negmas_genius_agents/
│ ├── __init__.py # Package exports
│ ├── base.py # Base negotiator classes
│ ├── time_based.py # Time-dependent agents
│ └── utils/ # Utility classes
│ ├── outcome_space.py # Sorted outcome space
│ └── opponent_model.py # Opponent modeling
└── tests/
└── test_agents.py # Agent tests
How It Works
These agents are pure Python reimplementations of the original Java Genius agents. The reimplementation process involved:
- Analyzing Java Source: Understanding the original agent algorithms from Genius 10.4
- Python Translation: Reimplementing the logic using NegMAS primitives
- Behavior Validation: Ensuring the Python agents behave equivalently to their Java counterparts
Key components:
- SortedOutcomeSpace: Efficient bid lookup by utility value
- Time-Dependent Strategy: The classic
f(t) = k + (1-k) * t^(1/e)concession function - Opponent Models: Frequency-based and Bayesian opponent modeling
Development
Running Tests
uv run pytest tests/ -v
Building Documentation
uv run mkdocs serve
License
AGPL-3.0 License - see LICENSE for details.
Acknowledgments
- NegMAS - Negotiation Managed by Situated Agents
- Genius - General Environment for Negotiation with Intelligent multi-purpose Usage Simulation
- ANAC - Automated Negotiating Agents Competition
Citation
If you use this library in your research, please cite this package, NegMAS, and Genius:
@software{negmas_genius_agents,
title = {negmas-genius-agents: Python Reimplementations of Genius Negotiating Agents},
author = {Mohammad, Yasser},
year = {2024},
url = {https://github.com/yasserfarouk/negmas-genius-agents}
}
@inproceedings{mohammad2022negmas,
title={NegMAS: A Platform for Automated Negotiations},
author={Mohammad, Yasser and Nakadai, Shinji and Greenwald, Amy},
booktitle={Proceedings of the 21st International Conference on Autonomous Agents and Multiagent Systems},
pages={1845--1847},
year={2022}
}
@article{lin2014genius,
title={Genius: An integrated environment for supporting the design of generic automated negotiators},
author={Lin, Raz and Kraus, Sarit and Baarslag, Tim and Tykhonov, Dmytro and Hindriks, Koen and Jonker, Catholijn M},
journal={Computational Intelligence},
volume={30},
number={1},
pages={48--70},
year={2014},
publisher={Wiley Online Library}
}
Related Projects
- negmas-negolog - NegMAS wrappers for NegoLog agents
- negmas - The NegMAS negotiation framework
Project details
Release history Release notifications | RSS feed
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_genius_agents-0.1.0.tar.gz.
File metadata
- Download URL: negmas_genius_agents-0.1.0.tar.gz
- Upload date:
- Size: 354.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 |
ccc681032ac1d1373cf3fc9da673ada3f849fd9bc8e1631c7f86734233c8641d
|
|
| MD5 |
213fd93613a5ead8fc3461709218c57e
|
|
| BLAKE2b-256 |
b427199dc46ea3b3d4dd5b93276569611fadb6c165d4a1dcd24987ee1397ebdf
|
Provenance
The following attestation bundles were made for negmas_genius_agents-0.1.0.tar.gz:
Publisher:
publish.yml on autoneg/negmas-genius-agents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
negmas_genius_agents-0.1.0.tar.gz -
Subject digest:
ccc681032ac1d1373cf3fc9da673ada3f849fd9bc8e1631c7f86734233c8641d - Sigstore transparency entry: 813577364
- Sigstore integration time:
-
Permalink:
autoneg/negmas-genius-agents@5d40124e9189a451fda5bacfbd48835cbb833ed4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/autoneg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5d40124e9189a451fda5bacfbd48835cbb833ed4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file negmas_genius_agents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: negmas_genius_agents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 425.3 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 |
8c5ed0e42a26116ddf3409d53baa7d3d12271f4045907c1d1165b8ee6c430c1d
|
|
| MD5 |
9a1569a4cf1e8f3ec63a5f403af70a29
|
|
| BLAKE2b-256 |
41508bafbc1e208e2bd13c21e12370936ecdcd2b5b861c906d16901f6e8a8f11
|
Provenance
The following attestation bundles were made for negmas_genius_agents-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on autoneg/negmas-genius-agents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
negmas_genius_agents-0.1.0-py3-none-any.whl -
Subject digest:
8c5ed0e42a26116ddf3409d53baa7d3d12271f4045907c1d1165b8ee6c430c1d - Sigstore transparency entry: 813577365
- Sigstore integration time:
-
Permalink:
autoneg/negmas-genius-agents@5d40124e9189a451fda5bacfbd48835cbb833ed4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/autoneg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5d40124e9189a451fda5bacfbd48835cbb833ed4 -
Trigger Event:
push
-
Statement type: