negmas.genius

The genius module manages connections to the Genius platform and provides both Java-bridge and Python-native negotiators based on the Genius BOA (Bidding, Opponent modeling, Acceptance) architecture.

Overview

This module provides three ways to use Genius agents in NegMAS:

  1. GeniusNegotiator - Connect to Java-based Genius agents through the JVM bridge

  2. Python-Native BOA Negotiators (G-prefix) - Pure Python implementations of classic Genius agents

  3. BOA Components - Individual components (offering, acceptance, opponent modeling) for building custom negotiators

Java Bridge (GeniusNegotiator)

For access to the full ~200 Genius agents, you can use the Java bridge. This requires:

  1. Java JRE 8 or higher installed

  2. Running negmas genius-setup to download the bridge

  3. Starting the bridge with negmas genius before using Java agents

class negmas.genius.GeniusNegotiator(preferences: UtilityFunction | None = None, name: str | None = None, parent: Controller | None = None, owner: Agent = None, java_class_name: str | None = None, domain_file_name: str | Path | None = None, utility_file_name: str | Path | None = None, can_propose=True, auto_load_java: bool = True, port: int = 25337, genius_bridge_path: str | None = None, strict: bool | None = None, id: str | None = None)[source]

Bases: SAOPRNegotiator

Encapsulates a Genius Negotiator

Parameters:
  • preferences – The ufun of the negotiator [optional]

  • name – Negotiator name [optional]

  • parent – Parent Controller

  • owner – The agent that owns the negotiator (if any)

  • java_class_name – The java class name of the Geinus underlying agent

  • domain_file_name – Optional domain file name (containing the negotiation issues or agenda)

  • utility_file_name – Optional ufun file name (xml) from which a ufun will be loaded for the agent

  • can_propose – The negotiator can propose

  • auto_load_java – Load the genius bridge if needed

  • port – The port to load the genius bridge to (or use if it is already loaded)

  • genius_bridge_path – The path to the genius bridge

  • strict – If True, raise exceptions if any exception is thrown by the agent or the bridge (or if the agent could not choose an action). If false, ignore these exceptions and assume a None return. If None use strict for n_steps limited negotiations and not strict for time_limit limited ones.

cancel(reason=None) None[source]

Cancel.

Parameters:

reason – Reason.

destroy_java_counterpart(state=None) None[source]

Destroy java counterpart.

Parameters:

state – Current state.

property is_connected[source]

Check if connected.

property java_name[source]

Java name.

join(nmi, state, *, preferences=None, ufun=None, role='negotiator') bool[source]

Join.

Parameters:
  • nmi – Nmi.

  • state – Current state.

Returns:

The result.

Return type:

bool

classmethod negotiators(agent_based=True, party_based=True) list[str][source]

Returns a list of all available agents in genius 8.4.0

Parameters:
  • agent_based – Old agents based on the Java class Negotiator

  • party_based – Newer agents based on the Java class AbstractNegotiationParty

Returns:

on_negotiation_end(state: MechanismState) None[source]

called when a negotiation is ended

on_negotiation_start(state: MechanismState) None[source]

Called when the info starts. Connects to the JVM.

parse(action: str) tuple[ResponseType, tuple | None][source]

Parses an action into a ResponseType and an Outcome (if one is included) :param action:

Returns:

property port[source]

Port.

propose(state: GBState, dest: str | None = None) tuple | None[source]

Propose.

Parameters:
  • state – Current state.

  • dest – Dest.

Returns:

The result.

Return type:

Outcome | None

propose_sao(state: SAOState, dest: str | None = None) SAOResponse[source]

Propose sao.

Parameters:
  • state – Current state.

  • dest – Dest.

Returns:

The result.

Return type:

SAOResponse

classmethod random_negotiator(agent_based=True, party_based=True, port: int = 25337, domain_file_name: str | None = None, utility_file_name: str | None = None, auto_load_java: bool = False, can_propose=True, name: str | None = None) GeniusNegotiator[source]

Returns an agent with a random class name

