negmas.gb

Implements Generalized Bargaining Protocol (GB) set of mechanisms and basic negotiators.

class negmas.gb.ACConst(th: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts outcomes with utilities above the given threshold

th: float[source]
class negmas.gb.ACLast(alpha: float = 1.0, beta: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Implements the AClast acceptance strategy based on our last offer.

Accepts $omega$ if $lpha u(my-next-offer) + eta > u(omega)$

after_proposing(state: GBState, offer: Outcome | ExtendedOutcome | None, dest: str | None = None)[source]

Update the stored utility of our last proposed offer.

alpha: float[source]
beta: float[source]
last_offer_util: float[source]
class negmas.gb.ACLastFractionReceived(fraction: float = 1.0, alpha: float = 1.0, beta: float = 0.0, op: Callable[[list[float]], float] = <built-in function max>, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts $omega$ if $lpha u(my-next-offer) + eta > f(u( ext{utils of offers received in the given fraction of time}))$

alpha: float[source]
before_responding(state: GBState, offer: Outcome | None, source: str | None = None)[source]

Record the utility and timestamp of the received offer for time-windowed analysis.

beta: float[source]
fraction: float[source]
op: Callable[[list[float]], float][source]
class negmas.gb.ACLastKReceived(k: int = 0, alpha: float = 1.0, beta: float = 0.0, op: Callable[[list[float]], float] = <built-in function max>, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts $omega$ if $lpha u(my-next-offer) + eta > f(u( ext{utils of offers received in the last k steps))$

after_join(nmi) None[source]

Initialize the sliding window buffer for tracking recent offer utilities.

alpha: float[source]
before_responding(state: GBState, offer: Outcome | None, source: str | None = None)[source]

Record the utility of the received offer in the sliding window.

beta: float[source]
k: int[source]
op: Callable[[list[float]], float][source]
class negmas.gb.ACNext(offering_strategy: OfferingPolicy, alpha: float = 1.0, beta: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Implements the ACnext acceptance strategy based on our next offer.

Accepts $omega$ if $lpha u(my-next-offer) + eta > u(omega)$

alpha: float[source]
beta: float[source]
offering_strategy: OfferingPolicy[source]
class negmas.gb.ACTime(tau: float, rational: bool = True, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Implements the ACtime acceptance strategy based on our next offer.

Accepts if the relative time is greater than or equal to tau

rational: bool[source]
tau: float[source]
class negmas.gb.AcceptAbove(limit: float, above_reserve: bool = True, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts outcomes with utilities in the given top limit fraction above reserve/minimum (based on above_resrve ).

above_reserve: bool[source]
limit: float[source]
on_preferences_changed(changes: list[PreferencesChange])[source]

Handle preference updates (no action needed for threshold-based acceptance).

negmas.gb.AcceptAfter[source]

alias of ACTime

class negmas.gb.AcceptAnyRational(*, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts any rational outcome.

class negmas.gb.AcceptAround(relative_time: float = 1.0, eps: float = 0.001, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts around the given relative time (i.e. eps from it)

eps: float[source]
relative_time: float[source]
class negmas.gb.AcceptBest(best_util: float = inf, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts Only the best outcome.

Remarks:
  • If the best possible utility cannot be found, nothing will be accepted

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

Handle preference updates (no action needed for best-only acceptance).

class negmas.gb.AcceptBetterRational(accepted: dict[str, Outcome] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accept first rational outcomes and then accept only outcomes better than the all accepted so far.

class negmas.gb.AcceptBetween(min: float, max: float = 1.0, rational: bool = True, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts in the given range of relative times.

max: float[source]
min: float[source]
rational: bool[source]
class negmas.gb.AcceptImmediately(*, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts immediately anything

class negmas.gb.AcceptNotWorseRational(accepted: dict[str, Outcome] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accept any outcome not worse than the best so far.

class negmas.gb.AcceptTop(fraction: float = 0.0, k: int = 1, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts outcomes that are in the given top fraction or top k. If neither is given it reverts to accepting the best outcome only.

Remarks:
  • The outcome-space is always discretized and the constraints fraction and k are applied to the discretized space

fraction: float[source]
k: int[source]
on_preferences_changed(changes: list[PreferencesChange])[source]

Reinitialize the utility inverter when preferences change significantly.

class negmas.gb.AcceptancePolicy(*, negotiator: GBNegotiator | None = None)[source]

Bases: GBComponent

Acceptance policy implementation.

respond(state: GBState, offer: Outcome | None, source: str | None) ResponseType | ExtendedResponseType[source]

Called to respond to an offer. This is the method that should be overriden to provide an acceptance strategy.

Parameters:
  • state – a GBState giving current state of the negotiation.

  • offer – offer being tested

Returns:

The response to the offer

Return type:

ResponseType | ExtendedResponseType

Remarks:
  • The default implementation never ends the negotiation

  • The default implementation asks the negotiator to propose`() and accepts the `offer if its utility was at least as good as the offer that it would have proposed (and above the reserved value).

class negmas.gb.AdditiveFirstFollowingTBNegotiator(*args, dist_power: float = 2, issue_weights: list[float] | None = None, **kwargs)[source]

Bases: TimeBasedNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on a weighted sum of their normalized utilities and distances to previous offers

class negmas.gb.AdditiveLastOfferFollowingTBNegotiator(*args, dist_power: float = 2, issue_weights: list[float] | None = None, **kwargs)[source]

Bases: TimeBasedNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on a weighted sum of their normalized utilities and distances to previous offers

class negmas.gb.AdditiveParetoFollowingTBNegotiator(*args, dist_power: float = 2, issue_weights: list[float] | None = None, offer_filter: OfferFilterProtocol = <function NoFiltering>, **kwargs)[source]

Bases: TimeBasedNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on a weighted sum of their normalized utilities and distances to previous offers

class negmas.gb.AdditivePartnerOffersOrientedSelector(*args, u_weight: float = 0.6, **kwargs)[source]

Bases: PartnerOffersOrientedSelector

Orients offes toward the set of past opponent offers.

The score of an offer is the product of its utility to self and its distance to opponent’s past offers after normalization

calculate_scores(outcomes: Sequence[Outcome], pivots: list[Outcome], state: GBState) Sequence[tuple[float, Outcome]][source]

Compute scores as a weighted sum of utility and normalized distance to pivots.

class negmas.gb.AllAcceptEvaluationStrategy(strategies: list[EvaluationStrategy])[source]

Bases: EvaluationStrategy

AllAcceptEvaluation strategy.

class negmas.gb.AllAcceptanceStrategies(strategies: list[AcceptancePolicy], *, negotiator: GBNegotiator | None = None)[source]

Bases: ConcensusAcceptancePolicy

Accept only if all children accept, end only if all of them end, otherwise reject

decide(indices: list[int], responses: list[ResponseType]) ResponseType | ExtendedResponseType[source]

Return first non-accept response, or accept if all strategies accepted.

Parameters:
  • indices – Indices of strategies whose responses were saved.

  • responses – The saved responses from those strategies.

Returns:

ACCEPT_OFFER if all accepted, otherwise the first reject/end response.

filter(indx: int, response: ResponseType) FilterResult[source]

Stop early on reject/end; continue collecting accepts for unanimous decision.

Parameters:
  • indx – Index of the strategy in the strategies list.

  • response – The response returned by the strategy at this index.

Returns:

FilterResult indicating whether to continue and whether to save this response.

class negmas.gb.AllOfferingConstraints(constaints: list[OfferingConstraint])[source]

Bases: OfferingConstraint

AllOfferingConstraints implementation.

constaints: list[OfferingConstraint][source]
class negmas.gb.AnyAcceptEvaluationStrategy(strategies: list[EvaluationStrategy])[source]

Bases: EvaluationStrategy

AnyAcceptEvaluation strategy.

class negmas.gb.AnyAcceptancePolicy(strategies: list[AcceptancePolicy], *, negotiator: GBNegotiator | None = None)[source]

Bases: ConcensusAcceptancePolicy

Accept any children accept, end or reject only if all of them end or reject

decide(indices: list[int], responses: list[ResponseType]) ResponseType | ExtendedResponseType[source]

Accept if any strategy accepted, reject only if all rejected.

Parameters:
  • indices – Indices of strategies whose responses were saved.

  • responses – The saved responses from those strategies.

Returns:

ACCEPT_OFFER if any accepted, REJECT_OFFER if all rejected.

filter(indx: int, response: ResponseType) FilterResult[source]

Stop early on accept/end; continue collecting rejects to find any acceptor.

Parameters:
  • indx – Index of the strategy in the strategies list.

  • response – The response returned by the strategy at this index.

Returns:

FilterResult indicating whether to continue and whether to save this response.

class negmas.gb.AnyOfferingConstraint(constraints: list[OfferingConstraint])[source]

Bases: OfferingConstraint

AnyOfferingConstraint implementation.

constraints: list[OfferingConstraint][source]
class negmas.gb.AspirationNegotiator(*args, max_aspiration=1.0, aspiration_type: Literal['boulware'] | Literal['conceder'] | Literal['linear'] | float = 'boulware', stochastic=False, presort: bool = True, tolerance: float = 0.001, **kwargs)[source]

Bases: TimeBasedConcedingNegotiator

Represents a time-based negotiation strategy that is independent of the offers received during the negotiation.

Parameters:
  • name – The agent name

  • preferences – The utility function to attache with the agent

  • max_aspiration – The aspiration level to use for the first offer (or first acceptance decision).

  • aspiration_type – The polynomial aspiration curve type. Here you can pass the exponent as a real value or pass a string giving one of the predefined types: linear, conceder, boulware.

  • stochastic – If True, the agent will propose outcomes with utility >= the current aspiration level not outcomes just above it.

  • can_propose – If True, the agent is allowed to propose

  • ranking – If True, the aspiration level will not be based on the utility value but the ranking of the outcome within the presorted list. It is only effective when presort is set to True

  • presort – If True, the negotiator will catch a list of outcomes, presort them and only use them for offers and responses. This is much faster then other option for general continuous utility functions but with the obvious problem of only exploring a discrete subset of the issue space (Decided by the discrete_outcomes property of the NegotiatorMechanismInterface . If the number of outcomes is very large (i.e. > 10000) and discrete, presort will be forced to be True. You can check if presorting is active in realtime by checking the “presorted” attribute.

  • tolerance – A tolerance used for sampling of outcomes when presort is set to False

  • owner – The Agent that owns the negotiator.

  • parent – The parent which should be an GBController

Remarks:

property tolerance[source]

Returns the tolerance used when sampling outcomes near the aspiration level.

property ufun_max[source]

Returns the maximum utility value from the inverter.

property ufun_min[source]

Returns the minimum utility value from the inverter.

utility_at(t)[source]

Returns the aspiration utility level at relative time t (0.0 to 1.0).

class negmas.gb.BestOfferOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, **kwargs)[source]

Bases: OfferOrientedSelector

Selects the offer nearest the partner’s best offer for me so far

before_responding(state: GBState, offer: Outcome | None, source: str | None = None)[source]

Updates the pivot if the current offer has the highest utility so far.

class negmas.gb.BestOfferOrientedTBNegotiator(*args, distance_fun: ~typing.Callable[[tuple, tuple, ~negmas.outcomes.protocols.OutcomeSpace | None], float] = <function generalized_minkowski_distance>, **kwargs)[source]

Bases: FirstOfferOrientedTBNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on their utility value and how near they are to the partner’s past offer with the highest utility for me

class negmas.gb.BestOfferSelector(*args, **kwargs)[source]

Bases: OfferSelector

Selects the outcome with the highest utility value.

class negmas.gb.BoulwareTBNegotiator(*args, **kwargs)[source]

Bases: TimeBasedConcedingNegotiator

A Boulware time-based negotiator that conceeds sub-linearly

class negmas.gb.CABNegotiator(*args, **kwargs)[source]

Bases: MAPNegotiator

Conceding Accepting Better Strategy (optimal, complete, but not an equilibirum)

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides prefrences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.CABOfferingPolicy(next_indx: int = 0, sorter: PresortingInverseUtilityFunction | None = None, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

CABOffering policy implementation.

next_indx: int[source]
on_preferences_changed(changes: list[PreferencesChange])[source]

Initializes the outcome sorter on significant preference changes.

sorter: PresortingInverseUtilityFunction | None[source]
class negmas.gb.CANNegotiator(*args, **kwargs)[source]

Bases: MAPNegotiator

Conceding Accepting Not Worse Strategy (optimal, complete, but not an equilibirum)

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides prefrences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.CARNegotiator(*args, **kwargs)[source]

Bases: MAPNegotiator

Conceding Accepting Rational Strategy (neither complete nor an equilibrium)

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides prefrences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.ConcederTBNegotiator(*args, **kwargs)[source]

Bases: TimeBasedConcedingNegotiator

A Boulware time-based negotiator that conceeds super-linearly

class negmas.gb.ConcensusAcceptancePolicy(strategies: list[AcceptancePolicy], *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy, ABC

Accepts based on concensus of multiple strategies

abstractmethod decide(indices: list[int], responses: list[ResponseType | ExtendedResponseType]) ResponseType | ExtendedResponseType[source]

Called to make a final decision given the decisions of the strategies with indices indices (see filter for filtering rules)

filter(indx: int, response: ResponseType | ExtendedResponseType) FilterResult[source]

Called with the decision of each strategy in order.

Remarks:
  • Two decisions need to be made:

    1. Should we continue trying other strategies

    2. Should we save this result.

on_negotiation_start(state) None[source]

Initialize child strategies with the negotiator reference at negotiation start.

strategies: list[AcceptancePolicy][source]
class negmas.gb.ConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy, ABC

Offers based on concensus of multiple strategies

abstractmethod decide(indices: list[int], responses: list[Outcome | ExtendedOutcome | None]) Outcome | ExtendedOutcome | None[source]

Called to make a final decsision given the decisions of the stratgeis with indices indices (see filter for filtering rules)

filter(indx: int, offer: Outcome | ExtendedOutcome | None) FilterResult[source]

Called with the decision of each strategy in order.

Remarks:
  • Two decisions need to be made:

    1. Should we continue trying other strategies

    2. Should we save this result.

strategies: list[OfferingPolicy][source]
class negmas.gb.ConcessionRecommender(*, negotiator: GBNegotiator | None = None)[source]

Bases: GBComponent

Decides the level of concession to use

class negmas.gb.EndImmediately(*, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Ends negotiation immediately regardless of the offer.

class negmas.gb.EvaluationStrategy[source]

Bases: ABC

class negmas.gb.ExtendedResponseType(response: ResponseType, data: dict[str, Any] | None = None)[source]

Bases: object

A response with optional data fields.

This class allows acceptance policies to return additional data alongside the response decision, such as text explanations, reasoning, or metadata.

response[source]

The actual response type (ACCEPT_OFFER, REJECT_OFFER, etc.).

Type:

negmas.gb.common.ResponseType

data[source]

Optional dictionary of additional data. Can contain: - “text”: A text message explaining the response or providing context. - Any other key-value pairs for custom metadata.

Type:

dict[str, Any] | None

Example

>>> from negmas.gb.common import ResponseType, ExtendedResponseType
>>> extended = ExtendedResponseType(
...     response=ResponseType.REJECT_OFFER,
...     data={"text": "This price is too high", "counter_suggestion": 5},
... )
>>> extended.response
<ResponseType.REJECT_OFFER: 1>
>>> extended.data["text"]
'This price is too high'

See also

data: dict[str, Any] | None[source]
response: ResponseType[source]
class negmas.gb.FastMiCRONegotiator(*args, accept_same: bool = True, **kwargs)[source]

Bases: MAPNegotiator

Rational Concession Negotiator

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides prefrences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.FirstOfferOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, **kwargs)[source]

Bases: OfferOrientedSelector

Selects the offer nearest the partner’s first offer

before_responding(state: GBState, offer: Outcome | None, source: str | None = None)[source]

Sets the pivot to the first offer received from the partner.

class negmas.gb.FirstOfferOrientedTBNegotiator(*args, distance_fun: ~typing.Callable[[tuple, tuple, ~negmas.outcomes.protocols.OutcomeSpace | None], float] = <function generalized_minkowski_distance>, **kwargs)[source]

Bases: OfferOrientedNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on their utility value and how near they are to the partner’s first offer

class negmas.gb.FrequencyLinearUFunModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: UFunModel

A PartnerUfunModel that uses a simple frequency-based model of the opponent offers assuming the ufun is LinearAdditiveUtilityFunction .

eval(offer: Outcome) Value[source]

Eval.

Parameters:

offer – Offer being considered.

Returns:

The result.

Return type:

Value

class negmas.gb.FrequencyUFunModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: UFunModel

A PartnerUfunModel that uses a simple frequency-based model of the opponent offers.

eval(offer: Outcome) Value[source]

Eval.

Parameters:

offer – Offer being considered.

Returns:

The result.

Return type:

Value

class negmas.gb.GACABMP(utility_gap: float = 0.05, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_ABMP acceptance strategy from Genius.

Accepts an offer if the opponent’s utility is within a gap of our last offer. Based on the ABMP (Adaptive Bargaining with Multiple Proposals) agent.

Parameters:

utility_gap – The maximum gap between opponent’s offer and our last offer (default 0.05).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_ABMP

utility_gap: float[source]
class negmas.gb.GACAgentFSEGA(offering_policy: OfferingPolicy, multiplier: float = 1.03, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_AgentFSEGA acceptance strategy from Genius (ANAC2010).

Accepts if: - opponent_util * multiplier >= my_last_util, OR - opponent_util > my_next_util, OR - opponent_util == max_utility_in_domain

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • multiplier – Multiplier for opponent’s offer comparison (default 1.03).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2010.AC_AgentFSEGA

multiplier: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACAgentK(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_AgentK acceptance strategy from Genius (ANAC2010).

Probabilistic acceptance based on time and utility. Calculates an acceptance probability and accepts if a random value is below this probability.

The acceptance probability increases as time progresses and as the opponent’s offers improve relative to expectations.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2010.AC_AgentK

class negmas.gb.GACAgentK2(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_AgentK2 acceptance strategy from Genius (ANAC2011).

Enhanced probabilistic acceptance with statistics tracking. Similar to AgentK but with improved probability calculations.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_AgentK2

class negmas.gb.GACAgentLG(accept_ratio: float = 0.99, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_AgentLG acceptance strategy from Genius (ANAC2012).

Frequency-based acceptance that tracks opponent bids and accepts based on relative utility and time pressure.

Parameters:

accept_ratio – Ratio for acceptance comparison (default 0.99).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2012.AC_AgentLG

accept_ratio: float[source]
class negmas.gb.GACAgentMR(minimum_accept_p: float = 0.965, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_AgentMR acceptance strategy from Genius (ANAC2012).

Time-based concession with sigmoid acceptance probability. Tracks opponent offers and adjusts acceptance based on forecasting.

Parameters:

minimum_accept_p – Minimum acceptance probability threshold (default 0.965).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2012.AC_AgentMR

minimum_accept_p: float[source]
class negmas.gb.GACAgentSmith(accept_margin: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_AgentSmith acceptance strategy from Genius (ANAC2010).

Probabilistic acceptance with a minimum utility threshold. Accepts if opponent’s offer is above the accept margin or if it’s better than or equal to our last offer.

Parameters:

accept_margin – Minimum utility to accept unconditionally (default 0.9).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2010.AC_AgentSmith

accept_margin: float[source]
class negmas.gb.GACBRAMAgent(offering_policy: OfferingPolicy, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_BRAMAgent acceptance strategy from Genius (ANAC2011).

Best Response Adaptive Model - accepts based on a dynamically calculated threshold that accounts for discounting.

Parameters:

offering_policy – The offering strategy to determine next bid.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_BRAMAgent

offering_policy: OfferingPolicy[source]
class negmas.gb.GACBRAMAgent2(offering_policy: OfferingPolicy, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_BRAMAgent2 acceptance strategy from Genius (ANAC2012).

Enhanced BRAM with better threshold adaptation. Similar to BRAMAgent but with improved handling of edge cases.

Parameters:

offering_policy – The offering strategy to determine next bid.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2012.AC_BRAMAgent2

offering_policy: OfferingPolicy[source]
class negmas.gb.GACCUHKAgent(offering_policy: OfferingPolicy, min_threshold: float = 0.65, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CUHKAgent acceptance strategy from Genius (ANAC2012).

Complex acceptance with concede degree calculation. Accepts based on threshold that adapts to discounting and opponent behavior.

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • min_threshold – Minimum utility threshold (default 0.65).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2012.AC_CUHKAgent

min_threshold: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACCombi(offering_policy: OfferingPolicy, a: float = 1.0, b: float = 0.0, t: float = 0.99, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Combi acceptance strategy from Genius.

Combines AC_Next and AC_Time: accepts if either condition is met.

Accepts if:

(a * u(opponent_offer) + b >= u(my_next_offer)) OR (time >= t)

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • a – Scaling factor for opponent’s offer utility (default 1.0).

  • b – Offset added to scaled opponent utility (default 0.0).

  • t – Time threshold for acceptance (default 0.99).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_Combi

a: float[source]
b: float[source]
offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiAvg(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiAvg acceptance strategy from Genius.

Combines AC_Next with average-based acceptance in the end game.

Before time t: acts like AC_Next. After time t: accepts if opponent’s offer >= average of opponent’s offers in window.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which average-based acceptance kicks in (default 0.98).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiAvg

offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiBestAvg(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiBestAvg acceptance strategy from Genius.

Combines AC_Next with best-average-based acceptance.

Before time t: acts like AC_Next. After time t: accepts if opponent’s offer >= average of offers better than current offer.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which best-average acceptance kicks in (default 0.98).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiBestAvg

offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiBestAvgDiscounted(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiBestAvgDiscounted acceptance strategy from Genius.

Like AC_CombiBestAvg but applies time discount to utilities.

Before time t: acts like AC_Next. After time t: accepts if discounted opponent offer >= discounted avg of better offers.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which best-average acceptance kicks in (default 0.98).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiBestAvgDiscounted

offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiMax(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiMax acceptance strategy from Genius.

Combines AC_Next with maximum-based acceptance.

Before time t: acts like AC_Next. After time t: accepts if opponent’s offer >= max of all previous opponent offers.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which max-based acceptance kicks in (default 0.98).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiMax

offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiMaxInWindow(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiMaxInWindow acceptance strategy from Genius.

Combines AC_Next with a time-window-based acceptance criterion.

Before time t: acts like AC_Next only. After time t: accepts if opponent’s offer is >= best offer seen in remaining time window.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which window-based acceptance kicks in (default 0.98).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiMaxInWindow

offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiMaxInWindowDiscounted(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiMaxInWindowDiscounted acceptance strategy from Genius.

Like AC_CombiMaxInWindow but applies time discount to utilities.

Before time t: acts like AC_Next. After time t: accepts if discounted offer >= discounted best in window.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which window-based acceptance kicks in (default 0.98).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiMaxInWindowDiscounted

offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiProb(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiProb acceptance strategy from Genius.

Probability-based acceptance that combines AC_Next with probabilistic acceptance based on the expected utility of waiting.

Before time t: acts like AC_Next. After time t: accepts with probability based on how good the offer is relative to expected future offers.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which probabilistic acceptance kicks in (default 0.98).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiProb

offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiProbDiscounted(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiProbDiscounted acceptance strategy from Genius.

Like AC_CombiProb but applies time discount to utilities.

Before time t: acts like AC_Next. After time t: probabilistic acceptance with discounted utilities.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which probabilistic acceptance kicks in (default 0.98).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiProbDiscounted

offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiV2(offering_policy: OfferingPolicy, a: float = 1.0, b: float = 0.0, t: float = 0.99, decay: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiV2 acceptance strategy from Genius.

A variant of AC_Combi that uses a different combination logic. Accepts if the opponent’s offer utility exceeds a time-dependent threshold based on both the next offer utility and a decay factor.

Before time t: acts like AC_Next. After time t: accepts if opponent’s offer >= next offer utility * decay.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • a – Scaling factor for opponent’s offer utility (default 1.0).

  • b – Offset added to scaled opponent utility (default 0.0).

  • t – Time threshold (default 0.99).

  • decay – Decay factor applied after time threshold (default 0.9).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiV2

a: float[source]
b: float[source]
decay: float[source]
offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiV3(offering_policy: OfferingPolicy, a: float = 1.0, b: float = 0.0, t: float = 0.95, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiV3 acceptance strategy from Genius.

A variant of AC_Combi that uses linear interpolation between AC_Next threshold and reserved value based on time.

The acceptance threshold decreases linearly from next offer utility to reserved value as time progresses past threshold t.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • a – Scaling factor for opponent’s offer utility (default 1.0).

  • b – Offset added to scaled opponent utility (default 0.0).

  • t – Time threshold when interpolation begins (default 0.95).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiV3

a: float[source]
b: float[source]
offering_policy: OfferingPolicy[source]
t: float[source]
class negmas.gb.GACCombiV4(offering_policy: OfferingPolicy, t: float = 0.98, w: float = 0.5, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_CombiV4 acceptance strategy from Genius.

A variant of AC_Combi that combines AC_Next with a weighted combination of max and average opponent offers in the end game.

Before time t: acts like AC_Next. After time t: accepts if opponent’s offer >= weighted combo of max and avg.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • t – Time threshold after which combined strategy kicks in (default 0.98).

  • w – Weight for max utility (1-w used for avg utility) (default 0.5).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_CombiV4

offering_policy: OfferingPolicy[source]
t: float[source]
w: float[source]
class negmas.gb.GACConst(c: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Const acceptance strategy from Genius.

Accepts an offer if its utility exceeds a constant threshold.

Parameters:

c – Constant threshold. Accept if utility > c (default 0.9).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_Const

c: float[source]
class negmas.gb.GACConstDiscounted(c: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_ConstDiscounted acceptance strategy from Genius.

Accepts an offer if its discounted utility exceeds a constant threshold. Takes time discount into account.

Parameters:

c – Constant threshold. Accept if discounted utility > c (default 0.9).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_ConstDiscounted

c: float[source]
class negmas.gb.GACFalse(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_False acceptance strategy from Genius.

Never accepts any offer. Useful for debugging and testing.

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_False

class negmas.gb.GACGahboninho(high_threshold: float = 0.95, min_acceptable: float = 0.7, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Gahboninho acceptance strategy from Genius (ANAC2011).

High threshold strategy that accepts offers above 0.95 utility early, or above a minimum acceptable threshold that adapts over time.

Parameters:
  • high_threshold – Utility threshold for early acceptance (default 0.95).

  • min_acceptable – Minimum acceptable utility (default 0.7).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_Gahboninho

high_threshold: float[source]
min_acceptable: float[source]
class negmas.gb.GACGap(c: float = 0.01, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Gap acceptance strategy from Genius.

Accepts an offer if:

u(opponent_offer) + c >= u(my_previous_offer)

A restricted version of AC_Previous with a=1 and configurable gap.

Parameters:

c – Gap constant added to opponent utility (default 0.01).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_Gap

c: float[source]
class negmas.gb.GACHardHeaded(offering_policy: OfferingPolicy, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_HardHeaded acceptance strategy from Genius (ANAC2011).

Accepts if the opponent’s offer utility is greater than our lowest offered utility so far, or if it’s at least as good as our next bid.

Parameters:

offering_policy – The offering strategy to determine next bid.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_HardHeaded

offering_policy: OfferingPolicy[source]
class negmas.gb.GACIAMCrazyHaggler(offering_policy: OfferingPolicy, maximum_aspiration: float = 0.85, accept_multiplier: float = 1.02, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_IAMcrazyHaggler acceptance strategy from Genius (ANAC2010).

A high-aspiration strategy that accepts only when the opponent’s offer is close to our maximum aspiration or our own offers.

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • maximum_aspiration – Target utility threshold (default 0.85).

  • accept_multiplier – Multiplier for acceptance comparison (default 1.02).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2010.AC_IAMcrazyHaggler

accept_multiplier: float[source]
maximum_aspiration: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACIAMHaggler2010(offering_policy: OfferingPolicy, maximum_aspiration: float = 0.9, accept_multiplier: float = 1.02, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_IAMHaggler2010 acceptance strategy from Genius (ANAC2010).

Similar to IAMCrazyHaggler but with slightly different thresholds. Uses concession rate estimation for acceptance.

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • maximum_aspiration – Target utility threshold (default 0.9).

  • accept_multiplier – Multiplier for acceptance comparison (default 1.02).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2010.AC_IAMHaggler2010

accept_multiplier: float[source]
maximum_aspiration: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACIAMHaggler2011(offering_policy: OfferingPolicy, maximum_aspiration: float = 0.9, accept_multiplier: float = 1.02, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_IAMHaggler2011 acceptance strategy from Genius (ANAC2011).

GP-smoothed estimate based acceptance. Similar to IAMHaggler2010 with improved estimation.

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • maximum_aspiration – Target utility threshold (default 0.9).

  • accept_multiplier – Multiplier for acceptance comparison (default 1.02).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_IAMHaggler2011

accept_multiplier: float[source]
maximum_aspiration: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACIAMHaggler2012(offering_policy: OfferingPolicy, accept_multiplier: float = 1.02, maximum_aspiration: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_IAMHaggler2012 acceptance strategy from Genius (ANAC2012).

Adaptive threshold acceptance with multiplier-based comparison.

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • accept_multiplier – Multiplier for acceptance (default 1.02).

  • maximum_aspiration – Maximum target utility (default 0.9).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2012.AC_IAMHaggler2012

accept_multiplier: float[source]
maximum_aspiration: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACInoxAgent(reservation_value: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_InoxAgent acceptance strategy from Genius (ANAC2013).

Scaling threshold acceptance. Breaks when reservation value is better, accepts when opponent’s offer exceeds a time-dependent threshold.

Parameters:

reservation_value – Minimum acceptable utility (default 0.0).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2013.AC_InoxAgent

reservation_value: float[source]
class negmas.gb.GACInoxAgentOneIssue(reservation_value: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_InoxAgent_OneIssue acceptance strategy from Genius (ANAC2013).

Simplified InoxAgent for single-issue domains. Accepts when opponent’s offer exceeds median utility.

Parameters:

reservation_value – Minimum acceptable utility (default 0.0).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2013.AC_InoxAgent_OneIssue

reservation_value: float[source]
class negmas.gb.GACMAC(offering_policy: OfferingPolicy, constant: float = 0.95, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_MAC acceptance strategy from Genius.

Multi-acceptance condition testing. Combines multiple AC strategies and accepts if any of them would accept.

This is a simplified version that combines AC_CombiV4 and AC_CombiMaxInWindow with default parameters.

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • constant – Utility threshold (default 0.95).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_MAC

constant: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACNext(offering_policy: OfferingPolicy, a: float = 1.0, b: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Next acceptance strategy from Genius.

Accepts an offer if:

a * u(opponent_offer) + b >= u(my_next_offer)

where:
  • u(opponent_offer): Utility of the opponent’s current offer

  • u(my_next_offer): Utility of the offer we would make next

  • a: Scaling factor (default 1.0)

  • b: Offset factor (default 0.0)

With default parameters (a=1, b=0), this accepts if the opponent’s offer is at least as good as what we would offer next.

Parameters:
  • offering_policy – The offering strategy used to determine my next offer.

  • a – Scaling factor for opponent’s offer utility (default 1.0).

  • b – Offset added to scaled opponent utility (default 0.0).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_Next

a: float[source]
b: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACNiceTitForTat(offering_policy: OfferingPolicy, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_NiceTitForTat acceptance strategy from Genius (ANAC2011).

Cooperative strategy based on opponent behavior. Uses AC_Next logic combined with probabilistic acceptance near the deadline.

Parameters:

offering_policy – The offering strategy to determine next bid.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_NiceTitForTat

offering_policy: OfferingPolicy[source]
class negmas.gb.GACNozomi(max_util_threshold: float = 0.95, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Nozomi acceptance strategy from Genius (ANAC2010).

A sophisticated strategy that considers opponent modeling, time pressure, and evaluation gap between bids. Accepts based on multiple conditions that change with time phases.

Parameters:

max_util_threshold – Threshold relative to max utility (default 0.95).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2010.AC_Nozomi

max_util_threshold: float[source]
class negmas.gb.GACOMACagent(offering_policy: OfferingPolicy, discount_threshold: float = 0.845, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_OMACagent acceptance strategy from Genius (ANAC2012).

Accepts if we’ve made this bid before or if opponent’s utility is at least as good as our planned bid.

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • discount_threshold – Discount threshold for special behavior (default 0.845).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2012.AC_OMACagent

discount_threshold: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACPrevious(a: float = 1.0, b: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Previous acceptance strategy from Genius.

Accepts an offer if:

a * u(opponent_offer) + b >= u(my_previous_offer)

Similar to AC_Next but compares against our previous offer instead of next.

Parameters:
  • a – Scaling factor for opponent’s offer utility (default 1.0).

  • b – Offset added to scaled opponent utility (default 0.0).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_Previous

a: float[source]
b: float[source]
class negmas.gb.GACTheFawkes(offering_policy: OfferingPolicy, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_TheFawkes acceptance strategy from Genius (ANAC2013).

ACcombi = ACnext || (ACtime(T) & ACconst(MAXw)). Accepts when our bid is worse than opponent’s, or near deadline when opponent’s bid has maximum value in a window.

Parameters:

offering_policy – The offering strategy to determine next bid.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2013.AC_TheFawkes

offering_policy: OfferingPolicy[source]
class negmas.gb.GACTheNegotiator(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_TheNegotiator acceptance strategy from Genius (ANAC2011).

State machine with phases: hardball, conceding, and desperate. Acceptance threshold varies based on the current phase.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_TheNegotiator

class negmas.gb.GACTheNegotiatorReloaded(offering_policy: OfferingPolicy, a_next: float = 1.0, b_next: float = 0.0, constant: float = 0.98, panic_time: float = 0.99, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_TheNegotiatorReloaded acceptance strategy from Genius (ANAC2012).

Phase-based acceptance with domain analysis. Uses AC_Next variant combined with AC_MaxInWindow for panic phase.

Parameters:
  • offering_policy – The offering strategy to determine next bid.

  • a_next – Scaling factor for AC_next no discount (default 1.0).

  • b_next – Addition factor for AC_next no discount (default 0.0).

  • constant – Utility threshold above which to always accept (default 0.98).

  • panic_time – Time after which panic phase begins (default 0.99).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2012.AC_TheNegotiatorReloaded

a_next: float[source]
b_next: float[source]
constant: float[source]
offering_policy: OfferingPolicy[source]
panic_time: float[source]
class negmas.gb.GACTime(t: float = 0.99, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Time acceptance strategy from Genius.

Accepts any offer after a certain time threshold has passed.

Parameters:

t – Time threshold (0 to 1). Accept any offer when time > t (default 0.99).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_Time

t: float[source]
class negmas.gb.GACTrue(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_True acceptance strategy from Genius.

Always accepts any offer. Useful for debugging and testing.

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_True

class negmas.gb.GACUncertain(top_percentile: float = 0.1, utility_ratio: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Uncertain acceptance strategy from Genius.

Handles uncertainty profiles. Accepts if offer is in top 10% of bids or if utility is at least 90% of our last offer.

Parameters:
  • top_percentile – Top percentile to accept (default 0.1).

  • utility_ratio – Minimum ratio to our last offer (default 0.9).

Transcompiled from: negotiator.boaframework.acceptanceconditions.other.AC_Uncertain

top_percentile: float[source]
utility_ratio: float[source]
class negmas.gb.GACValueModelAgent(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_ValueModelAgent acceptance strategy from Genius (ANAC2011).

Value model based acceptance that tracks opponent’s maximum utility and accepts based on various thresholds that change with time.

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_ValueModelAgent

class negmas.gb.GACYushu(initial_target: float = 0.95, final_target: float = 0.7, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusAcceptancePolicy

AC_Yushu acceptance strategy from Genius (ANAC2010).

Time-dependent threshold strategy. The target utility decreases from a high value (0.95) towards a lower acceptable value (0.7) as time progresses.

Parameters:
  • initial_target – Initial target utility (default 0.95).

  • final_target – Final target utility at deadline (default 0.7).

Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2010.AC_Yushu

final_target: float[source]
initial_target: float[source]
class negmas.gb.GAOEvaluationStrategy[source]

Bases: LocalEvaluationStrategy

GAOEvaluation strategy.

eval(negotiator_id: str, state: ThreadState, history: list[ThreadState], mechanism_state: MechanismState) tuple | None | Literal['continue'][source]

Evaluate using the Generalized Accept/Offer protocol.

Parameters:
  • negotiator_id – ID of the negotiator being evaluated.

  • state – Current state of the negotiation thread.

  • history – List of previous thread states for context.

  • mechanism_state – Overall mechanism state.

Returns:

Response indicating whether to accept the offer or continue/end negotiation.

class negmas.gb.GAgentFSEGAOffering(min_utility: float = 0.5, sigma: float = 0.01, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

AgentFSEGA offering strategy from ANAC 2010.

This strategy uses a time-dependent utility threshold that decreases exponentially over time. It selects bids that maximize opponent utility while staying above the threshold.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.AgentFSEGA_Offering

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

Initialize utility function.

sigma: float[source]
class negmas.gb.GAgentK2Offering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

AgentK2 offering strategy from ANAC 2011.

Enhanced version of AgentK with improved opponent modeling.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.AgentK2_Offering

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

Initialize utility function.

class negmas.gb.GAgentKOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

AgentK offering strategy from ANAC 2010.

This strategy uses a time-dependent target utility that adapts based on the opponent’s behavior. It maintains a map of offered bids and selects bids above a dynamic target threshold.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.AgentK_Offering

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

Initialize utility function and parameters.

class negmas.gb.GAgentLGModel(issue_weights: dict[int, float] = NOTHING, value_utils: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

AgentLG opponent model.

This model uses learning-based estimation of opponent preferences.

Transcompiled from: negotiator.boaframework.opponentmodel.AgentLGModel

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

Evaluate opponent utility.

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

Return normalized utility.

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

Handle preference changes.

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

Update model based on opponent’s offer.

class negmas.gb.GAgentLGOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

AgentLG offering strategy from ANAC 2012.

This strategy uses learning-based concession.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.AgentLG_Offering

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

Initialize utility function.

class negmas.gb.GAgentMROffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

AgentMR offering strategy from ANAC 2012.

This strategy uses risk-based concession.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.AgentMR_Offering

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

Initialize utility function.

class negmas.gb.GAgentSmithOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

AgentSmith offering strategy from ANAC 2010.

This strategy offers bids based on a time-dependent concession, similar to Boulware but with specific parameters.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.AgentSmith_Offering

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

Initialize utility function.

class negmas.gb.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.

class negmas.gb.GBComponent(*, negotiator: GBNegotiator | None = None)[source]

Bases: Component

GBComponent implementation.

after_proposing(state: GBState, offer: Outcome | ExtendedOutcome | None, dest: str | None = None)[source]

Called after proposing

after_responding(state: GBState, offer: Outcome | None, response: ResponseType | ExtendedResponseType, source: str | None = None)[source]

Called before offering

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

Called before proposing

before_responding(state: GBState, offer: Outcome | None, source: str | None = None)[source]

Called before offering

on_negotiator_didnot_enter(negotiator_id: str, state: GBState) None[source]

A callback called when a negotiator tried but failed to enter the negotiation.

Parameters:
  • negotiator_id – The ID of the negotiator that failed to enter.

  • stateMechanismState giving current state of the negotiation.

Remarks:
  • The default behavior is to do nothing.

  • Override this to hook some action when a partner fails to join.

on_negotiator_entered(negotiator_id: str, state: GBState) None[source]

A callback called when a new negotiator enters the negotiation.

Parameters:
  • negotiator_id – The ID of the negotiator that entered.

  • stateMechanismState giving current state of the negotiation.

Remarks:
  • The default behavior is to do nothing.

  • Override this to hook some action when a new partner joins.

on_negotiator_left(negotiator_id: str, state: GBState) None[source]

A callback called when another negotiator leaves the negotiation.

Parameters:
  • negotiator_id – The ID of the negotiator that left.

  • stateMechanismState giving current state of the negotiation.

Remarks:
  • The default behavior is to do nothing.

  • Override this to hook some action when a partner leaves.

on_partner_ended(partner: str)[source]

Called when a partner ends the negotiation.

Note that the negotiator owning this component may never receive this offer. This is only receivd if the mechanism is sending notifications on every offer.

on_partner_joined(partner: str)[source]

Called when a partner joins the negotiation.

This is only receivd if the mechanism is sending notifications.

on_partner_left(partner: str)[source]

Called when a partner leaves the negotiation.

This is only receivd if the mechanism is sending notifications.

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

A callback called by the mechanism when a partner proposes something

Parameters:
  • stateMechanismState giving the state of the negotiation when the offer was porposed.

  • partner_id – The ID of the agent who proposed

  • offer – The proposal.

Remarks:
  • Will only be called if enable_callbacks is set for the mechanism

on_partner_refused_to_propose(state: GBState, partner_id: str) None[source]

A callback called by the mechanism when a partner refuses to propose

Parameters:
  • stateMechanismState giving the state of the negotiation when the partner refused to offer.

  • partner_id – The ID of the agent who refused to propose

Remarks:
  • Will only be called if enable_callbacks is set for the mechanism

on_partner_response(state: GBState, partner_id: str, outcome: Outcome | None, response: ResponseType) None[source]

A callback called by the mechanism when a partner responds to some offer

Parameters:
  • stateMechanismState giving the state of the negotiation when the partner responded.

  • partner_id – The ID of the agent who responded

  • outcome – The proposal being responded to.

  • response – The response

Remarks:
  • Will only be called if enable_callbacks is set for the mechanism

class negmas.gb.GBMechanism(*args, evaluator_type: type[~negmas.gb.evaluators.base.EvaluationStrategy] | None = None, evaluator_params: dict[str, ~typing.Any] | None = None, local_evaluator_type: type[~negmas.gb.evaluators.base.LocalEvaluationStrategy] | None = None, local_evaluator_params: dict[str, ~typing.Any] | None = None, constraint_type: type[~negmas.gb.constraints.base.OfferingConstraint] | None = None, constraint_params: dict[str, ~typing.Any] | None = None, local_constraint_type: type[~negmas.gb.constraints.base.LocalOfferingConstraint] | None = None, local_constraint_params: dict[str, ~typing.Any] | None = None, response_combiner: ~typing.Callable[[list[tuple | None | ~typing.Literal['continue']]], tuple | None | ~typing.Literal['continue']] = <function all_accept>, dynamic_entry=False, extra_callbacks=False, check_offers=False, enforce_issue_types=False, cast_offers=False, end_on_no_response=True, ignore_negotiator_exceptions=False, parallel: bool = True, sync_calls: bool = False, initial_state: ~negmas.gb.common.GBState | None = None, allow_negotiators_to_leave: bool = True, **kwargs)[source]

Bases: BaseGBMechanism

Generalized Bargaining (GB) mechanism.

Implements the Generalized Bargaining Protocol framework for automated negotiation. This mechanism supports configurable evaluation strategies and offering constraints that can be applied globally or per-thread.

References

Mohammad, Y. (2023). Generalized Bargaining Protocols. In: Australasian Joint Conference on Artificial Intelligence (AI 2023). Springer. https://doi.org/10.1007/978-981-99-8391-9_37

add(negotiator: GBNegotiator, *, preferences: Preferences | None = None, role: str | None = None, ufun: BaseUtilityFunction | None = None) bool | None[source]

Add a negotiator to the mechanism with its evaluator and constraint.

Parameters:
  • negotiator – The negotiator instance to add to this mechanism.

  • preferences – Optional preferences to assign to the negotiator.

  • role – Optional role identifier for the negotiator.

  • ufun – Optional utility function to assign to the negotiator.

Returns:

True if successfully added, False if rejected, None if already present.

property agreement_partners: list[GBNegotiator][source]

Returns negotiators who are part of the final agreement.

This is the same as participating_negotiators - it includes all negotiators who haven’t left the negotiation.

Returns:

List of negotiator objects who participated in the final outcome.

property extended_trace: list[tuple[int, str, tuple | None]][source]

Returns the negotiation history as a list of step/negotiator/offer tuples.

property full_trace: list[TraceElement][source]

Returns the complete negotiation history with timing, offers, responses, and metadata.

property n_participating: int[source]

Number of negotiators still participating (not left).

Returns:

Count of active negotiators.

negotiator_full_trace(negotiator_id: str) list[tuple[float, float, int, tuple, str, str | None, dict[str, Any] | None]][source]

Returns the (time/relative-time/step/outcome/response) given by a negotiator (in order)

negotiator_offers(negotiator_id: str) list[tuple | None][source]

Returns the offers given by a negotiator (in order)

property offers: list[tuple | None][source]

Returns the negotiation history as a list of offers.

property participating_negotiators: list[GBNegotiator][source]

Returns negotiators still participating (those who haven’t left).

Unlike negmas.negotiators, this excludes any negotiator that has returned a LEAVE response. The original negotiator list and indices remain unchanged to avoid breaking any saved references.

Returns:

List of negotiator objects still active in the negotiation.

plot(plotting_negotiators: tuple[int, int] | tuple[str, str] = (0, 1), save_fig: bool = False, path: str | None = None, fig_name: str | None = None, ignore_none_offers: bool = True, with_lines: bool = True, show_agreement: bool = False, show_pareto_distance: bool = True, show_nash_distance: bool = True, show_kalai_distance: bool = True, show_max_welfare_distance: bool = True, show_max_relative_welfare_distance: bool = False, show_end_reason: bool = True, show_annotations: bool = False, show_reserved: bool = True, show_total_time=True, show_relative_time=True, show_n_steps=True, colors: list | None = None, markers: list[str] | None = None, colormap: str = 'jet', ylimits: tuple[float, float] | None = None, common_legend: bool = True, xdim: str = 'step', colorizer: Colorizer | None = None, only2d: bool = False, fast=False, simple_offers_view=False, **kwargs)[source]

Visualize the negotiation session showing offers, utilities, and outcome metrics.

Parameters:
  • plotting_negotiators – Indices or IDs of the two negotiators to plot.

  • save_fig – Whether to save the figure to disk.

  • path – Directory path for saving the figure.

  • fig_name – Filename for the saved figure.

  • ignore_none_offers – Whether to skip None offers in the plot.

  • with_lines – Whether to connect offer points with lines.

  • show_agreement – Whether to highlight the final agreement point.

  • show_pareto_distance – Whether to display distance to Pareto frontier.

  • show_nash_distance – Whether to display distance to Nash solution.

  • show_kalai_distance – Whether to display distance to Kalai-Smorodinsky solution.

  • show_max_welfare_distance – Whether to display distance to max welfare point.

  • show_max_relative_welfare_distance – Whether to display distance to max relative welfare.

  • show_end_reason – Whether to annotate the reason for negotiation end.

  • show_annotations – Whether to show offer annotations on the plot.

  • show_reserved – Whether to show reserved value lines.

  • show_total_time – Whether to display total elapsed time.

  • show_relative_time – Whether to display relative time progress.

  • show_n_steps – Whether to display the number of negotiation steps.

  • colors – Custom color sequence for plotting negotiators.

  • markers – Custom marker styles for each negotiator.

  • colormap – Matplotlib colormap name for gradient coloring.

  • ylimits – Y-axis limits as (min, max) tuple.

  • common_legend – Whether to use a shared legend for all subplots.

  • xdim – X-axis dimension, either “step” or “time”.

  • colorizer – Custom function for determining point colors.

  • only2d – Whether to show only the 2D utility plot.

  • fast – Whether to use fast rendering (less detail).

  • simple_offers_view – Whether to use simplified offer visualization.

  • **kwargs – Additional arguments passed to the plotting function.

set_sync_call(v: bool)[source]

Enable or disable synchronous callback execution.

property trace: list[tuple[str, tuple | None]][source]

Returns the negotiation history as a list of negotiator/offer tuples.

class negmas.gb.GBMetaNegotiator(*args, negotiators: Iterable[GBNegotiator], negotiator_names: Iterable[str] | None = None, share_ufun: bool = True, share_nmi: bool = True, **kwargs)[source]

Bases: MetaNegotiator, GBNegotiator

A meta-negotiator for GB (General Bargaining) protocols that aggregates multiple GBNegotiator instances.

Unlike GBModularNegotiator which uses GBComponent behavior pieces, GBMetaNegotiator works with complete GBNegotiator instances. This allows for ensemble strategies where multiple negotiators can vote on proposals or responses.

Subclasses must implement aggregate_proposals and aggregate_responses to define how proposals and responses from sub-negotiators are combined.

Parameters:
  • negotiators – An iterable of GBNegotiator instances to manage.

  • negotiator_names – Optional names for the negotiators.

  • share_ufun – If True (default), sub-negotiators will share the parent’s ufun.

  • share_nmi – If True (default), sub-negotiators will receive the parent’s NMI on join.

  • *args – Additional positional arguments passed to the base class.

  • **kwargs – Additional keyword arguments passed to the base class.

Remarks:
  • propose collects proposals from all sub-negotiators and aggregates them.

  • respond collects responses from all sub-negotiators and aggregates them.

  • All GB-specific callbacks are delegated to all sub-negotiators.

abstractmethod aggregate_proposals(state: GBState, proposals: list[tuple[GBNegotiator, tuple | ExtendedOutcome | None]], dest: str | None = None) tuple | ExtendedOutcome | None[source]

Aggregate proposals from all sub-negotiators into a single proposal.

Parameters:
  • state – The current GB state.

  • proposals – List of (negotiator, proposal) tuples from sub-negotiators.

  • dest – The destination partner ID (if applicable).

Returns:

The aggregated proposal, or None to refuse to propose.

abstractmethod aggregate_responses(state: GBState, responses: list[tuple[GBNegotiator, ResponseType | ExtendedResponseType]], offer: tuple | None, source: str | None = None) ResponseType | ExtendedResponseType[source]

Aggregate responses from all sub-negotiators into a single response.

Parameters:
  • state – The current GB state.

  • responses – List of (negotiator, response) tuples from sub-negotiators.

  • offer – The offer being responded to.

  • source – The source partner ID (if applicable).

Returns:

The aggregated response.

property gb_negotiators: tuple[GBNegotiator, ...][source]

Return the tuple of GB sub-negotiators.

Returns:

A tuple of all GB sub-negotiators.

join(nmi: NegotiatorMechanismInterface, state: MechanismState, *, preferences: Preferences | None = None, ufun: BaseUtilityFunction | None = None, role: str = 'negotiator') bool[source]

Join a negotiation and have sub-negotiators join too.

Parameters:
  • nmi – The negotiator-mechanism interface.

  • state – The current mechanism state.

  • preferences – Optional preferences for this negotiator.

  • ufun – Optional utility function (overrides preferences).

  • role – The role in the negotiation.

Returns:

True if successfully joined, False otherwise.

on_leave(state: MechanismState) None[source]

Notify all sub-negotiators that we’re leaving the negotiation.

on_mechanism_error(state: MechanismState) None[source]

Notify all sub-negotiators of a mechanism error.

on_negotiation_end(state: MechanismState) None[source]

Notify all sub-negotiators that negotiation has ended.

on_negotiation_start(state: MechanismState) None[source]

Notify all sub-negotiators that negotiation has started.

on_negotiator_didnot_enter(negotiator_id: str, state: MechanismState) None[source]

Notify all sub-negotiators that a negotiator failed to enter the negotiation.

on_negotiator_entered(negotiator_id: str, state: MechanismState) None[source]

Notify all sub-negotiators that a new negotiator entered the negotiation.

on_negotiator_left(negotiator_id: str, state: MechanismState) None[source]

Notify all sub-negotiators that a negotiator left the negotiation.

on_partner_ended(partner: str) None[source]

Notify all sub-negotiators that a partner ended the negotiation.

on_partner_joined(partner: str) None[source]

Notify all sub-negotiators that a partner joined.

on_partner_left(partner: str) None[source]

Notify all sub-negotiators that a partner left.

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

Notify all sub-negotiators of a partner’s proposal.

on_partner_refused_to_propose(state: GBState, partner_id: str) None[source]

Notify all sub-negotiators that a partner refused to propose.

on_partner_response(state: GBState, partner_id: str, outcome: tuple, response: ResponseType) None[source]

Notify all sub-negotiators of a partner’s response.

on_round_end(state: MechanismState) None[source]

Notify all sub-negotiators that a round has ended.

on_round_start(state: MechanismState) None[source]

Notify all sub-negotiators that a round has started.

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

Collect proposals from all sub-negotiators and aggregate them.

Parameters:
  • state – The current GB state.

  • dest – The destination partner ID (if applicable).

Returns:

The aggregated proposal.

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

Collect responses from all sub-negotiators and aggregate them.

Parameters:
  • state – The current GB state.

  • source – The source partner ID.

Returns:

The aggregated response.

class negmas.gb.GBNMI(id: str, n_outcomes: int | float, outcome_space: OutcomeSpace, shared_time_limit: float, shared_n_steps: int | None, private_time_limit: float, private_n_steps: int | None, pend: float, pend_per_second: float, step_time_limit: float, negotiator_time_limit: float, dynamic_entry: bool, max_n_negotiators: int | None, _mechanism: Mechanism, annotation: dict[str, Any] = NOTHING)[source]

Bases: NegotiatorMechanismInterface

GBNMI implementation.

annotation[source]

An arbitrary annotation as a dict[str, Any] that is always available for all negotiators

dynamic_entry[source]

Whether it is allowed for negotiators to enter/leave the negotiation after it starts

id[source]

Mechanism session ID. That is unique for all mechanisms

max_n_negotiators[source]

Maximum allowed number of negotiators in the session. None indicates no limit

n_outcomes[source]

Number of outcomes which may be float('inf') indicating infinity

n_steps[source]

The effective allowed number of steps for this negotiator. Computed as min(shared_n_steps, private_n_steps) in __attrs_post_init__

negotiator_time_limit[source]

The time limit in seconds to wait for negotiator responses of this negotiation session. None indicates infinity

outcome_space[source]

Negotiation agenda as as an OutcomeSpace object. The most common type is CartesianOutcomeSpace which represents the cartesian product of a list of issues

pend[source]

The probability that the negotiation times out at every step. Must be less than one. If <= 0, it is ignored

pend_per_second[source]

The probability that the negotiation times out every second. Must be less than one. If <= 0, it is ignored

private_n_steps[source]

The private allowed number of steps for this negotiator. None indicates infinity. Set via Mechanism.add(n_steps=…)

private_time_limit[source]

The private time limit in seconds for this negotiator. inf indicates infinity. Set via Mechanism.add(time_limit=…)

shared_n_steps[source]

The shared allowed number of steps for this negotiation. Applies to all negotiators. None indicates infinity

shared_time_limit[source]

The shared time limit in seconds for this negotiation session. Applies to all negotiators. inf indicates infinity

step_time_limit[source]

The time limit in seconds for each step of this negotiation session. None indicates infinity

time_limit[source]

The effective time limit in seconds for this negotiator. Computed as min(shared_time_limit, private_time_limit) in __attrs_post_init__

class negmas.gb.GBNegotiator(preferences: Preferences | None = None, ufun: BaseUtilityFunction | None = None, name: str | None = None, parent: Controller | None = None, owner: Agent | None = None, id: str | None = None, type_name: str | None = None, **kwargs)[source]

Bases: Negotiator[GBNMI, GBState], Generic[TNMI, TState]

Base class for all GB negotiators.

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The utility function of the negotiator (overrides preferences if given)

  • owner – The Agent that owns the negotiator.

Remarks:

  • The only method that must be implemented by any GBNegotiator is propose.

  • The default respond method, accepts offers with a utility value no less than whatever propose returns with the same mechanism state.

on_partner_ended(partner: str)[source]

Called when a partner ends the negotiation.

Note that the negotiator owning this component may never receive this offer. This is only received if the mechanism is sending notifications on every offer.

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

A callback called by the mechanism when a partner proposes something

Parameters:
  • stateGBState giving the state of the negotiation when the offer was porposed.

  • partner_id – The ID of the agent who proposed

  • offer – The proposal.

Remarks:
  • Will only be called if enable_callbacks is set for the mechanism

on_partner_refused_to_propose(state: GBState, partner_id: str) None[source]

A callback called by the mechanism when a partner refuses to propose.

Parameters:
  • stateGBState giving the state of the negotiation when the partner refused to offer.

  • partner_id – The ID of the agent who refused to propose.

Remarks:
  • Will only be called if enable_callbacks is set for the mechanism.

on_partner_response(state: GBState, partner_id: str, outcome: tuple, response: ResponseType) None[source]

A callback called by the mechanism when a partner responds to some offer

Parameters:
  • stateGBState giving the state of the negotiation when the partner responded.

  • partner_id – The ID of the agent who responded

  • outcome – The proposal being responded to.

  • response – The response

Remarks:

  • Will only be called if enable_callbacks is set for the mechanism

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

Propose an offer or None to refuse.

Parameters:

stateGBState giving current state of the negotiation.

Returns:

The outcome being proposed or None to refuse to propose

Remarks:

  • This function guarantees that no agents can propose something with a utility value

propose_(state: SAOState, dest: str | None = None) Outcome | ExtendedOutcome | None[source]

Propose .

Parameters:
  • state – Current state.

  • dest – Dest.

Returns:

The result.

Return type:

Outcome | ExtendedOutcome | None

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

Called to respond to an offer. This is the method that should be overriden to provide an acceptance strategy.

Parameters:

state – a GBState giving current state of the negotiation.

Returns:

The response to the offer

Return type:

ResponseType | ExtendedResponseType

Remarks:

  • The default implementation never ends the negotiation

  • The default implementation asks the negotiator to propose`() and accepts the `offer if its utility was at least as good as the offer that it would have proposed (and above the reserved value).

  • Current offer is accessible through state.threads[source].current_offer as long as source != None otherwise it is None

respond_(state: SAOState, source: str | None = None) ResponseType | ExtendedResponseType[source]

Respond .

Parameters:
  • state – Current state.

  • source – Source identifier.

Returns:

The result.

Return type:

ResponseType | ExtendedResponseType

class negmas.gb.GBRAMAgent2Offering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

BRAMAgent2 offering strategy from ANAC 2012.

Enhanced version of BRAMAgent with improved statistics tracking.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.BRAMAgent2_Offering

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

Initialize utility function.

class negmas.gb.GBRAMAgentOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

BRAMAgent offering strategy from ANAC 2011.

This strategy uses opponent modeling based on bid frequency statistics to create bids that are acceptable to both parties.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.BRAMAgent_Offering

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

Initialize utility function.

class negmas.gb.GBState(running: bool = False, waiting: bool = False, started: bool = False, step: int = 0, time: float = 0.0, relative_time: float = 0.0, broken: bool = False, timedout: bool = False, agreement: Outcome | None = None, results: Outcome | OutcomeSpace | tuple[Outcome] | None = None, n_negotiators: int = 0, has_error: bool = False, error_details: str = '', erred_negotiator: str = '', erred_agent: str = '', threads: dict[str, ThreadState] = NOTHING, last_thread: str = '', left_negotiators: set[str] = NOTHING)[source]

Bases: MechanismState

GBState implementation.

property base_state: MechanismState[source]

Base state.

Returns:

The result.

Return type:

MechanismState

last_thread: str[source]
left_negotiators: set[str][source]

Set of negotiator IDs that have left the negotiation via LEAVE response.

property n_participating: int[source]

Number of negotiators still participating (not left).

classmethod thread_history(history: list[GBState], source: str) list[ThreadState][source]

Thread history.

Parameters:
  • history – History.

  • source – Source identifier.

Returns:

The result.

Return type:

list[ThreadState]

threads: dict[str, ThreadState][source]
class negmas.gb.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.GBoulwareOffering(e: float = 0.2, k: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Boulware offering strategy - a time-dependent strategy with e < 1.

Concedes slowly at first, then faster as deadline approaches. This is a convenience wrapper around GTimeDependentOffering.

Parameters:
  • e – Concession exponent (default 0.2, typical Boulware value).

  • k – Offset constant (default 0).

Transcompiled from: negotiator.boaframework.offeringstrategy.other.TimeDependent_Offering with e < 1

e: float[source]
k: float[source]
on_preferences_changed(changes: list[PreferencesChange]) None[source]

Initialize the delegate time-dependent offering strategy.

class negmas.gb.GCUHKAgentOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

CUHKAgent offering strategy from ANAC 2012.

This strategy uses sophisticated opponent modeling and adaptive concession.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.CUHKAgent_Offering

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

Initialize utility function.

class negmas.gb.GCUHKFrequencyModel(issue_weights: dict[int, float] = NOTHING, value_counts: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

CUHK Frequency-based opponent model.

This model tracks bid frequencies and uses them to estimate opponent preferences with specific adaptations from the CUHK agent.

Transcompiled from: negotiator.boaframework.opponentmodel.CUHKFrequencyModelV2

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

Evaluate opponent utility.

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

Return normalized utility.

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

Handle preference changes.

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

Update model based on opponent’s offer.

class negmas.gb.GChoosingAllBids(all_outcomes: list[Outcome] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

ChoosingAllBids offering strategy from Genius.

Iterates through all possible bids in the domain, offering each one in sequence. Useful for exhaustive exploration or testing.

When all bids have been offered, it restarts from the beginning.

Transcompiled from: negotiator.boaframework.offeringstrategy.other.ChoosingAllBids

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

Initialize the list of all outcomes.

class negmas.gb.GConcederOffering(e: float = 2.0, k: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Conceder offering strategy - a time-dependent strategy with e > 1.

Concedes quickly at first, then slows down as deadline approaches. This is a convenience wrapper around GTimeDependentOffering.

Parameters:
  • e – Concession exponent (default 2.0, typical Conceder value).

  • k – Offset constant (default 0).

Transcompiled from: negotiator.boaframework.offeringstrategy.other.TimeDependent_Offering with e > 1

e: float[source]
k: float[source]
on_preferences_changed(changes: list[PreferencesChange]) None[source]

Initialize the delegate time-dependent offering strategy.

class negmas.gb.GDefaultModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Default opponent model from Genius.

A no-op model that doesn’t learn from opponent behavior and assumes uniform preferences. Always returns 0.5 utility for any outcome.

Useful as a baseline or placeholder when no opponent modeling is needed.

Transcompiled from: negotiator.boaframework.opponentmodel.DefaultModel

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

Return constant utility (0.5) for any outcome.

Parameters:

offer – The outcome to evaluate.

Returns:

Always returns 0.5.

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]

No-op - this model doesn’t learn from offers.

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

No-op - this model doesn’t adapt.

class negmas.gb.GFSEGABayesianModel(issue_weights: dict[int, float] = NOTHING, value_utils: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

FSEGA Bayesian opponent model.

This model uses Bayesian inference to estimate opponent preferences, maintaining hypotheses about issue weights and value utilities.

Transcompiled from: negotiator.boaframework.opponentmodel.FSEGABayesianModel

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

Evaluate opponent utility.

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

Return normalized utility.

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

Handle preference changes.

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

Update model based on opponent’s offer.

class negmas.gb.GFawkesOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

TheFawkes offering strategy from ANAC 2013.

This strategy uses wavelet-based prediction for opponent modeling.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2013.Fawkes_Offering

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

Initialize utility function.

class negmas.gb.GGahboninhoOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Gahboninho offering strategy from ANAC 2011.

This strategy uses adaptive concession based on opponent behavior analysis.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.Gahboninho_Offering

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

Initialize utility function.

class negmas.gb.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: negotiator.boaframework.opponentmodel.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.GHardHeadedOffering(ka: float = 0.05, e: float = 0.05, min_utility: float = 0.585, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

HardHeaded offering strategy from ANAC 2011.

This strategy uses a conservative concession approach with queue-based bid selection. It maintains a queue of potential bids and selects based on utility tolerance.

Parameters:
  • ka – Concession parameter (default 0.05).

  • e – Concession exponent (default 0.05).

  • min_utility – Minimum acceptable utility (default 0.585).

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.HardHeaded_Offering

e: float[source]
ka: float[source]
min_utility: float[source]
on_preferences_changed(changes: list[PreferencesChange]) None[source]

Initialize utility function and parameters.

class negmas.gb.GHardlinerOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Hardliner offering strategy - always offers the best outcome.

Never concedes - always offers the maximum utility outcome. This is equivalent to time-dependent with e = 0.

Transcompiled from: negotiator.boaframework.offeringstrategy.other.TimeDependent_Offering with e = 0

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

Initialize the inverse utility function.

class negmas.gb.GIAMCrazyHagglerOffering(breakoff: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

IAMCrazyHaggler offering strategy from ANAC 2010.

This strategy generates random bids with utility above a breakoff threshold. It’s a simple but effective hardliner strategy that never concedes below a minimum utility level.

Parameters:

breakoff – Minimum utility threshold (default 0.9).

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.IAMCrazyHaggler_Offering

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

Initialize the inverse utility function.

class negmas.gb.GIAMHaggler2012Offering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

IAMHaggler2012 offering strategy from ANAC 2012.

Further refined version of IAMhaggler.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.IAMHaggler2012_Offering

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

Initialize utility function.

class negmas.gb.GIAMhaggler2010Offering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

IAMhaggler2010 offering strategy from ANAC 2010.

This strategy uses sophisticated time-dependent concession with opponent modeling considerations.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.IAMhaggler2010_Offering

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

Initialize utility function.

class negmas.gb.GIAMhaggler2011Offering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

IAMhaggler2011 offering strategy from ANAC 2011.

Updated version of IAMhaggler with improved time management.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.IAMhaggler2011_Offering

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

Initialize utility function.

class negmas.gb.GIAMhagglerBayesianModel(issue_weights: dict[int, float] = NOTHING, value_utils: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

IAMhaggler Bayesian opponent model.

This model uses Bayesian inference to estimate opponent preferences with specific adaptation for the IAMhaggler agent family.

Transcompiled from: negotiator.boaframework.opponentmodel.IAMhagglerBayesianModel

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

Evaluate opponent utility.

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

Return normalized utility.

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

Handle preference changes.

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

Update model based on opponent’s offer.

class negmas.gb.GInoxAgentModel(issue_weights: dict[int, float] = NOTHING, value_utils: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

InoxAgent opponent model.

This model uses adaptive preference estimation.

Transcompiled from: negotiator.boaframework.opponentmodel.InoxAgent_OM

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

Evaluate opponent utility.

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

Return normalized utility.

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

Handle preference changes.

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

Update model based on opponent’s offer.

class negmas.gb.GInoxAgentOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

InoxAgent offering strategy from ANAC 2013.

This strategy uses adaptive concession based on negotiation dynamics.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2013.InoxAgent_Offering

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

Initialize utility function.

class negmas.gb.GLinearOffering(k: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Linear offering strategy - a time-dependent strategy with e = 1.

Concedes at a constant rate throughout negotiation. This is a convenience wrapper around GTimeDependentOffering.

Parameters:

k – Offset constant (default 0).

Transcompiled from: negotiator.boaframework.offeringstrategy.other.TimeDependent_Offering with e = 1

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

Initialize the delegate time-dependent offering strategy.

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

Bases: GeniusOpponentModel

Nash frequency-based opponent model from Genius.

A frequency model that aims to estimate outcomes close to the Nash bargaining solution by combining opponent utility estimates with our own utility.

Uses frequency-based opponent modeling but biases toward Pareto-efficient outcomes by considering the product of utilities.

Parameters:

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

Transcompiled from: negotiator.boaframework.opponentmodel.NashFrequencyModel

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

Evaluate opponent utility with Nash-optimal bias.

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 model based on opponent’s offer.

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

Reset the model when preferences change.

class negmas.gb.GNiceTitForTatOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

NiceTitForTat offering strategy from ANAC 2011.

This strategy mirrors opponent concessions while maintaining a minimum acceptable utility level.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.NiceTitForTat_Offering

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

Initialize utility function.

class negmas.gb.GNozomiOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Nozomi offering strategy from ANAC 2010.

This strategy uses adaptive concession based on opponent behavior and time pressure.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.Nozomi_Offering

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

Initialize utility function.

class negmas.gb.GOMACagentOffering(min_utility: float = 0.59, eu: float = 0.95, discount_threshold: float = 0.845, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

OMACagent offering strategy from ANAC 2012.

This strategy uses prediction-based bidding with exponential moving average.

Parameters:
  • min_utility – Minimum utility threshold (default 0.59).

  • eu – Expected utility threshold (default 0.95).

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.OMACagent_Offering

eu: float[source]
min_utility: float[source]
on_preferences_changed(changes: list[PreferencesChange]) None[source]

Initialize utility function.

class negmas.gb.GOppositeModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Opposite opponent model from Genius.

Assumes the opponent has exactly opposite preferences - what’s good for us is bad for them and vice versa. Returns 1 - our_utility.

This is a pessimistic assumption useful for competitive scenarios.

Transcompiled from: negotiator.boaframework.opponentmodel.OppositeModel

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

Return opposite utility (1 - our utility).

Parameters:

offer – The outcome to evaluate.

Returns:

1 - our_utility for the outcome.

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

Return normalized opposite utility.

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

No-op - this model uses our utility function inversely.

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

No special initialization needed.

class negmas.gb.GPerfectModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Perfect opponent model (for testing/debugging).

This model has access to the opponent’s actual utility function. Only useful in experimental settings where opponent preferences are known.

Transcompiled from: negotiator.boaframework.opponentmodel.PerfectModel

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

Evaluate opponent utility.

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]

Handle partner proposal by updating private_info.

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

Handle preference changes.

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

Update model based on opponent’s offer (stores opponent ufun if available).

class negmas.gb.GRandomOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Random offering strategy from Genius.

This strategy offers random bids from the outcome space, completely ignoring utility. Also known as “Zero Intelligence” or “Random Walker”.

This is useful for: - Debugging and testing - Creating baseline comparisons - Simulating unpredictable opponents

Transcompiled from: negotiator.boaframework.offeringstrategy.other.Random_Offering

class negmas.gb.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.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.GTheFawkesModel(issue_weights: dict[int, float] = NOTHING, value_utils: dict[int, dict] = NOTHING, bid_history: list[Outcome] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

TheFawkes opponent model.

This model uses wavelet-based analysis for opponent preference estimation.

Transcompiled from: negotiator.boaframework.opponentmodel.TheFawkes_OM

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

Evaluate opponent utility.

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

Return normalized utility.

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

Handle preference changes.

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

Update model based on opponent’s offer.

class negmas.gb.GTheNegotiatorOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

TheNegotiator offering strategy from ANAC 2011.

This strategy uses time-dependent concession with adaptive parameters.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.TheNegotiator_Offering

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

Initialize utility function.

class negmas.gb.GTheNegotiatorReloadedOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

TheNegotiatorReloaded offering strategy from ANAC 2012.

Enhanced version of TheNegotiator with improved time management.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.TheNegotiatorReloaded_Offering

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

Initialize utility function.

class negmas.gb.GTimeDependentOffering(e: float = 0.2, k: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Time-dependent offering strategy from Genius.

This strategy offers bids based on a time-dependent target utility curve. The curve is controlled by the concession exponent e: - e = 0: Hardliner (never concedes) - e < 1: Boulware (concedes slowly, faster near deadline) - e = 1: Linear - e > 1: Conceder (concedes quickly at start)

The target utility at time t is computed as:

f(t) = k + (1 - k) * t^(1/e) target(t) = Pmin + (Pmax - Pmin) * (1 - f(t))

where:
  • k: Offset constant (default 0)

  • e: Concession exponent (default 0.2 for Boulware)

  • Pmin: Minimum utility (reserved value)

  • Pmax: Maximum utility (best outcome utility)

Parameters:
  • e – Concession exponent. Controls the shape of the concession curve.

  • k – Offset constant for the time function (default 0).

Transcompiled from: negotiator.boaframework.offeringstrategy.other.TimeDependent_Offering

e: float[source]
k: float[source]
on_preferences_changed(changes: list[PreferencesChange]) None[source]

Initialize the inverse utility function for finding outcomes by utility.

Parameters:

changes – List of preference changes.

class negmas.gb.GUniformModel(outcome_utils: dict[tuple, float] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Uniform opponent model from Genius.

Assumes the opponent values all outcomes equally - returns uniform random utility values. Each outcome gets a consistent random value.

Transcompiled from: negotiator.boaframework.opponentmodel.UniformModel

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

Return a random but consistent utility for the outcome.

Parameters:

offer – The outcome to evaluate.

Returns:

Random utility value in [0, 1], consistent for same outcome.

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]

No-op - this model uses random values.

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

Reset cached utilities when preferences change.

class negmas.gb.GValueModelAgentOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

ValueModelAgent offering strategy from ANAC 2011.

This strategy uses value modeling to predict opponent preferences.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.ValueModelAgent_Offering

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

Initialize utility function.

class negmas.gb.GWorstModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOpponentModel

Worst-case opponent model.

This model assumes the opponent has opposite preferences to ours.

Transcompiled from: negotiator.boaframework.opponentmodel.WorstModel

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

Evaluate opponent utility as inverse of our utility.

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]

Handle partner proposal by updating private_info.

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

Handle preference changes.

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

Update model based on opponent’s offer (no-op for worst model).

class negmas.gb.GYushuOffering(*, negotiator: GBNegotiator | None = None)[source]

Bases: GeniusOfferingPolicy

Yushu offering strategy from ANAC 2010.

This strategy uses a sigmoid-like concession curve.

Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.Yushu_Offering

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

Initialize utility function.

class negmas.gb.GeniusAcceptancePolicy(*, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Base class for Genius acceptance policies.

class negmas.gb.GeniusOfferingPolicy(*, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

Base class for Genius offering policies.

class negmas.gb.GeniusOpponentModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: GBComponent, BaseUtilityFunction

Base class for Genius opponent models.

This base class provides helper methods for updating the negotiator’s private_info with learned opponent utility function estimates.

class negmas.gb.HybridNegotiator(*args, alpha: float = 1.0, beta: float = 0.0, **kwargs)[source]

Bases: MAPNegotiator

Rational Concession Negotiator

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides prefrences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.HybridOfferingPolicy(initial_utility: float = nan, concession_ratio: float = nan, final_utility: float = nan, empathy_score: float = nan, frac_time_based: dict[int, tuple[float, ...]] = NOTHING, above_only: bool = False, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

HybridOffering policy implementation.

above_only: bool[source]
behaviour_based(t: float) float[source]

Computes target utility based on opponent’s concession patterns.

Parameters:

t – Normalized negotiation time in [0, 1].

Returns:

The target utility value adjusted by opponent behavior.

concession_ratio: float[source]
empathy_score: float[source]
final_utility: float[source]
frac_time_based: dict[int, tuple[float, ...]][source]
initial_utility: float[source]
on_partner_proposal(state: GBState, partner_id: str, offer: Outcome) None[source]

Records partner’s offer and its utility for behavior-based strategy.

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

Recalculates parameters and outcome utilities when preferences change.

time_based(t: float) float[source]

Computes target utility using a quadratic Bezier curve over time.

Parameters:

t – Normalized negotiation time in [0, 1].

Returns:

The target utility value at time t.

class negmas.gb.KindConcessionRecommender(kindness: float = 0.0, punish: float = True, initial_concession: float = 0.0, must_concede: bool = True, inverter: UtilityInverter | None = None, *, negotiator: GBNegotiator | None = None)[source]

Bases: ConcessionRecommender

A simple recommender that does one small concession first then a tit-for-tat response

Parameters:
  • kindness – A fraction of the utility range to concede everytime no matter what.

  • punish – If True, the partner will be punished by pushing our lower utility limit up if the concession (or its expectation) was negative

  • initial_concession – The amount of concession to do in the first step

  • must_concede – If True the agent is guaranteed to concede in the first step

  • inverter – Used only if must_concede is True to determine the lowest level of concession possible

initial_concession: float[source]
inverter: UtilityInverter | None[source]
kindness: float[source]
must_concede: bool[source]
punish: float[source]
set_inverter(inverter: UtilityInverter | None) None[source]

Set inverter.

Parameters:

inverter – Inverter.

set_negotiator(negotiator: GBNegotiator) None[source]

Set negotiator.

Parameters:

negotiator – Negotiator.

class negmas.gb.LastOfferOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, **kwargs)[source]

Bases: OfferOrientedSelector

Selects the offer nearest the partner’s last offer

before_responding(state: GBState, offer: Outcome | None, source: str | None = None)[source]

Updates the pivot to the most recent offer from the partner.

class negmas.gb.LastOfferOrientedTBNegotiator(*args, distance_fun: ~typing.Callable[[tuple, tuple, ~negmas.outcomes.protocols.OutcomeSpace | None], float] = <function generalized_minkowski_distance>, **kwargs)[source]

Bases: FirstOfferOrientedTBNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on their utility value and how near they are to the partner’s last offer

class negmas.gb.LimitedOutcomesAcceptancePolicy(prob: dict[Outcome, float] | float | None, p_ending: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Accepts from a list of predefined outcomes

Remarks:
  • if prob is a number, it is taken as the probability of aceptance for any outcome.

  • if prob is None, the probability of acceptance of any outcome will be set to the relative time

classmethod from_outcome_list(outcomes: list[Outcome], prob: list[float] | float = 1.0, p_ending: float = 0.0)[source]

Create policy from a list of outcomes with their acceptance probabilities.

Parameters:
  • outcomes – The list of acceptable outcomes.

  • prob – Acceptance probability for each outcome (single value or per-outcome list).

  • p_ending – Probability of ending negotiation on each call.

p_ending: float[source]
prob: dict[Outcome, float] | float | None[source]
class negmas.gb.LimitedOutcomesAcceptor(acceptable_outcomes: list[tuple] | None = None, acceptance_probabilities: list[float] | None = None, p_ending=0.0, preferences=None, ufun=None, **kwargs)[source]

Bases: MAPNegotiator, GBNegotiator

A negotiation agent that uses a fixed set of outcomes in a single negotiation.

Remarks:
  • The ufun inputs to the constructor and join are ignored. A ufun will be generated that gives a utility equal to the probability of choosing a given outcome.

class negmas.gb.LimitedOutcomesNegotiator(acceptable_outcomes: list[tuple] | None = None, acceptance_probabilities: float | list[float] | None = None, proposable_outcomes: list[tuple] | None = None, p_ending=0.0, p_no_response=0.0, preferences=None, ufun=None, **kwargs)[source]

Bases: MAPNegotiator

A negotiation agent that uses a fixed set of outcomes in a single negotiation.

Parameters:
  • acceptable_outcomes – the set of acceptable outcomes. If None then it is assumed to be all the outcomes of the negotiation.

  • acceptance_probabilities – probability of accepting each acceptable outcome. If None then it is assumed to be unity.

  • proposable_outcomes – the set of outcomes from which the agent is allowed to propose. If None, then it is the same as acceptable outcomes with nonzero probability

  • p_no_response – probability of refusing to respond to offers

  • p_ending – probability of ending negotiation

Remarks:
  • The ufun inputs to the constructor and join are ignored. A ufun will be generated that gives a utility equal to the probability of choosing a given outcome.

  • If proposable_outcomes is passed as None, it is considered the same as acceptable_outcomes

class negmas.gb.LimitedOutcomesOfferingPolicy(outcomes: list[Outcome] | None, prob: list[float] | None = None, p_ending: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

Offers from a given list of outcomes

outcomes: list[Outcome] | None[source]
p_ending: float[source]
prob: list[float] | None[source]
class negmas.gb.LinearTBNegotiator(*args, **kwargs)[source]

Bases: TimeBasedConcedingNegotiator

A Boulware time-based negotiator that conceeds linearly

class negmas.gb.LocalEvaluationStrategy[source]

Bases: EvaluationStrategy

LocalEvaluation strategy.

abstractmethod eval(negotiator_id: str, state: ThreadState, history: list[ThreadState], mechanism_state: MechanismState) tuple | None | Literal['continue'][source]

Evaluate the current state and return a response.

Parameters:
  • negotiator_id – ID of the negotiator being evaluated.

  • state – Current state of the negotiation thread.

  • history – List of previous thread states for context.

  • mechanism_state – Overall mechanism state.

Returns:

Response indicating whether to accept, reject, or continue.

class negmas.gb.LocalOfferingConstraint[source]

Bases: OfferingConstraint, ABC

eval_globally(source: str, state: GBState, history: list[GBState])[source]

Evaluate constraint in global context by extracting the relevant thread.

Parameters:
  • source – Identifier of the negotiation thread to evaluate.

  • state – Current global negotiation state.

  • history – List of previous global negotiation states.

Returns:

True if the constraint is satisfied for the specified thread.

class negmas.gb.MedianOfferSelector(*args, **kwargs)[source]

Bases: OfferSelector

Selects the outcome with the median utility value.

class negmas.gb.MiCRONegotiator(*args, accept_same: bool = True, **kwargs)[source]

Bases: MAPNegotiator

Rational Concession Negotiator

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides prefrences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.MiCROOfferingPolicy(next_indx: int = 0, sorter: PresortingInverseUtilityFunction | None = None, received: set[Outcome] = NOTHING, sent: set[Outcome] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

MiCROOffering policy implementation.

best_offer_so_far() Outcome | ExtendedOutcome | None[source]

Returns the highest-utility outcome offered so far, or None if none sent.

ensure_sorter()[source]

Initializes the outcome sorter if not already initialized and returns it.

next_indx: int[source]
next_offer() Outcome | ExtendedOutcome | None[source]

Returns the next outcome to offer based on current concession level.

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

Records the partner’s offer to track concession balance.

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

Reinitializes the sorter and resets offer tracking on significant preference changes.

ready_to_concede() bool[source]

Checks if we should concede based on offer exchange balance.

sample_sent() Outcome | ExtendedOutcome | None[source]

Returns a random outcome from previously sent offers, or None if empty.

sorter: PresortingInverseUtilityFunction | None[source]
negmas.gb.Model[source]

alias of GBComponent

class negmas.gb.MultiplicativeFirstFollowingTBNegotiator(*args, dist_power: float = 2, issue_weights: list[float] | None = None, **kwargs)[source]

Bases: TimeBasedNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on a weighted sum of their normalized utilities and distances to previous offers

class negmas.gb.MultiplicativeLastOfferFollowingTBNegotiator(*args, dist_power: float = 2, issue_weights: list[float] | None = None, **kwargs)[source]

Bases: TimeBasedNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on a weighted sum of their normalized utilities and distances to previous offers

class negmas.gb.MultiplicativeParetoFollowingTBNegotiator(*args, dist_power: float = 2, issue_weights: list[float] | None = None, offer_filter: OfferFilterProtocol = <function NoFiltering>, **kwargs)[source]

Bases: TimeBasedNegotiator

A time-based negotiator that selectes outcomes from the list allowed by the current utility level based on a weighted sum of their normalized utilities and distances to previous offers

class negmas.gb.MultiplicativePartnerOffersOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, offer_filter: OfferFilterProtocol = <function NoFiltering>, **kwargs)[source]

Bases: PartnerOffersOrientedSelector

Orients offes toward the set of past opponent offers.

The score of an offer is the product of its utility to self and its distance to opponent’s past offers after normalization

calculate_scores(outcomes: Sequence[Outcome], pivots: list[Outcome], state: GBState) Sequence[tuple[float, Outcome]][source]

Compute scores as the product of utility and normalized distance to pivots.

class negmas.gb.MyBestConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]

Bases: UtilBasedConcensusOfferingPolicy

Offers my best outcome from the list of stratgies (different strategy every time).

decide_util(utils: list[Distribution | float]) int[source]

Returns the index of the outcome with the highest utility.

Parameters:

utils – List of utility values for each candidate outcome.

Returns:

Index of the maximum utility outcome.

class negmas.gb.MyWorstConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]

Bases: UtilBasedConcensusOfferingPolicy

Offers my worst outcome from the list of stratgies (different strategy every time) based on outcome utilities

decide_util(utils: list[Distribution | float]) int[source]

Returns the index of the outcome with the lowest utility.

Parameters:

utils – List of utility values for each candidate outcome.

Returns:

Index of the minimum utility outcome.

class negmas.gb.NaiveTitForTatNegotiator(*args, kindness=0.0, punish=False, initial_concession: float | Literal['min'] = 'min', rank_only: bool = False, stochastic: bool = False, **kwargs)[source]

Bases: MAPNegotiator

Implements a naive tit-for-tat strategy that does not depend on the availability of an opponent model.

Parameters:
  • name – Negotiator name

  • preferences – negotiator preferences

  • ufun – negotiator ufun (overrides preferences)

  • parent – A controller

  • kindness – How ‘kind’ is the agent. A value of zero is standard tit-for-tat. Positive values makes the negotiator concede faster and negative values slower.

  • stochastic – If True, the offers will be randomized above the level determined by the current concession which in turn reflects the opponent’s concession.

  • punish – If True the agent punish a partner who does not seem to conede by requiring higher utilities

  • initial_concession – How much should the agent concede in the beginning in terms of utility. Should be a number or the special string value ‘min’ for minimum concession

Remarks:

  • This negotiator does not keep an opponent model. It thinks only in terms of changes in its own utility. If the opponent’s last offer was better for the negotiator compared with the one before it, it considers that the opponent has conceded by the difference. This means that it implicitly assumes a zero-sum situation.

class negmas.gb.NegotiatorAcceptancePolicy(acceptor: GBNegotiator, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Uses a negotiator as an offering strategy

acceptor: GBNegotiator[source]
class negmas.gb.NegotiatorMechanismInterface(id: str, n_outcomes: int | float, outcome_space: OutcomeSpace, shared_time_limit: float, shared_n_steps: int | None, private_time_limit: float, private_n_steps: int | None, pend: float, pend_per_second: float, step_time_limit: float, negotiator_time_limit: float, dynamic_entry: bool, max_n_negotiators: int | None, _mechanism: Mechanism, annotation: dict[str, Any] = NOTHING)[source]

Bases: object

All information of a negotiation visible to negotiators.

The NMI provides negotiators with access to mechanism parameters and state. It supports per-negotiator time and step limits through a three-tier system:

  1. Shared limits (shared_time_limit, shared_n_steps): Apply to all negotiators

  2. Private limits (private_time_limit, private_n_steps): Apply to individual negotiators

  3. Effective limits (time_limit, n_steps): Computed as min(shared, private)

The effective limits are what negotiators actually see and are used to calculate relative_time. This design allows different negotiators to have different time/step constraints while maintaining backward compatibility with code that doesn’t use per-negotiator limits.

Examples

Standard usage (all negotiators see same limits):

mechanism = SAOMechanism(time_limit=60, n_steps=100)
# All negotiators see time_limit=60, n_steps=100

Per-negotiator limits:

mechanism = SAOMechanism(time_limit=60, n_steps=100)
mechanism.add(negotiator1, time_limit=30)  # Sees time_limit=30 (stricter)
mechanism.add(
    negotiator2, time_limit=90
)  # Sees time_limit=60 (shared is stricter)
mechanism.add(negotiator3)  # Sees time_limit=60 (no private limit)
property agent_ids: list[str | None][source]

Gets the IDs of all agents owning all negotiators

property agent_names: list[str | None][source]

Gets the names of all agents owning all negotiators

annotation: dict[str, Any][source]

An arbitrary annotation as a dict[str, Any] that is always available for all negotiators

asdict()[source]

Converts the object to a dict containing all fields

property atomic_steps: bool[source]

Whether steps in this mechanism are atomic (cannot be interrupted).

property cartesian_outcome_space: CartesianOutcomeSpace[source]

Returns the outcome_space as a CartesianOutcomeSpace or raises a ValueError if that was not possible.

Remarks:

discrete_outcome_space(levels: int = 5, max_cardinality: int = 10000000000) DiscreteOutcomeSpace[source]

Returns a stable discrete version of the given outcome-space

discrete_outcomes(max_cardinality: int | float = inf) Iterable[tuple][source]

A discrete set of outcomes that spans the outcome space

Parameters:

max_cardinality – The maximum number of outcomes to return. If None, all outcomes will be returned for discrete outcome-spaces

Returns:

list of n or less outcomes

Return type:

list[Outcome]

dynamic_entry: bool[source]

Whether it is allowed for negotiators to enter/leave the negotiation after it starts

property estimated_n_steps: int[source]

Return an estimate of the number of steps for this negotiation.

property estimated_time_limit: float[source]

Return an estimate of the number of seconds for this negotiation.

genius_id(id: str | None) str | None[source]

Gets the Genius ID corresponding to the given negotiator if known otherwise its normal ID

property genius_negotiator_ids: list[str][source]

Gets the Java IDs of all negotiators (if the negotiator is not a GeniusNegotiator, its normal ID is returned)

property history: list[source]

The full negotiation history of actions, offers, and responses.

Returns:

Chronological list of all negotiation events and actions

Return type:

list

id: str[source]

Mechanism session ID. That is unique for all mechanisms

property issues: tuple[Issue, ...][source]

The negotiation issues defining the outcome space dimensions.

Returns:

Tuple of Issue objects (e.g., price, quantity, delivery time)

Return type:

tuple[Issue, …]

keys()[source]

Returns the field names of the NMI.

log_critical(nid: str, data: dict[str, Any]) None[source]

Logs at critical level

log_debug(nid: str, data: dict[str, Any]) None[source]

Logs at debug level

log_error(nid: str, data: dict[str, Any]) None[source]

Logs at error level

log_info(nid: str, data: dict[str, Any]) None[source]

Logs at info level

log_warning(nid: str, data: dict[str, Any]) None[source]

Logs at warning level

max_n_negotiators: int | None[source]

Maximum allowed number of negotiators in the session. None indicates no limit

property mechanism_id: str[source]

Gets the ID of the mechanism

property n_negotiators: int[source]

Syntactic sugar for state.n_negotiators

n_outcomes: int | float[source]

Number of outcomes which may be float('inf') indicating infinity

n_steps: int | None[source]

The effective allowed number of steps for this negotiator. Computed as min(shared_n_steps, private_n_steps) in __attrs_post_init__

property negotiator_ids: list[str][source]

Gets the IDs of all negotiators

negotiator_index(source: str) int[source]

Returns the negotiator index for the given negotiator. Raises an exception if not found

negotiator_time_limit: float[source]

The time limit in seconds to wait for negotiator responses of this negotiation session. None indicates infinity

outcome_space: OutcomeSpace[source]

Negotiation agenda as as an OutcomeSpace object. The most common type is CartesianOutcomeSpace which represents the cartesian product of a list of issues

property outcomes: Iterable[tuple] | None[source]

All outcomes for discrete outcome spaces or None for continuous outcome spaces. See discrete_outcomes

property params[source]

Returns the parameters used to initialize the mechanism.

property participants: list[NegotiatorInfo][source]

Information about all negotiators participating in this negotiation.

Returns:

List of participant information including IDs and preferences

Return type:

list[NegotiatorInfo]

pend: float[source]

The probability that the negotiation times out at every step. Must be less than one. If <= 0, it is ignored

pend_per_second: float[source]

The probability that the negotiation times out every second. Must be less than one. If <= 0, it is ignored

private_n_steps: int | None[source]

The private allowed number of steps for this negotiator. None indicates infinity. Set via Mechanism.add(n_steps=…)

private_time_limit: float[source]

The private time limit in seconds for this negotiator. inf indicates infinity. Set via Mechanism.add(time_limit=…)

random_outcome() tuple[source]

A single random outcome.

random_outcomes(n: int = 1) list[tuple][source]

A set of random outcomes from the outcome-space of this negotiation

Parameters:

n – number of outcomes requested

Returns:

list of n or less outcomes

Return type:

list[Outcome]

property requirements: dict[source]

The protocol requirements

Returns:

  • A dict of str/Any pairs giving the requirements

shared_n_steps: int | None[source]

The shared allowed number of steps for this negotiation. Applies to all negotiators. None indicates infinity

shared_time_limit: float[source]

The shared time limit in seconds for this negotiation session. Applies to all negotiators. inf indicates infinity

property state: MechanismState[source]

Access the current state of the mechanism.

Remarks:

  • Whenever a method receives a AgentMechanismInterface object, it can always access the current state of the protocol by accessing this property.

step_time_limit: float[source]

The time limit in seconds for each step of this negotiation session. None indicates infinity

time_limit: float[source]

The effective time limit in seconds for this negotiator. Computed as min(shared_time_limit, private_time_limit) in __attrs_post_init__

values()[source]

Returns the field values of the NMI.

class negmas.gb.NegotiatorOfferingPolicy(*, negotiator: GBNegotiator | None = None, proposer: GBNegotiator)[source]

Bases: OfferingPolicy

Uses a negotiator as an offering strategy

proposer: GBNegotiator[source]
class negmas.gb.NiceNegotiator(*args, **kwargs)[source]

Bases: MAPNegotiator

Offers and accepts anything.

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides prefrences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.NoneOfferingPolicy(*, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

Always offers None which means it never gets an agreement.

class negmas.gb.OfferBest(best: Outcome | None = None, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

Offers Only the best outcome.

Remarks:
  • You can pass the best outcome if you know it as best otherwise it will find it.

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

Finds and caches the best outcome when preferences change.

class negmas.gb.OfferOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, **kwargs)[source]

Bases: OfferSelector

Selects the nearest outcome to the pivot outcome which is updated before responding

class negmas.gb.OfferSelector(*args, **kwargs)[source]

Bases: OfferSelectorProtocol, GBComponent

Can select the best offer in some sense from a list of offers based on an inverter

class negmas.gb.OfferSelectorProtocol(*args, **kwargs)[source]

Bases: Protocol

Can select the best offer in some sense from a list of offers based on an inverter

class negmas.gb.OfferTop(fraction: float = 0.0, k: int = 1, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

Offers outcomes that are in the given top fraction or top k. If neither is given it reverts to only offering the best outcome

Remarks:
  • The outcome-space is always discretized and the constraints fraction and k are applied to the discretized space

fraction: float[source]
k: int[source]
on_preferences_changed(changes: list[PreferencesChange])[source]

Computes the set of top outcomes based on fraction and k constraints.

class negmas.gb.OfferingConstraint[source]

Bases: ABC

class negmas.gb.OfferingPolicy(*, negotiator: GBNegotiator | None = None)[source]

Bases: GBComponent

Offering policy implementation.

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

Propose an offer or None to refuse.

Parameters:
  • stateGBState giving current state of the negotiation.

  • dest – the thread in which I am supposed to offer.

Returns:

The outcome being proposed or None to refuse to propose

Remarks:
  • Caches results for the same thread and step. If called multiple times for the same thread and step, it will do the computations only once.

  • Caching is useful when the acceptance strategy calls the offering strategy

class negmas.gb.OutcomeSetOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, offer_filter: OfferFilterProtocol = <function NoFiltering>, **kwargs)[source]

Bases: OfferSelector

Selects the nearest outcome to a set of pivot outcomes which is updated before responding

abstractmethod calculate_scores(outcomes: Sequence[Outcome], pivots: list[Outcome], state: GBState) Sequence[tuple[float, Outcome]][source]

Compute a score for each outcome based on its relation to the pivot outcomes.

Parameters:
  • outcomes – The candidate outcomes to score.

  • pivots – Reference outcomes used for distance calculations.

  • state – The current negotiation state.

Returns:

Sequence of (score, outcome) tuples for ranking.

class negmas.gb.ParallelGBMechanism(*args, **kwargs)[source]

Bases: GBMechanism

ParallelGB mechanism.

class negmas.gb.PartnerOffersOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, offer_filter: OfferFilterProtocol = <function NoFiltering>, **kwargs)[source]

Bases: OutcomeSetOrientedSelector

Orients offes toward the set of past opponent offers

before_responding(state: GBState, offer: Outcome | None, source: str | None = None)[source]

Adds the partner’s offer to the pivot set for future distance calculations.

negmas.gb.ProposalPolicy[source]

alias of OfferingPolicy

class negmas.gb.RandomAcceptancePolicy(p_acceptance: float = 0.15, p_rejection: float = 0.25, p_ending: float = 0.1, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Responds randomly with configurable probabilities for accept, reject, end, or no response.

p_acceptance: float[source]
p_ending: float[source]
p_rejection: float[source]
class negmas.gb.RandomAlwaysAcceptingNegotiator(p_acceptance=0.15, p_rejection=0.75, p_ending=0.1, can_propose=True, accept_around=1.0, eps=0.001, **kwargs)[source]

Bases: MAPNegotiator

RandomAlwaysAccepting negotiator.

class negmas.gb.RandomConcensusOfferingPolicy(strategies: list[OfferingPolicy], prob: list[float] | None = None, *, negotiator: GBNegotiator | None = None)[source]

Bases: ConcensusOfferingPolicy

Offers a random response from the list of strategies (different strategy every time).

decide(indices: list[int], responses: list[Outcome | ExtendedOutcome | None]) Outcome | ExtendedOutcome | None[source]

Randomly selects an outcome from responses using probability weights.

Parameters:
  • indices – Indices of strategies that passed the filter.

  • responses – Outcomes proposed by the filtered strategies.

Returns:

A randomly selected outcome based on probability distribution.

prob: list[float] | None[source]
class negmas.gb.RandomNegotiator(p_acceptance=0.15, p_rejection=0.75, p_ending=0.1, can_propose=True, **kwargs)[source]

Bases: MAPNegotiator

A negotiation agent that responds randomly in a single negotiation.

Parameters:
  • p_acceptance – Probability of accepting an offer

  • p_rejection – Probability of rejecting an offer

  • p_ending – Probability of ending the negotiation at any round

  • can_propose – Whether the agent can propose or not

  • **kwargs – Passed to the GBNegotiator

Remarks:

  • If p_acceptance + p_rejection + p_ending < 1, the rest is the probability of no-response.

class negmas.gb.RandomOfferSelector(*args, **kwargs)[source]

Bases: OfferSelector

Selects a random outcome from the candidate set.

class negmas.gb.RandomOfferingPolicy(*, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

Offers random outcomes from the negotiation outcome space.

class negmas.gb.RejectAlways(*, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

Rejects everything

class negmas.gb.RepeatFinalOfferOnly(n: int = 9223372036854775807)[source]

Bases: LocalOfferingConstraint

RepeatFinalOfferOnly implementation.

n: int[source]
class negmas.gb.RepeatLastOfferOnly(n: int = 9223372036854775807)[source]

Bases: LocalOfferingConstraint

RepeatLastOfferOnly implementation.

eval(state: ThreadState, history: list[ThreadState]) bool[source]

Check if the repeating last offer constraint is satisfied.

Parameters:
  • state – Current thread state.

  • history – List of previous thread states for detecting repeated last offers.

Returns:

True if the last offer hasn’t been repeated too many times, False otherwise.

n: int[source]
class negmas.gb.ResponseType(*values)[source]

Bases: IntEnum

Possible responses to offers during negotiation.

ACCEPT_OFFER = 0[source]
END_NEGOTIATION = 2[source]
LEAVE = 5[source]

Leave the negotiation without necessarily ending it for other negotiators.

NO_RESPONSE = 3[source]
REJECT_OFFER = 1[source]
WAIT = 4[source]
class negmas.gb.SerialGBMechanism(*args, **kwargs)[source]

Bases: GBMechanism

SerialGB mechanism.

class negmas.gb.SerialTAUMechanism(*args, cardinality=9223372036854775807, min_unique=0, outcome_space: OutcomeSpace | None = None, issues: list[Issue] | None = None, outcomes: list[tuple] | int | None = None, **kwargs)[source]

Bases: SerialGBMechanism

Implements the TAU protocol using the SerialGBMechanism construct in NegMAS

negmas.gb.SimpleTitForTatNegotiator[source]

alias of NaiveTitForTatNegotiator

class negmas.gb.TAUEvaluationStrategy(n_outcomes: int = 9223372036854775807, cardinality: int = 9223372036854775807, accepted: dict[tuple | None, set[str]] = NOTHING, offered: dict[tuple | None, set[str]] = NOTHING, repeating: dict[str, bool] = NOTHING, last: dict[str, tuple | None] = NOTHING)[source]

Bases: EvaluationStrategy

Implements the Tentative-Accept Unique-Offers Generalized Bargaining Protocol.

cardinality: int[source]
n_outcomes: int[source]
class negmas.gb.TAUMechanism(*args, accept_in_any_thread: bool = True, parallel: bool = True, **kwargs)[source]

Bases: BaseGBMechanism

TAU (Threaded Acceptance with Unanimous agreement) mechanism.

An Outcome-Perfect Negotiation Protocol that guarantees finding an agreement if one exists within the declared acceptable outcomes of all negotiators. TAU allows agents to repeat offers, but once an agent starts repeating, it is committed to that offer.

References

Mohammad, Y. (2023). Generalized Bargaining Protocols. In: Australasian Joint Conference on Artificial Intelligence (AI 2023). Springer. https://doi.org/10.1007/978-981-99-8391-9_37

Mohammad, Y. (2025). Tackling the Protocol Problem in Automated Negotiation. In: Proceedings of the 24th International Conference on Autonomous Agents and Multi-Agent Systems (AAMAS 2025).

class negmas.gb.TFTAcceptancePolicy(partner_ufun: UFunModel, recommender: ConcessionRecommender, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

An acceptance strategy that concedes as much as the partner (or more)

partner_ufun: UFunModel[source]
recommender: ConcessionRecommender[source]
class negmas.gb.TFTOfferingPolicy(partner_ufun: UFunModel, recommender: ConcessionRecommender, stochastic: bool = False, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

An acceptance strategy that concedes as much as the partner (or more)

before_responding(state: GBState, offer: Outcome | None, source: str | None = None)[source]

Stores the partner’s latest offer for concession calculation.

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

Propagates preference changes to the partner utility model.

partner_ufun: UFunModel[source]
recommender: ConcessionRecommender[source]
stochastic: bool[source]
class negmas.gb.ThreadState(new_offer: tuple | None = None, new_data: dict | None = None, new_responses: dict[str, ResponseType] = NOTHING, accepted_offers: list[tuple] = NOTHING)[source]

Bases: object

ThreadState implementation.

accepted_offers: list[tuple][source]
new_data: dict | None[source]
new_offer: tuple | None[source]
new_responses: dict[str, ResponseType][source]
class negmas.gb.TimeBasedConcedingNegotiator(*args, offering_curve: Aspiration | Literal['boulware'] | Literal['conceder'] | Literal['linear'] | float = 'boulware', accepting_curve: Aspiration | Literal['boulware'] | Literal['conceder'] | Literal['linear'] | float | None = None, starting_utility: float = 1.0, **kwargs)[source]

Bases: TimeBasedNegotiator

Represents a time-based negotiation strategy that is independent of the offers received during the negotiation.

Parameters:
  • offering_curve (TimeCurve) – A TimeCurve that is to be used to sample outcomes when offering

  • accepting_curve (TimeCurve) – A TimeCurve that is to be used to decide utility range to accept

  • starting_utility (float) – The relative utility (range 1.0 to 0.0) at which to give the first offer. Only used if offering_curve was not given

class negmas.gb.TimeBasedNegotiator(*args, offering_curve: TimeCurve | Literal['boulware'] | Literal['conceder'] | Literal['linear'] | float = 'boulware', accepting_curve: TimeCurve | Literal['boulware'] | Literal['conceder'] | Literal['linear'] | float | None = None, offer_selector: OfferSelector | None = None, **kwargs)[source]

Bases: UtilBasedNegotiator

Represents a time-based negotiation strategy that is independent of the offers received during the negotiation.

Parameters:
  • offering_curve (TimeCurve) – A TimeCurve that is to be used to sample outcomes when offering

  • accepting_curve (TimeCurve) – A TimeCurve that is to be used to decide utility range to accept

  • inverter (UtilityInverter) – A component used to keep track of the ufun inverse

  • offer_selector (OfferSelector) – The way to select an offer from the set of valid offers at every time-step

utility_range_to_accept(state) tuple[float, float][source]

Returns the acceptable utility range for accepting offers at the current negotiation state.

utility_range_to_propose(state) tuple[float, float][source]

Returns the acceptable utility range for making proposals at the current negotiation state.

class negmas.gb.TimeBasedOfferingPolicy(curve: PolyAspiration = NOTHING, stochastic: bool = False, sorter: PresortingInverseUtilityFunction | None = None, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

TimeBasedOffering policy implementation.

curve: PolyAspiration[source]
on_preferences_changed(changes: list[PreferencesChange])[source]

Initializes the outcome sorter when preferences are set or changed.

sorter: PresortingInverseUtilityFunction | None[source]
stochastic: bool[source]
class negmas.gb.TopFractionNegotiator(min_utility=0.95, top_fraction=0.05, best_first=True, can_propose=True, **kwargs)[source]

Bases: MAPNegotiator

Offers and accepts only one of the top outcomes for the negotiator.

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • can_propose – If False the negotiator will never propose but can only accept

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides preferences)

  • min_utility – The minimum utility to offer or accept

  • top_fraction – The fraction of the outcomes (ordered decreasingly by utility) to offer or accept

  • best_first – Guarantee offering will non-increasing in terms of utility value

  • probabilistic_offering – Offer randomly from the outcomes selected based on top_fraction and min_utility

  • owner – The Agent that owns the negotiator.

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

Propose.

Parameters:
  • state – Current state.

  • dest – Dest.

class negmas.gb.ToughNegotiator(can_propose=True, **kwargs)[source]

Bases: MAPNegotiator

Accepts and proposes only the top offer (i.e. the one with highest utility).

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • can_propose – If False the negotiator will never propose but can only accept

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides preferences)

  • owner – The Agent that owns the negotiator.

Remarks:
  • If there are multiple outcome with the same maximum utility, only one of them will be used.

class negmas.gb.UFunModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: GBComponent, BaseUtilityFunction

A SAOComponent that can model the opponent’s utility function.

Classes implementing this ufun-model, must implement the abstract eval() method to return the utility value of an outcome. They can use any callbacks available to SAOComponent to update the model.

class negmas.gb.UnanimousConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]

Bases: ConcensusOfferingPolicy

Offers only if all offering strategies gave exactly the same outcome

decide(indices: list[int], responses: list[Outcome | ExtendedOutcome | None]) Outcome | ExtendedOutcome | None[source]

Returns the outcome only if all strategies agree, otherwise None.

Parameters:
  • indices – Indices of strategies that passed the filter.

  • responses – Outcomes proposed by the filtered strategies.

Returns:

The unanimous outcome, or None if strategies disagree.

class negmas.gb.UniqueOffers[source]

Bases: LocalOfferingConstraint

UniqueOffers implementation.

class negmas.gb.UtilBasedConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]

Bases: ConcensusOfferingPolicy, ABC

Offers from the list of stratgies (different strategy every time) based on outcome utilities

decide(indices: list[int], responses: list[Outcome | ExtendedOutcome | None]) Outcome | ExtendedOutcome | None[source]

Selects an outcome based on utility values using the decide_util method.

Parameters:
  • indices – Indices of strategies that passed the filter.

  • responses – Outcomes proposed by the filtered strategies.

Returns:

The outcome selected by the utility-based decision rule.

abstractmethod decide_util(utils: list[Distribution | float]) int[source]

Returns the index to chose based on utils

class negmas.gb.UtilBasedNegotiator(*args, stochastic: bool = False, rank_only: bool = False, ufun_inverter: Callable[[BaseUtilityFunction], InverseUFun] | None = None, offer_selector: OfferSelector | None = None, max_cardinality: int = 10000000, eps: float = 0.0001, **kwargs)[source]

Bases: GBNegotiator

A negotiator that bases its decisions on the utility value of outcomes only.

Parameters:
  • inverter (UtilityInverter) – A component used to keep track of the ufun inverse

  • stochastic (bool) – If False the worst outcome in the current utility range will be used

  • rank_only (bool) – If True then the ranks of outcomes not their actual utilities will be used for decision making

  • max_cardinality (int) – The number of outocmes at which we switch to use the slower SamplingInverseUtilityFunction instead of the PresortingInverseUtilityFunction . Will only be used if ufun_inverter is None

  • eps (float) – A tolearnace around the utility range used when sampling outocmes

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

On preferences changed.

Parameters:

changes – Changes.

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

Propose.

Parameters:
  • state – Current state.

  • dest – Dest.

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

Respond.

Parameters:
  • state – Current state.

  • source – Source identifier.

Returns:

The result.

Return type:

ResponseType

abstractmethod utility_range_to_accept(state) tuple[float, float][source]

Utility range to accept.

Parameters:

state – Current state.

Returns:

The result.

Return type:

tuple[float, float]

abstractmethod utility_range_to_propose(state) tuple[float, float][source]

Utility range to propose.

Parameters:

state – Current state.

Returns:

The result.

Return type:

tuple[float, float]

class negmas.gb.UtilityBasedOutcomeSetRecommender(rank_only: bool = False, ufun_inverter: Callable[[BaseUtilityFunction], InverseUFun] | None = None, max_cardinality: int | float = inf, eps: float = 0.0001, inversion_method: Literal['min', 'max', 'one', 'some', 'all'] = 'some')[source]

Bases: GBComponent

Recommends a set of outcome appropriate for proposal

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

Ensures the inverter is initialized before making a proposal.

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

Rebuilds the inverse utility function when preferences change.

scale_utilities(urange: tuple[float, ...]) tuple[float, ...][source]

Scales given utilities to the range of the ufun.

Remarks:

  • Assumes that the input utilities are in the range [0-1] no matter what is the range of the ufun.

  • Subtracts the tolerance from the first and adds it to the last utility value which slightly enlarges the range to account for small rounding errors

set_negotiator(negotiator: GBNegotiator) None[source]

Attaches this component to a negotiator and resets internal state.

property tolerance[source]

Returns the epsilon value used to expand utility ranges.

property ufun_max[source]

Returns the maximum utility value from the utility function.

property ufun_min[source]

Returns the minimum utility value from the utility function.

class negmas.gb.UtilityInverter(*args, offer_selector: OfferSelectorProtocol | Literal['min'] | Literal['max'] | None = None, **kwargs)[source]

Bases: GBComponent

A component that can recommend an outcome based on utility

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

Prepares the recommender before making a proposal.

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

Forwards preference changes to the underlying recommender.

scale_utilities(urange)[source]

Scales normalized [0-1] utilities to the actual ufun range.

set_negotiator(negotiator: GBNegotiator) None[source]

Attaches this component and its recommender to a negotiator.

property tolerance[source]

Returns the epsilon value used to expand utility ranges.

property ufun_max[source]

Returns the maximum utility value from the recommender.

property ufun_min[source]

Returns the minimum utility value from the recommender.

class negmas.gb.WABNegotiator(*args, **kwargs)[source]

Bases: MAPNegotiator

Wasting Accepting Better (neither complete nor an equilibrium)

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides preferences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.WANNegotiator(*args, **kwargs)[source]

Bases: MAPNegotiator

Wasting Accepting Any (an equilibrium but not complete)

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides preferences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.WARNegotiator(*args, **kwargs)[source]

Bases: MAPNegotiator

Wasting Accepting Any (an equilibrium but not complete)

Parameters:
  • name – Negotiator name

  • parent – Parent controller if any

  • preferences – The preferences of the negotiator

  • ufun – The ufun of the negotiator (overrides preferences)

  • owner – The Agent that owns the negotiator.

class negmas.gb.WAROfferingPolicy(next_indx: int = 0, sorter: PresortingInverseUtilityFunction | None = None, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

WAROffering policy implementation.

next_indx: int[source]
on_negotiation_start(state) None[source]

Resets state to start with irrational (worst) offers.

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

Initializes outcome sorter and irrational offer tracking on preference changes.

sorter: PresortingInverseUtilityFunction | None[source]
class negmas.gb.WorstOfferSelector(*args, **kwargs)[source]

Bases: OfferSelector

Selects the outcome with the lowest utility value.

class negmas.gb.ZeroSumModel(above_reserve: bool = True, rank_only: bool = False, *, negotiator: GBNegotiator | None = None)[source]

Bases: UFunModel

Assumes a zero-sum negotiation (i.e. $u_o$ = $-u_s$ )

Remarks:

  • Because some negotiators do not work well with negative ufun values, we return (max - u(w)) instead of (- u(w))

above_reserve: bool[source]
eval(offer: Outcome) Value[source]

Eval.

Parameters:

offer – Offer being considered.

Returns:

The result.

Return type:

Value

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

Eval normalized.

Parameters:
  • offer – Offer being considered.

  • above_reserve – Above reserve.

  • expected_limits – Expected limits.

Returns:

The result.

Return type:

Value

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

On preferences changed.

Parameters:

changes – Changes.

rank_only: bool[source]
negmas.gb.all_accept(responses: list[tuple | None | Literal['continue']]) tuple | None | Literal['continue'][source]

Combine multiple responses requiring all to agree for acceptance.

Parameters:

responses – List of responses from different evaluation strategies.

Returns:

Accepted outcome if all agree, None if any reject, otherwise ‘continue’.

negmas.gb.all_negotiator_types() list[GBNegotiator][source]

Returns all the negotiator types defined in negmas.gb.negotiators

negmas.gb.any_accept(responses: list[tuple | None | Literal['continue']]) tuple | None | Literal['continue'][source]

Combine multiple responses accepting if any strategy accepts.

Parameters:

responses – List of responses from different evaluation strategies.

Returns:

Random accepted outcome if any strategy accepts, None if all reject, otherwise ‘continue’.