Parameters:
  • name – negotiator name

  • can_propose – Can this negotiator propose?

  • auto_load_java – load the JVM if needed

  • utility_file_name – Name of the utility xml file

  • domain_file_name – Name of the domain XML file

  • port – port number to use if the JVM is to be started

  • agent_based – Old agents based on the Java class Negotiator

  • party_based – Newer agents based on the Java class AbstractNegotiationParty

Returns:

GeniusNegotiator an agent with a random java class

classmethod random_negotiator_name(agent_based=True, party_based=True)[source]

Random negotiator name.

Parameters:
  • agent_based – Agent based.

  • party_based – Party based.

property relative_time: float | None[source]

Relative time.

Returns:

The result.

Return type:

float | None

respond(state: GBState, source: str | None = None) ResponseType[source]

Respond.

Parameters:
  • state – Current state.

  • source – Source identifier.

Returns:

The result.

Return type:

ResponseType

respond_sao(state: SAOState, source: str | None = None) None[source]

Respond sao.

Parameters:
  • state – Current state.

  • source – Source identifier.

classmethod robust_negotiators() list[str][source]

Returns a list of genius agents that were tested and seem to be robustly working with negmas

property strict[source]

Strict.

Bridge Management

class negmas.genius.GeniusBridge[source]

Bases: object

GeniusBridge implementation.

classmethod clean(port=25337) bool[source]

Removes all agents and runs garbage collection on the bridge

classmethod clean_all() bool[source]

Removes all agents and runs garbage collection on all bridges.

classmethod close_gateway(port=25337)[source]

Closes the gateway.

Parameters:

port – The port the gateway is connected to. If None, DEFAULT_JAVA_PORT is used.

classmethod close_gateways()[source]

Closes all open gateways.

classmethod connect(port: int = 25337) JavaObject[source]

Connects to a running genius-bridge

Parameters:

port – The port at which the bridge in listening in Java

Remarks:
  • The difference between this method and start() is that this one does not attempt to start a java bridge if one does not exist.

classmethod gateway(port=25337, force=False) JavaGateway | None[source]

Finds and returns a gateway for a genius bridge on the given port

Parameters:
  • port – The port used by the Jave genius bridge.

  • force – If true, a new gateway is created even if one exists in the list of gateways available in GeniusBridge.gateways.

Returns:

The gateway if found otherwise an exception will be thrown

Remarks:
  • this method does NOT start a bridge. It only connects to a running bridge.

gateways: dict[int, Any] = {}[source]
classmethod is_installed() bool[source]

Returns true if a geniusbridge.jar is available

classmethod is_running(port: int) bool[source]

Returns true if a geniusbridge.jar is running on the given port

java_processes: dict[int, Any] = {}[source]
classmethod kill(port: int = 25337, wait: bool = True) bool[source]

Kills the java bridge connected to this port by asking it to exit

classmethod kill_forced(port: int = 25337, wait: bool = True) bool[source]

Kills the java bridge connected to this port forcibly.

Remarks:
  • The java bridge process must have been started by this process.

classmethod kill_threads(port: int = 25337, wait_time: float = 0.5) bool[source]

kills all threads in the given java bridge

python_ports: dict[int, int] = {}[source]
classmethod restart(port: int = 25337, *args, **kwargs) bool[source]

Starts or restarts the genius bridge

Parameters:

port – port number to use

Returns:

True if successful

classmethod shutdown(port: int = 25337, wait: bool = True) bool[source]

Attempts to shutdown the bridge on that port.

Parameters:

port – The port to shutdown.

Remarks:
  • This is the cleanest way to close a java bridge and it simply sends a message to the bridge to shut itself down and cleanly shuts down the py4j bridge.

classmethod start(port: int = 25337, path: str | None = None, debug: bool = False, timeout: float = 0, force_timeout: bool = True, save_logs: bool = False, log_path: PathLike | None = None, die_on_exit: bool = False, use_shell: bool = False, verbose: bool = False, allow_agent_print: bool = False) int[source]

Initializes a genius connection

Parameters:
  • port – port number to use. A value <= 0 means get any free tcp port.

  • path – The path to a JAR file that runs negloader

  • debug – If true, passes –debug to the bridge

  • timeout – If positive and nonzero, passes it as the global timeout for the bridge. Note that currently, the bridge supports only integer timeout values and the fraction will be truncated.

  • force_timeout – if false, no timeout will be forced by the bridge

  • save_logs – If false, the brige is instructed not to save any logs

  • log_path – the path to store logs from the bridge. Onle effective if save_logs If not given, defaults to ~/negmas/geniusbridge/logs/{port}-{datetime}.txt

  • die_on_exit – If given, the bridge will be closed when this process is ended

  • use_shell – If given, the bridge will be started in a subshell.

Returns:

The port number used by the java process. 0 for failure

Remarks:
  • if a bridge is running, it will return its port and it does not matter whether or not the bridge is started from this process or any other way.

  • it is recommended not to change the defaults for this function.

classmethod stop(port: int = 25337) bool[source]

Stops a running bridge

Parameters:

port – port number to use

Returns:

True if successful

Remarks:
  • You should use this method to stop bridges.

  • It tries the following in order:
    1. shutdown the java bridge by calling its shutdown() method.

    2. killing the java bridge by calling its kill() method.

    3. killing the java bridge forcibly by killing the process

  • This method always waits for a short time to allow each process to complete. If it returns True then the bridge is no longer listening on the given port.

classmethod wait_until_listening(port: int = 25337, timeout: float = 0.5) bool[source]

waits until a genius bridge is listening to the given port

Parameters:
  • port – The port to test

  • timeout – Maximum time to wait before returning (in seconds)

Returns:

True if the genius bridge is running any more (success).

classmethod wait_until_not_listening(port: int = 25337, timeout: float = 0.5) bool[source]

waits until the genius bridge is not listening to the given port

Parameters:
  • port – The port to test

  • max_sleep – Maximum time to wait before returning (in seconds)

Returns:

True if the genius bridge is NOT running any more (success).

negmas.genius.init_genius_bridge(path: Path | str | None = None, port: int = 25337, debug: bool = False, timeout: float = 0, force_timeout: bool = True, save_logs: bool = False, log_path: PathLike | None = None, die_on_exit: bool = False, use_shell: bool = False, verbose: bool = False, allow_agent_print: bool = False) int[source]

Initializes a genius connection

Parameters:
  • path – The path to a JAR file that runs negloader

  • port – port number to use

  • debug – If true, passes –debug to the bridge

  • timeout – If positive and nonzero, passes it as the global timeout for the bridge. Note that currently, the bridge supports only integer timeout values and the fraction will be truncated.

Returns:

Port if started. -1 if a bridge is already running on this port. 0 if failed

negmas.genius.genius_bridge_is_running(port: int = 25337) bool[source]

Checks whether a Genius Bridge is running. A genius bridge allows you to use GeniusNegotiator objects.

Remarks:

You can start a Genius Bridge in at least three ways:

negmas.genius.genius_bridge_is_installed() bool[source]

Checks if geniusbridge is available in the default path location

Constants

negmas.genius.DEFAULT_JAVA_PORT = 25337[source]

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

negmas.genius.DEFAULT_PYTHON_PORT = 25338[source]

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

negmas.genius.DEFAULT_GENIUS_NEGOTIATOR_TIMEOUT = 9223372036854775807[source]

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

negmas.genius.ANY_JAVA_PORT = -1[source]

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

negmas.genius.RANDOM_JAVA_PORT = 0[source]

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

negmas.genius.get_free_tcp_port()[source]

Get free tcp port.

Python-Native BOA Negotiator Classes

class negmas.genius.GBoulware(**kwargs)[source]

Bases: BOANegotiator

Python-native Boulware negotiator.

A time-dependent agent with e < 1 (typically e=0.2), which concedes slowly and only makes significant concessions near the deadline. This is a conservative negotiation strategy.

The Boulware strategy is named after the labor negotiator Lemuel Boulware, known for making “take it or leave it” offers.

Uses:
  • Offering: GBoulwareOffering (e=0.2)

  • Acceptance: GACNext (accepts if opponent’s offer >= next planned offer)

  • Model: None (no opponent modeling)

class negmas.genius.GConceder(**kwargs)[source]

Bases: BOANegotiator

Python-native Conceder negotiator.

A time-dependent agent with e > 1 (typically e=2.0), which concedes quickly early in the negotiation. This is an accommodating negotiation strategy.

Uses:
  • Offering: GConcederOffering (e=2.0)

  • Acceptance: GACNext (accepts if opponent’s offer >= next planned offer)

  • Model: None (no opponent modeling)

class negmas.genius.GLinear(**kwargs)[source]

Bases: BOANegotiator

Python-native Linear negotiator.

A time-dependent agent with e = 1, which concedes at a constant rate throughout the negotiation.

Uses:
  • Offering: GLinearOffering (e=1.0)

  • Acceptance: GACNext (accepts if opponent’s offer >= next planned offer)

  • Model: None (no opponent modeling)

class negmas.genius.GHardliner(**kwargs)[source]

Bases: BOANegotiator

Python-native Hardliner negotiator.

A time-dependent agent with e = 0, which never concedes and always offers its best outcome. This is the most aggressive negotiation strategy.

Uses:
  • Offering: GHardlinerOffering (e=0)

  • Acceptance: GACNext (accepts if opponent’s offer >= next planned offer)

  • Model: None (no opponent modeling)

class negmas.genius.GHardHeaded(e: float = 0.2, **kwargs)[source]

Bases: BOANegotiator

Python-native HardHeaded agent (ANAC 2011 Winner).

HardHeaded (KLH) won the ANAC 2011 competition. It uses a Boulware-style time-dependent offering strategy combined with frequency-based opponent modeling to estimate the opponent’s preferences.

The agent tracks which issues remain unchanged in opponent offers to infer which issues are most important to the opponent.

Uses:
  • Offering: GTimeDependentOffering (e=0.2, Boulware-style)

  • Acceptance: GACNext (accepts if opponent’s offer >= next planned offer)

  • Model: GHardHeadedFrequencyModel (frequency-based opponent modeling)

References

  • van Krimpen, T.,”;”; man, D.;”; Hindriks, K. (2011). “HardHeaded”. ANAC 2011.

class negmas.genius.GAgentK(e: float = 0.2, **kwargs)[source]

Bases: BOANegotiator

Python-native AgentK (ANAC 2010).

AgentK was one of the top performers in ANAC 2010. It uses a time-dependent offering strategy with adaptive acceptance based on a combination of conditions (AC_Combi).

Uses:
  • Offering: GTimeDependentOffering (e=0.2)

  • Acceptance: GACCombi (combined acceptance conditions)

  • Model: GDefaultModel (basic opponent model)

References

  • Kawaguchi, S.; Fujita, K.; Ito, T. (2010). “AgentK: Compromising Strategy based on Estimated Maximum Utility for Automated Negotiating Agents”. ANAC 2010.

class negmas.genius.GAgentSmith(e: float = 0.3, c: float = 0.8, **kwargs)[source]

Bases: BOANegotiator

Python-native AgentSmith (ANAC 2010).

AgentSmith was a notable agent in ANAC 2010, using a time-dependent strategy with frequency-based opponent modeling. It uses AC_Const acceptance which accepts any offer above a fixed utility threshold.

Uses:
  • Offering: GTimeDependentOffering (e=0.3)

  • Acceptance: GACConst (accepts above fixed threshold)

  • Model: GSmithFrequencyModel (Smith-style frequency model)

References

  • de Jonge, D. (2010). “AgentSmith”. ANAC 2010.

class negmas.genius.GNozomi(e: float = 0.2, **kwargs)[source]

Bases: BOANegotiator

Python-native Nozomi agent (ANAC 2010).

Nozomi was a competitive agent in ANAC 2010. It uses a Boulware-style time-dependent offering with AC_Previous acceptance, which accepts if the opponent’s offer is better than their previous offer.

Uses:
  • Offering: GTimeDependentOffering (e=0.2)

  • Acceptance: GACPrevious (accepts if better than opponent’s previous offer)

  • Model: GDefaultModel (basic opponent model)

References

  • Fujita, K. (2010). “Nozomi”. ANAC 2010.

class negmas.genius.GFSEGA(c: float = 0.7, **kwargs)[source]

Bases: BOANegotiator

Python-native FSEGA agent (ANAC 2010).

AgentFSEGA (Faculty of Computer Science Agent) from ANAC 2010 uses a conceding strategy with constant threshold acceptance.

Uses:
  • Offering: GConcederOffering (e=2.0)

  • Acceptance: GACConst (accepts above fixed threshold)

  • Model: GDefaultModel (basic opponent model)

References

  • Zaharia, G.; et al. (2010). “AgentFSEGA”. ANAC 2010.

class negmas.genius.GCUHKAgent(e: float = 0.15, **kwargs)[source]

Bases: BOANegotiator

Python-native CUHKAgent (ANAC 2012 Winner).

CUHKAgent won ANAC 2012. It uses a sophisticated time-dependent strategy with combined acceptance conditions. The agent is particularly good at handling domains with discount factors.

Uses:
  • Offering: GTimeDependentOffering (e=0.15, more conservative)

  • Acceptance: GACCombi (combined acceptance conditions)

  • Model: GHardHeadedFrequencyModel (frequency-based opponent modeling)

References

  • Hao, J.; Leung, H. (2012). “CUHKAgent: A Strategy for Bilateral Multi-issue Negotiation”. ANAC 2012.

class negmas.genius.GAgentLG(e: float = 0.25, **kwargs)[source]

Bases: BOANegotiator

Python-native AgentLG (ANAC 2012).

AgentLG was a notable agent in ANAC 2012. It uses a time-dependent strategy with AC_CombiMax acceptance which considers both the opponent’s best offer and the time remaining.

Uses:
  • Offering: GTimeDependentOffering (e=0.25)

  • Acceptance: GACCombiMax (maximum-based combined acceptance)

  • Model: GHardHeadedFrequencyModel (frequency-based opponent modeling)

References

  • ANAC 2012 AgentLG.

class negmas.genius.GAgentX(e: float = 0.3, t: float = 0.98, **kwargs)[source]

Bases: BOANegotiator

Python-native AgentX (ANAC 2015).

AgentX was a notable agent in ANAC 2015. It uses adaptive time-dependent offering with window-based acceptance and exponential smoothing opponent modeling.

Uses:
  • Offering: GTimeDependentOffering (e=0.3, adaptive)

  • Acceptance: GACCombiMaxInWindow (window-based maximum acceptance)

  • Model: GAgentXFrequencyModel (exponential smoothing opponent model)

References

  • ANAC 2015 AgentX.

class negmas.genius.GRandom(**kwargs)[source]

Bases: BOANegotiator

Python-native Random negotiator.

A simple agent that makes random offers and accepts any offer. Useful for testing and as a baseline.

Uses:
  • Offering: GRandomOffering (random bid selection)

  • Acceptance: GACTrue (accepts any offer)

  • Model: None (no opponent modeling)

See Also

  • negmas.gb.components.genius - BOA components used by these negotiators

  • negmas.sao - SAO mechanism for running negotiations

  • /scripts - CLI documentation for negotiate command

BOA Components

The G-prefixed negotiators are built from modular BOA (Bidding, Opponent modeling, Acceptance) components available in negmas.gb.components.genius. These can be used to build custom negotiators or mixed with other components.

Opponent Models

Opponent models predict the opponent’s utility function based on their bidding behavior. NegMAS includes both frequency-based and Bayesian opponent models transcompiled from Genius.

Bayesian Models

Model

Description

GBayesianModel

Full Bayesian inference with hypothesis maintenance

GScalableBayesianModel

Scalable Bayesian with online learning (better for large domains)

Frequency-Based Models

Model

Description

GHardHeadedFrequencyModel

Tracks unchanged issues between bids (from ANAC 2011 winner)

GSmithFrequencyModel

Simple frequency model (from AgentSmith, ANAC 2010)

GAgentXFrequencyModel

Advanced model with exponential smoothing (ANAC 2015)

GNashFrequencyModel

Frequency model biased toward Nash-optimal outcomes

Utility Models

Model

Description

GDefaultModel

No-op model, returns constant 0.5 utility

GUniformModel

Random but consistent utility for each outcome

GOppositeModel

Assumes opponent has opposite preferences (1 - our_utility)

Bayesian Opponent Model Usage

Example using a Bayesian opponent model with a custom negotiator:

from negmas.gb import GBNegotiator
from negmas.gb.components.genius import (
    GBayesianModel,
    GTimeDependentOffering,
    GACNext,
)
from negmas.sao import SAOMechanism
from negmas.preferences import LinearAdditiveUtilityFunction
from negmas.outcomes import make_issue

# Create scenario
issues = [make_issue(10, "price"), make_issue(5, "quantity")]
ufun = LinearAdditiveUtilityFunction.random(issues, reserved_value=0.0)

# Create negotiator with Bayesian opponent modeling
negotiator = GBNegotiator(
    name="bayesian_agent",
    ufun=ufun,
    offering=GTimeDependentOffering(e=0.5),
    acceptance=GACNext(),
    model=GBayesianModel(n_hypotheses=20, rationality=5.0),
)

The GBayesianModel maintains multiple hypotheses about opponent preferences and updates their probabilities using Bayes’ rule after each opponent bid. The GScalableBayesianModel uses online learning for better scalability with large outcome spaces.

Opponent Model Classes

class negmas.gb.components.genius.GBayesianModel(n_hypotheses: int = 10, rationality: float = 5.0, issue_weight_hypotheses: list[dict[int, float]] = NOTHING, hypothesis_probs: list[float] = NOTHING, value_utils: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Bayesian opponent model from Genius.

Uses Bayesian inference to update beliefs about opponent’s utility function based on their bids. Maintains probability distributions over possible opponent preferences and updates them using Bayes’ rule.

This is a simplified version that assumes the opponent is rational and only offers bids above some threshold.

Parameters:
  • n_hypotheses – Number of hypotheses to consider (default 10).

  • rationality – Assumed opponent rationality - higher values assume opponent is more likely to make utility-maximizing bids (default 5.0).

Transcompiled from: negotiator.boaframework.opponentmodel.BayesianModel

eval(offer: Outcome | None) Value[source]

Evaluate opponent utility as weighted average over hypotheses.

Parameters:

offer – The outcome to evaluate.

Returns:

Estimated opponent utility (0 to 1).

eval_normalized(offer: Outcome | None, above_reserve: bool = True, expected_limits: bool = True) Value[source]

Return normalized utility.

n_hypotheses: int[source]
on_partner_proposal(state: GBState, partner_id: str, offer: Outcome) None[source]

Update hypothesis probabilities using Bayes’ rule.

on_preferences_changed(changes: list[PreferencesChange]) None[source]

Reset the model when preferences change.

rationality: float[source]
class negmas.gb.components.genius.GScalableBayesianModel(learning_rate: float = 0.1, issue_weights: dict[int, float] = NOTHING, value_utils: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Scalable Bayesian opponent model from Genius.

A Bayesian model optimized for large outcome spaces. Uses a more efficient representation that scales better with domain size.

Instead of maintaining full hypothesis distributions, it tracks sufficient statistics and uses approximate inference.

Parameters:

learning_rate – Rate of belief updates (default 0.1).

Transcompiled from: negotiator.boaframework.opponentmodel.ScalableBayesianModel

eval(offer: Outcome | None) Value[source]

Evaluate opponent utility.

Parameters:

offer – The outcome to evaluate.

Returns:

Estimated opponent utility (0 to 1).

eval_normalized(offer: Outcome | None, above_reserve: bool = True, expected_limits: bool = True) Value[source]

Return normalized utility.

learning_rate: float[source]
on_partner_proposal(state: GBState, partner_id: str, offer: Outcome) None[source]

Update beliefs using online learning.

on_preferences_changed(changes: list[PreferencesChange]) None[source]

Reset the model when preferences change.

class negmas.gb.components.genius.GHardHeadedFrequencyModel(learning_coef: float = 0.2, learning_value_addition: int = 1, default_value: int = 1, issue_weights: dict[int, float] = NOTHING, value_weights: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Hard-Headed Frequency-based opponent model from Genius.

This model estimates the opponent’s utility function by tracking which issues remain unchanged between consecutive opponent bids. Issues that don’t change are assumed to be more important to the opponent.

The model works by: 1. Tracking bid frequencies for each issue value 2. When an issue value stays the same between consecutive bids,

increasing its weight (the opponent likely cares about that issue)

  1. Computing opponent utility as a weighted sum of issue value frequencies

Parameters:
  • learning_coef – Learning coefficient controlling how fast weights adapt. Higher values mean faster adaptation (default 0.2).

  • learning_value_addition – Value added to unchanged issue weights (default 1).

  • default_value – Default value for unseen issue values (default 1).

Transcompiled from: bilateralexamples.boacomponents.HardHeadedFrequencyModel

default_value: int[source]
eval(offer: Outcome | None) Value[source]

Evaluate the estimated opponent utility for an outcome.

Parameters:

offer – The outcome to evaluate.

Returns:

Estimated opponent utility (0 to 1).

eval_normalized(offer: Outcome | None, above_reserve: bool = True, expected_limits: bool = True) Value[source]

Evaluate normalized opponent utility.

Parameters:
  • offer – The outcome to evaluate.

  • above_reserve – Whether to normalize above reserve value.

  • expected_limits – Whether to use expected limits.

Returns:

Normalized opponent utility (0 to 1).

learning_coef: float[source]
learning_value_addition: int[source]
on_partner_proposal(state: GBState, partner_id: str, offer: Outcome) None[source]

Update the model based on the opponent’s offer.

Parameters:
  • state – Current negotiation state.

  • partner_id – ID of the partner who made the offer.

  • offer – The opponent’s offer.

on_preferences_changed(changes: list[PreferencesChange]) None[source]

Reset the model when preferences change.

Parameters:

changes – List of preference changes.

class negmas.gb.components.genius.GSmithFrequencyModel(default_value: int = 1, value_counts: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Smith frequency-based opponent model from Genius.

From AgentSmith (ANAC 2010). Similar to HardHeadedFrequencyModel but with a simpler weight update mechanism based purely on value frequencies.

The model tracks how often each value appears in opponent bids and assumes higher frequency = higher importance.

Parameters:

default_value – Default value for unseen issue values (default 1).

Transcompiled from: negotiator.boaframework.opponentmodel.SmithFrequencyModel

default_value: int[source]
eval(offer: Outcome | None) Value[source]

Evaluate opponent utility based on value frequencies.

Parameters:

offer – The outcome to evaluate.

Returns:

Estimated opponent utility (0 to 1).

eval_normalized(offer: Outcome | None, above_reserve: bool = True, expected_limits: bool = True) Value[source]

Return normalized utility.

on_partner_proposal(state: GBState, partner_id: str, offer: Outcome) None[source]

Update value frequencies based on opponent’s offer.

on_preferences_changed(changes: list[PreferencesChange]) None[source]

Reset the model when preferences change.

class negmas.gb.components.genius.GAgentXFrequencyModel(learning_rate: float = 0.25, default_value: int = 1, issue_weights: dict[int, float] = NOTHING, value_counts: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

AgentX frequency-based opponent model from Genius.

From AgentX (ANAC 2015). An advanced frequency model that uses both value frequencies and issue weight learning based on bid patterns.

Tracks issue weights by observing which issues change less frequently, and uses exponential smoothing for weight updates.

Parameters:
  • learning_rate – Learning rate for weight updates (default 0.25).

  • default_value – Default value for unseen issue values (default 1).

Transcompiled from: negotiator.boaframework.opponentmodel.AgentXFrequencyModel

default_value: int[source]
eval(offer: Outcome | None) Value[source]

Evaluate opponent utility.

Parameters:

offer – The outcome to evaluate.

Returns:

Estimated opponent utility (0 to 1).

eval_normalized(offer: Outcome | None, above_reserve: bool = True, expected_limits: bool = True) Value[source]

Return normalized utility.

learning_rate: float[source]
on_partner_proposal(state: GBState, partner_id: str, offer: Outcome) None[source]

Update model based on opponent’s offer.

on_preferences_changed(changes: list[PreferencesChange]) None[source]

Reset the model when preferences change.