negmas.gb

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

class negmas.gb.ACCombi(offering_strategy: OfferingPolicy, a: float = 1.0, b: float = 0.0, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]

Bases: AcceptancePolicy

The ACcombi acceptance condition of Baarslag et al. (2012/2013), used by the Nice Tit for Tat agent.

ACcombi combines ACnext with a time-based fallback:

  • ACnext: accept the opponent’s offer if it is at least as good as the offer the bidding strategy was planning to propose next, i.e. a * u(opp_offer) + b >= u(my_next_offer). The rationale is that if the opponent’s offer beats our own next planned offer, we have effectively reached a consensus and should accept.

  • ACtime: when time is running out (relative_time >= t), accept the offer rather than risk a breakdown — there is no expected improvement in the little time left.

Accepts if either condition holds.

Parameters:
  • offering_strategy – The offering policy used to determine our next planned offer (its result is cached per step, so calling it here does not duplicate the work done when we later propose).

  • a – Scaling factor on the opponent-offer utility (default 1.0).

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

  • t – Relative-time threshold for the ACtime fallback (default 0.99).

Remarks:
  • If the offering strategy cannot produce a next offer, any rational offer (at or above the reserved value) is accepted.

AI Generated (ACcombi acceptance condition for the Nice Tit for Tat agent).

a: float[source]
b: float[source]
offering_strategy: OfferingPolicy[source]
t: float[source]
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, ufun_inverter: type[InverseUFun] | None = None, **kwargs)[source]

Bases: TimeBasedConcedingNegotiator

A time-based conceding negotiator with a simplified interface.

This is the most commonly used negotiator in the library. It concedes over time according to a polynomial aspiration curve (boulware / linear / conceder, or a custom exponent) and uses an InverseUFun to find outcomes within the current aspiration band.

Parameters:
  • max_aspiration (float) – The aspiration level (relative utility in [0, 1]) to use for the first offer (and first acceptance decision). Defaults to 1.0 (start at the best outcome).

  • aspiration_type (str | float) – The polynomial aspiration curve type. Pass a string ("boulware" for slow concession, "linear" for constant-rate concession, "conceder" for fast concession) or a real-valued exponent. Defaults to "boulware".

  • stochastic (bool) – If False (default), the negotiator proposes the outcome with the lowest utility still within its aspiration band (i.e. just above the aspiration level) via worst_in. If True, it proposes a random in-range outcome via one_in.

  • presort (bool) – If True (default), a DefaultInverseUtilityFunction (i.e. AdaptiveInverseUtilityFunction) is used, which presorts outcomes for exact O(log n) lookups on small/medium spaces and falls back to BIDS for large additive spaces. If False, no inverter is used and the negotiator cannot propose (it will always fall back to the best outcome).

  • tolerance (float) – A tolerance used for sampling outcomes near the aspiration level (passed as eps to the inverter). Defaults to 0.001.

  • ufun_inverter (type[InverseUFun] | None) – An optional InverseUFun type to use for inverting the utility function. If given, it overrides the presort default. See negmas.preferences.inv_ufun for the full list of available inverters and their trade-offs.

  • **kwargs – Forwarded to TimeBasedConcedingNegotiator (e.g. name, ufun, parent, owner).

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 time-based negotiator that concedes sub-linearly (boulware).

Uses a PolyAspiration curve with exponent 4 ("boulware") and stochastic=False (proposes the worst outcome within the aspiration band).

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: InverseUFun | 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: InverseUFun | 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.CandidateEliminationModel(*, negotiator: GBNegotiator | None = None)[source]

Bases: UFunModel

Ordinal opponent model via candidate elimination (survey §5.3.4).

Candidate elimination [8,9] is an inductive-learning algorithm that assumes only that the opponent’s preferences do not change during the negotiation. Each offer the opponent sends is a positive instance (its values are acceptable to the opponent); each of our own offers that the opponent rejects (i.e. counters instead of accepting) is a negative instance (something in it is unacceptable).

A full version space over whole offers is exponential, so — as the survey notes such models “only learn part of the relationships” — this is a per-issue rendition: for each issue it keeps the set of values seen in the opponent’s offers (acceptable) and the set seen only in rejected offers of ours (suspect). The estimated ordinal utility of an offer is the mean per-issue score, where a value is scored 1 if confirmed acceptable, 0 if only ever seen in a rejected offer, and 0.5 if not yet seen (the general-boundary default: unseen values may still be acceptable).

Negatives are derived automatically: whenever the opponent makes a new offer, our most recent proposal is treated as rejected. They can also be supplied explicitly via note_rejected().

Remarks:
  • This is an ordinal model — the values it returns rank outcomes but are not calibrated cardinal utilities.

  • Returns 0.5 for every outcome until some evidence is gathered.

AI Generated (candidate-elimination acceptable-offer model).

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

Remember our own proposal so a later opponent offer marks it rejected.

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

Learn from the opponent offer we are about to respond to.

eval(offer: Outcome) Value[source]

Estimate the opponent’s ordinal utility of offer in [0, 1].

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

Eval normalized (the model already returns values in [0, 1]).

note_rejected(offer: Outcome) None[source]

Record offer as a negative (rejected-by-opponent) instance.

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

Learn from a partner proposal (only with enable_callbacks).

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

Set up the issue list and register the model.

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

Bases: TimeBasedConcedingNegotiator

A time-based negotiator that concedes super-linearly (conceder).

Uses a PolyAspiration curve with exponent 0.25 ("conceder") and stochastic=False.

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.ConcessionRatioUFunModel(above_reserve: bool = True, levels: int = 10, *, negotiator: GBNegotiator | None = None)[source]

Bases: _SequentialWeightUFunModel

Issue weights from concession ratios — Niemann & Lang [143] (survey §5.3.1).

For each issue a concession ratio c_i is the fraction of consecutive offer pairs in which the opponent changed that issue’s value. The more an issue is conceded on, the less important it is assumed to be, so the issue weight is w_i = 1 - c_i (then normalized across issues). Per-issue value utilities are estimated from offer frequency.

Remarks:
  • The survey’s method updates a Bayesian posterior over weight hypotheses; here 1 - c_i is used directly as a deterministic maximum-likelihood rendition (no explicit posterior), which keeps the model domain-agnostic and online.

  • Returns utilities already normalized to [0, 1]; a neutral 0.5 before any offer is observed.

AI Generated (Niemann & Lang concession-ratio issue weights).

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, forced_concession_time: float = 0.95, min_time_before_skipping: float = 0.1, min_offers_before_skipping: int = 5, expected_offers_rounding: float = 0.5, **kwargs)[source]

Bases: MAPNegotiator

Rational Concession Negotiator that can skip outcomes so as to traverse the whole outcome list before the deadline.

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.

  • accept_same – Accept an offer equal in utility to our own next offer.

  • forced_concession_time – Relative time after which concession is allowed even if we already sent more offers than we received.

  • min_time_before_skipping – Skipping is disabled before this relative time.

  • min_offers_before_skipping – Skipping is disabled until this many offers have been sent.

  • expected_offers_rounding – Added before truncating the estimated number of remaining offers (0.5 rounds to nearest).

  • offering – A ready FastMiCROOfferingPolicy to use instead of building one from the arguments above (which are then ignored).

  • acceptance – A ready AcceptancePolicy to use instead of MiCROAcceptancePolicy.

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(above_reserve: bool = True, levels: int = 10, *, negotiator: GBNegotiator | None = None)[source]

Bases: UFunModel

A frequency-based opponent model that assumes the opponent’s utility function is `LinearAdditiveUtilityFunction` (a weighted sum of per-issue value utilities) — the assumption used by the Bayesian opponent model of Hindriks & Tykhonov (2008), and hence the default opponent model for the Nice Tit for Tat agent.

It estimates the opponent’s preference for an issue value from how often the opponent has offered that value (values offered more frequently are assumed more preferred) and combines issues with learned weights: an issue whose offered-value distribution is more concentrated receives a higher weight (weight = 1 - normalized_entropy of the value counts). The estimated utility is the weighted sum of the per-issue value scores — a linear-additive aggregation.

The model is updated from every offer the negotiator responds to (before_responding) and, when the mechanism enables callbacks, from on_partner_proposal.

Parameters:
  • above_reserve – Kept for interface compatibility with ZeroSumModel.

  • levels – Number of grid values used to discretize continuous issues (so they contribute frequency counts instead of being ignored).

Remarks:
  • Continuous issues are discretized to levels grid values (via Issue.to_discrete); offered values are snapped to the nearest grid value for counting. Already-discrete issues are used as-is.

  • Returns utilities in [0, 1] (already normalized).

  • Before any opponent offer is observed, returns a neutral 0.5 for every outcome (so a Nice Tit for Tat offering strategy falls back to mirroring until the model has learned).

AI Generated (linear-additive frequency opponent model).

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

Learn from the offer the negotiator is about to respond to.

Parameters:
  • state – Current state.

  • offer – The partner’s offer being responded to.

  • source – Source identifier.

eval(offer: Outcome) Value[source]

Estimate the opponent’s (normalized) utility of offer.

Parameters:

offer – Offer being considered.

Returns:

A value in [0, 1].

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

Eval normalized (the model already returns values in [0, 1]).

Parameters:
  • offer – Offer being considered.

  • above_reserve – Unused (kept for interface compatibility).

  • expected_limits – Unused (kept for interface compatibility).

Returns:

A value in [0, 1].

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

Learn from a partner proposal (only called with enable_callbacks).

Parameters:
  • state – State when the offer was proposed.

  • partner_id – The ID of the agent who proposed.

  • offer – The proposal.

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

On preferences changed.

Parameters:

changes – Changes.

class negmas.gb.FrequencyUFunModel(above_reserve: bool = True, levels: int = 10, *, negotiator: GBNegotiator | None = None)[source]

Bases: UFunModel

A frequency-based opponent model that makes no assumption about the form of the opponent’s utility function (use this when the opponent’s ufun is not known to be linear-additive).

It counts how often the opponent has offered each complete outcome and estimates the opponent’s utility of an outcome as its offer frequency normalized by the maximum observed frequency. Outcomes never offered score 0. Before any offer is observed, every outcome scores a neutral 0.5.

The model is updated from every offer the negotiator responds to (before_responding) and, when the mechanism enables callbacks, from on_partner_proposal.

Remarks:
  • Returns utilities in [0, 1] (already normalized).

  • Sparse: only outcomes actually offered get a positive score, so this model is best suited to small/discrete outcome spaces. For larger spaces with an additive opponent ufun, prefer FrequencyLinearUFunModel.

AI Generated (frequency-based opponent model).

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

Learn from the offer the negotiator is about to respond to.

Parameters:
  • state – Current state.

  • offer – The partner’s offer being responded to.

  • source – Source identifier.

eval(offer: Outcome) Value[source]

Estimate the opponent’s (normalized) utility of offer.

Parameters:

offer – Offer being considered.

Returns:

A value in [0, 1].

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

Eval normalized (the model already returns values in [0, 1]).

Parameters:
  • offer – Offer being considered.

  • above_reserve – Unused (kept for interface compatibility).

  • expected_limits – Unused (kept for interface compatibility).

Returns:

A value in [0, 1].

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

Learn from a partner proposal (only called with enable_callbacks).

Parameters:
  • state – State when the offer was proposed.

  • partner_id – The ID of the agent who proposed.

  • offer – The proposal.

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

Register the model and set up discretized issues.

Parameters:

changes – Changes.

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, max_utility: float = 1.0, max_utility_tolerance: float = 0.999, *, 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).

  • max_utility – The assumed maximum utility in the domain (default 1.0, i.e. a normalized ufun).

  • max_utility_tolerance – Fraction of max_utility above which an offer counts as “close to max” and is accepted (default 0.999).

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

max_utility: float[source]
max_utility_tolerance: float[source]
multiplier: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACAgentK(expected_utility_decay: float = 0.5, time_pressure_exponent: float = 2.0, *, 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.

Parameters:
  • expected_utility_decay – How much the expected utility drops over the full negotiation (expected = 1 - decay * t). Defaults to 0.5.

  • time_pressure_exponent – Exponent applied to relative time when computing time pressure. Defaults to 2.0.

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

expected_utility_decay: float[source]
time_pressure_exponent: float[source]
class negmas.gb.GACAgentK2(base_accept_probability: float = 0.5, time_accept_weight: float = 0.5, *, 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.

Parameters:
  • base_accept_probability – Acceptance probability at t=0 for an offer that already meets expectations (default 0.5).

  • time_accept_weight – How much relative time adds to that probability (default 0.5, so it reaches 1.0 at the deadline).

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

base_accept_probability: float[source]
time_accept_weight: float[source]
class negmas.gb.GACAgentLG(accept_ratio: float = 0.99, min_acceptable_floor: float = 0.5, min_acceptable_base: float = 0.9, min_acceptable_decay: float = 0.3, endgame_time: float = 0.999, endgame_ratio: float = 0.9, *, 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).

  • min_acceptable_floor – Lower bound on the adaptive minimum acceptable utility (default 0.5).

  • min_acceptable_base – Value of the adaptive minimum at t=0 (default 0.9).

  • min_acceptable_decay – How much that minimum drops over the full negotiation (default 0.3).

  • endgame_time – Relative time after which endgame_ratio applies (default 0.999).

  • endgame_ratio – Fraction of our own last utility accepted in the endgame (default 0.9).

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

accept_ratio: float[source]
endgame_ratio: float[source]
endgame_time: float[source]
min_acceptable_base: float[source]
min_acceptable_decay: float[source]
min_acceptable_floor: float[source]
class negmas.gb.GACAgentMR(minimum_accept_p: float = 0.965, sigmoid_gain: float = -5.0, sigmoid_percent: float = 0.7, sigmoid_midpoint: float = 0.5, sigmoid_base: float = 10, time_exponent: float = 3, max_utility: float = 1.05, *, 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).

  • sigmoid_gain – Gain of the sigmoid controlling how the minimum bid utility decreases with time (default -5.0).

  • sigmoid_percent – Total drop of the minimum bid utility across the negotiation (default 0.70).

  • sigmoid_midpoint – Relative time at the sigmoid’s midpoint (default 0.5).

  • sigmoid_base – Base of the sigmoid’s power term (default 10).

  • time_exponent – Exponent applied to relative time in the acceptance probability, making it rise steeply near the deadline (default 3).

  • max_utility – Utilities above this are rejected outright as out of range (default 1.05).

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

max_utility: float[source]
minimum_accept_p: float[source]
sigmoid_base: float[source]
sigmoid_gain: float[source]
sigmoid_midpoint: float[source]
sigmoid_percent: float[source]
time_exponent: 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, min_threshold: float = 0.5, max_threshold: float = 0.95, threshold_exponent: float = 2, *, 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.

  • min_threshold – Acceptance threshold at the deadline (default 0.5).

  • max_threshold – Acceptance threshold at t=0 (default 0.95).

  • threshold_exponent – Exponent applied to relative time when interpolating between max_threshold and min_threshold (default 2).

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

max_threshold: float[source]
min_threshold: float[source]
offering_policy: OfferingPolicy[source]
threshold_exponent: float[source]
class negmas.gb.GACBRAMAgent2(offering_policy: OfferingPolicy, base_threshold: float = 0.95, threshold_range: float = 0.4, threshold_exponent: float = 2, *, 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.

  • base_threshold – Acceptance threshold at t=0 (default 0.95).

  • threshold_range – How much the threshold falls by the deadline (default 0.4).

  • threshold_exponent – Exponent applied to relative time (default 2).

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

base_threshold: float[source]
offering_policy: OfferingPolicy[source]
threshold_exponent: float[source]
threshold_range: float[source]
class negmas.gb.GACCUHKAgent(offering_policy: OfferingPolicy, min_threshold: float = 0.65, base_threshold: float = 0.95, concede_factor: float = 0.9, endgame_time: float = 0.9985, endgame_slack: float = 0.01, *, 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).

  • base_threshold – Threshold at t=0 (default 0.95).

  • concede_factor – Exponent applied to relative time when interpolating between base_threshold and min_threshold (default 0.9).

  • endgame_time – Relative time after which the opponent-max rule applies (default 0.9985).

  • endgame_slack – Slack subtracted from the observed opponent max in the endgame (default 0.01).

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

base_threshold: float[source]
concede_factor: float[source]
endgame_slack: float[source]
endgame_time: float[source]
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, early_phase_end: float = 0.5, *, 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).

  • early_phase_end – Relative time before which high_threshold alone triggers acceptance (default 0.5).

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

early_phase_end: float[source]
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, median_util: float = 0.5, close_enough: float = 0.05, time_diff_window: int = 10, endgame_rounds_left: int = 8, start_val: float = 1.0, concession_power: float = 27, *, 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).

  • median_util – Median-utility estimate used as the concession floor (default 0.5).

  • close_enough – Accept when our worst bid is within this much of the opponent’s offer (default 0.05).

  • time_diff_window – Number of recent inter-round time differences averaged when estimating the rounds left (default 10).

  • endgame_rounds_left – Once fewer than this many rounds are estimated to remain, accept at the concession floor (default 8).

  • start_val – Acceptance threshold at t=0 (default 1.0).

  • concession_power – Exponent applied to relative time - very large values keep the threshold near start_val until the very end (default 27).

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

close_enough: float[source]
concession_power: float[source]
endgame_rounds_left: int[source]
median_util: float[source]
reservation_value: float[source]
start_val: float[source]
time_diff_window: int[source]
class negmas.gb.GACInoxAgentOneIssue(reservation_value: float = 0.0, median_util: float = 0.5, *, 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).

  • median_util – Median-utility threshold at or above which an offer is accepted (default 0.5).

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

median_util: float[source]
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, endgame_start: float = 0.98, min_time_left: float = 0.001, *, 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.

  • endgame_start – Relative time from which the probabilistic (expected utility of waiting) rule kicks in. Before it, only AC_Next applies (default 0.98).

  • min_time_left – Minimum remaining relative time for which we still hold out for a better offer we have already seen (default 0.001).

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

endgame_start: float[source]
min_time_left: float[source]
offering_policy: OfferingPolicy[source]
class negmas.gb.GACNozomi(max_util_threshold: float = 0.95, phase1_end: float = 0.5, phase2_end: float = 0.8, phase1_coeff_slope: float = -0.1, phase1_coeff_intercept: float = 1.0, phase2_coeff_slope: float = -0.16, phase2_coeff_intercept: float = 0.95, phase2_compromise_factor: float = 0.95, phase3_compromise_factor: float = 0.9, phase3_split_time: float = 0.9, phase3_early_discount: float = 0.4, phase3_late_discount: float = 0.5, *, 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).

  • phase1_end – Relative time at which the early phase ends (default 0.50).

  • phase2_end – Relative time at which the middle phase ends (default 0.80).

  • phase1_coeff_slope – Slope of the early-phase acceptance coefficient slope * t + intercept (default -0.1).

  • phase1_coeff_intercept – Intercept of the early-phase coefficient (default 1.0).

  • phase2_coeff_slope – Slope of the middle-phase coefficient slope * (t - phase1_end) + intercept (default -0.16).

  • phase2_coeff_intercept – Intercept of the middle-phase coefficient (default 0.95).

  • phase2_compromise_factor – Fraction of the max compromise utility an offer must beat in the middle phase (default 0.95).

  • phase3_compromise_factor – Same, for the late phase (default 0.90).

  • phase3_split_time – Relative time splitting the late phase into its early and final parts (default 0.90).

  • phase3_early_discount – Discount applied to our last utility in the early part of the late phase (default 0.40).

  • phase3_late_discount – Same, for the final part (default 0.50).

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

max_util_threshold: float[source]
phase1_coeff_intercept: float[source]
phase1_coeff_slope: float[source]
phase1_end: float[source]
phase2_coeff_intercept: float[source]
phase2_coeff_slope: float[source]
phase2_compromise_factor: float[source]
phase2_end: float[source]
phase3_compromise_factor: float[source]
phase3_early_discount: float[source]
phase3_late_discount: float[source]
phase3_split_time: float[source]
class negmas.gb.GACOMACagent(offering_policy: OfferingPolicy, discount_threshold: float = 0.845, endgame_time: float = 0.97, *, 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).

  • endgame_time – Relative time after which a repeated bid is accepted (default 0.97).

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

discount_threshold: float[source]
endgame_time: 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, min_acceptable: float = 0.5, max_time_diff: float = 0.01, window_scale: float = 10, *, 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.

  • min_acceptable – Minimum utility below which an offer is rejected outright (default 0.5).

  • max_time_diff – Width of the near-deadline window, i.e. the rule fires once t >= 1 - max_time_diff (default 0.01).

  • window_scale – The window covers len(offers) * max_time_diff * window_scale of the most recent partner offers (default 10).

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

max_time_diff: float[source]
min_acceptable: float[source]
offering_policy: OfferingPolicy[source]
window_scale: float[source]
class negmas.gb.GACTheNegotiator(phase1_end: float = 0.3, phase2_end: float = 0.7, phase1_threshold: float = 0.95, phase2_threshold: float = 0.85, phase2_decay: float = 0.25, phase3_threshold: float = 0.7, phase3_decay: float = 0.3, desperate_moves_left: int = 15, default_moves_left: int = 100, *, 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.

Parameters:
  • phase1_end – Relative time ending the hardball phase (default 0.3).

  • phase2_end – Relative time ending the conceding phase (default 0.7).

  • phase1_threshold – Acceptance threshold during hardball (default 0.95).

  • phase2_threshold – Threshold at the start of the conceding phase (default 0.85), decaying at phase2_decay.

  • phase2_decay – Per-unit-time decay of the conceding threshold (default 0.25).

  • phase3_threshold – Threshold at the start of the desperate phase (default 0.70), decaying at phase3_decay.

  • phase3_decay – Per-unit-time decay of the desperate threshold (default 0.3).

  • desperate_moves_left – In the desperate phase, once fewer than this many moves are estimated to remain, anything is accepted (default 15).

  • default_moves_left – Moves-left estimate used when it cannot be computed (default 100).

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

default_moves_left: int[source]
desperate_moves_left: int[source]
phase1_end: float[source]
phase1_threshold: float[source]
phase2_decay: float[source]
phase2_end: float[source]
phase2_threshold: float[source]
phase3_decay: float[source]
phase3_threshold: float[source]
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, window_divisor: int = 4, *, 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).

  • window_divisor – The panic-phase window covers the most recent len(offers) // window_divisor partner offers (default 4).

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]
window_divisor: int[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(lowest_approved: float = 0.9, planned_threshold: float = 0.85, window_start: float = 0.98, window_end: float = 0.99, window_slack: float = 0.01, final_time: float = 0.995, final_opponent_max_min: float = 0.55, final_opponent_max_factor: float = 0.99, settled_threshold: float = 0.975, late_time: float = 0.9, late_slack: float = 0.01, *, 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.

Parameters:
  • lowest_approved – Lowest utility considered approved (default 0.9).

  • planned_threshold – Planned acceptance threshold (default 0.85).

  • window_start – Start of the near-deadline acceptance window (default 0.98).

  • window_end – End of that window (default 0.99).

  • window_slack – Slack subtracted from lowest_approved inside the window (default 0.01).

  • final_time – Relative time after which the opponent-max rule applies (default 0.995).

  • final_opponent_max_min – Minimum observed opponent-max utility required for that rule (default 0.55).

  • final_opponent_max_factor – Fraction of the observed opponent max that an offer must reach (default 0.99).

  • settled_threshold – Absolute utility above which a settled offer is accepted (default 0.975).

  • late_time – Relative time after which the planned threshold applies (default 0.9).

  • late_slack – Slack subtracted from planned_threshold late on (default 0.01).

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

final_opponent_max_factor: float[source]
final_opponent_max_min: float[source]
final_time: float[source]
late_slack: float[source]
late_time: float[source]
lowest_approved: float[source]
planned_threshold: float[source]
settled_threshold: float[source]
window_end: float[source]
window_slack: float[source]
window_start: float[source]
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(utility_band_tolerance: float = 0.01, decay_scale: float = 0.98, decay_base: float = 0.52, 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

decay_base: float[source]

Value the minimum allowed utility decays towards at the deadline.

decay_scale: float[source]

Scale of the exponentially decaying minimum allowed utility.

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

Initialize utility function.

sigma: float[source]
class negmas.gb.GAgentK2Offering(utility_band_tolerance: float = 0.01, *, 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(utility_band_tolerance: float = 0.01, *, 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(initial_value_util: float = 0.5, unchanged_issue_weight_boost: float = 1.1, value_util_increment: float = 0.1, max_value_util: float = 1.0, 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.

initial_value_util: float[source]

Utility assigned to an issue value before anything is learned about it.

max_value_util: float[source]

Upper clamp on a learned value utility.

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

Handle preference changes.

unchanged_issue_weight_boost: float[source]

Multiplier applied to an issue’s weight when it does not change between two consecutive opponent bids (weights are renormalized afterwards).

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

Update model based on opponent’s offer.

value_util_increment: float[source]

Amount added to a value’s utility each time the opponent offers it.

class negmas.gb.GAgentLGOffering(utility_band_tolerance: float = 0.01, concession_exponent: float = 1.5, max_concession: float = 0.4, *, 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

concession_exponent: float[source]

Exponent applied to relative time (larger concedes later).

max_concession: float[source]

Fraction of the utility range given away by the deadline.

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

Initialize utility function.

class negmas.gb.GAgentMROffering(utility_band_tolerance: float = 0.01, base_risk: float = 0.3, risk_growth: float = 0.2, *, 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

base_risk: float[source]

Risk factor at t=0 in the risk-aware concession rate.

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

Initialize utility function.

risk_growth: float[source]

How much the risk factor grows over the negotiation.

class negmas.gb.GAgentSmithOffering(utility_band_tolerance: float = 0.01, concession_exponent: float = 0.2, *, 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

concession_exponent: float[source]

Exponent of the Boulware-like concession curve (smaller concedes later).

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

Initialize utility function.

class negmas.gb.GAgentXFrequencyModel(decay_ratio: float = 0.5, 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

decay_ratio: float[source]

Fraction of learning_rate used to shrink the weight of an issue whose value changed between two consecutive opponent bids.

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] | None = None, negotiator_types: Iterable[type[GBNegotiator]] | None = None, negotiator_params: Iterable[dict[str, Any]] | None = None, 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. Mutually exclusive with negotiator_types.

  • negotiator_types – An iterable of GBNegotiator types to instantiate. Mutually exclusive with negmas.negotiators.

  • negotiator_params – Optional iterable of parameter dicts for each negotiator type. Only used with negotiator_types.

  • 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.

  • You can either pass negmas.negotiators (instances) OR negotiator_types (classes to instantiate). If using negotiator_types, you can optionally provide negotiator_params (parameter dicts).

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(utility_band_tolerance: float = 0.01, concession_exponent: float = 0.7, max_concession: float = 0.35, *, 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

concession_exponent: float[source]

Exponent applied to relative time (larger concedes later).

max_concession: float[source]

Fraction of the utility range given away by the deadline.

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

Initialize utility function.

class negmas.gb.GBRAMAgentOffering(utility_band_tolerance: float = 0.01, concession_rate: float = 0.3, *, 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

concession_rate: float[source]

Fraction of the utility range conceded linearly over the negotiation.

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, initial_value_util: float = 0.5, 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.

initial_value_util: float[source]

Utility assigned to an issue value before anything is learned about it.

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(utility_band_tolerance: float = 0.01, 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(utility_band_tolerance: float = 0.01, phase1_end: float = 0.2, phase2_end: float = 0.7, phase2_drop: float = 0.15, phase3_base_factor: float = 0.85, phase3_drop: float = 0.4, *, 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.

phase1_end: float[source]

Relative time until which the maximum is offered unchanged.

phase2_drop: float[source]

Fraction of the utility range conceded during phase 2.

phase2_end: float[source]

Relative time ending the moderate-concession phase.

phase3_base_factor: float[source]

Fraction of the maximum utility phase 3 starts from.

phase3_drop: float[source]

Fraction of the remaining range conceded during phase 3.

class negmas.gb.GCUHKFrequencyModel(no_information_utility: float = 0.5, 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.

no_information_utility: float[source]

Utility returned before any bid has been observed (or when a value frequency cannot be normalized).

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(utility_band_tolerance: float = 0.01, 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(utility_band_tolerance: float = 0.01, 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(utility: float = 0.5, *, 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 the constant utility for any outcome.

Parameters:

offer – The outcome to evaluate.

Returns:

Always returns self.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]

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

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

No-op - this model doesn’t adapt.

utility: float[source]

The constant utility this model reports for every outcome.

class negmas.gb.GFSEGABayesianModel(initial_value_util: float = 0.5, learning_rate_numerator: float = 1.0, 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.

initial_value_util: float[source]

Utility assigned to an issue value before anything is learned about it.

learning_rate_numerator: float[source]

Numerator of the decaying learning rate learning_rate_numerator / (1 + n_bids).

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(utility_band_tolerance: float = 0.01, phase_end: float = 0.6, early_drop: float = 0.05, late_base_factor: float = 0.95, late_drop: float = 0.5, late_exponent: float = 1.5, *, 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

early_drop: float[source]

Fraction of the utility range conceded during the early phase.

late_base_factor: float[source]

Fraction of the maximum utility the late phase starts from.

late_drop: float[source]

Fraction of the remaining range conceded during the late phase.

late_exponent: float[source]

Exponent applied to the late-phase progress (larger concedes later).

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

Initialize utility function.

phase_end: float[source]

Relative time separating the early phase from the late one.

class negmas.gb.GGahboninhoOffering(utility_band_tolerance: float = 0.01, concession_exponent: float = 3, max_concession: float = 0.4, *, 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

concession_exponent: float[source]

Exponent applied to relative time (larger concedes later).

max_concession: float[source]

Fraction of the utility range given away by the deadline.

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(utility_band_tolerance: float = 0.01, discount_ignore_threshold: float = 0.9, post_step_exponent: float = 30.0, 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

discount_ignore_threshold: float[source]

Discount at or above which discounting is ignored entirely.

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

Initialize utility function and parameters.

post_step_exponent: float[source]

Very large concession exponent used after the step point, which keeps the target almost flat.

class negmas.gb.GHardlinerOffering(utility_band_tolerance: float = 0.01, *, 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(utility_band_tolerance: float = 0.01, breakoff: float = 0.9, max_sampling_attempts: int = 100, max_utility_bound: float = 1.1, *, 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).

  • max_sampling_attempts – Number of random outcomes tried before falling back to an inverter query (default 100).

  • max_utility_bound – Upper bound of the fallback inverter query, i.e. the policy searches [breakoff, max_utility_bound] (default 1.1).

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

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

Initialize the inverse utility function.

class negmas.gb.GIAMHaggler2012Offering(utility_band_tolerance: float = 0.01, phase_end: float = 0.8, early_drop: float = 0.08, late_base_factor: float = 0.92, late_drop: float = 0.45, *, 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

early_drop: float[source]

Fraction of the utility range conceded during the early phase.

late_base_factor: float[source]

Fraction of the maximum utility the late phase starts from.

late_drop: float[source]

Fraction of the remaining range conceded during the late phase.

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

Initialize utility function.

phase_end: float[source]

Relative time separating the early phase from the late one.

class negmas.gb.GIAMhaggler2010Offering(utility_band_tolerance: float = 0.01, phase_end: float = 0.9, early_drop: float = 0.15, late_base_factor: float = 0.85, late_scale: float = 0.5, *, 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

early_drop: float[source]

Fraction of the utility range conceded during the early phase.

late_base_factor: float[source]

Fraction of the maximum utility the late phase starts from.

late_scale: float[source]

How much of the remaining range the late phase gives away.

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

Initialize utility function.

phase_end: float[source]

Relative time separating the conservative phase from the accelerated one.

class negmas.gb.GIAMhaggler2011Offering(utility_band_tolerance: float = 0.01, phase_end: float = 0.85, early_drop: float = 0.1, late_base_factor: float = 0.9, late_drop: float = 0.4, *, 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

early_drop: float[source]

Fraction of the utility range conceded during the early phase.

late_base_factor: float[source]

Fraction of the maximum utility the late phase starts from.

late_drop: float[source]

Fraction of the remaining range conceded during the late phase.

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

Initialize utility function.

phase_end: float[source]

Relative time separating the conservative phase from the final one.

class negmas.gb.GIAMhagglerBayesianModel(initial_value_util: float = 0.5, learning_rate: float = 0.2, learning_rate_decay: float = 0.1, 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.

initial_value_util: float[source]

Utility assigned to an issue value before anything is learned about it.

learning_rate: float[source]

Numerator of the decaying learning rate learning_rate / (1 + learning_rate_decay * n_bids).

learning_rate_decay: float[source]

How fast the learning rate decays with the number of observed bids.

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(initial_value_util: float = 0.5, learning_rate: float = 0.15, learning_rate_decay: float = 0.05, 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.

initial_value_util: float[source]

Utility assigned to an issue value before anything is learned about it.

learning_rate: float[source]

Numerator of the decaying learning rate learning_rate / (1 + learning_rate_decay * n_bids).

learning_rate_decay: float[source]

How fast the learning rate decays with the number of observed bids.

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(utility_band_tolerance: float = 0.01, concession_exponent: float = 2.5, max_concession: float = 0.45, *, 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

concession_exponent: float[source]

Exponent applied to relative time (larger concedes later).

max_concession: float[source]

Fraction of the utility range given away by the deadline.

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

Initialize utility function.

class negmas.gb.GLinearOffering(utility_band_tolerance: float = 0.01, 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(unchanged_issue_weight_addition: float = 0.1, 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.

unchanged_issue_weight_addition: float[source]

Total weight added, split across the issues that did not change between two consecutive opponent bids (weights are renormalized after).

class negmas.gb.GNiceTitForTatOffering(utility_band_tolerance: float = 0.01, max_concession: float = 0.25, concession_exponent: float = 0.8, *, 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

concession_exponent: float[source]

Exponent applied to relative time (smaller concedes earlier).

max_concession: float[source]

Fraction of the utility range given away by the deadline.

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

Initialize utility function.

class negmas.gb.GNozomiOffering(utility_band_tolerance: float = 0.01, phase_end: float = 0.8, early_drop: float = 0.1, late_base_factor: float = 0.9, *, 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

early_drop: float[source]

Fraction of the utility range conceded during the early phase.

late_base_factor: float[source]

Fraction of the maximum utility the late phase starts from.

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

Initialize utility function.

phase_end: float[source]

Relative time separating the slow early phase from the fast late one.

class negmas.gb.GOMACagentOffering(utility_band_tolerance: float = 0.01, min_utility: float = 0.59, eu: float = 0.95, discount_threshold: float = 0.845, e_high_discount: float = 0.033, e_low_discount: float = 0.04, discount_power: float = 0.2, min_utility_margin: float = 1.05, opening_time: float = 0.02, narrow_band: float = 0.01, wide_band_tolerance: float = 0.05, *, 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).

  • discount_threshold – Discount below which the low-discount target curve is used instead of the normal one (default 0.845).

  • e_high_discount – Concession exponent parameter used when the discount is at or above discount_threshold (default 0.033).

  • e_low_discount – Concession exponent parameter used below that threshold (default 0.04).

  • discount_power – Exponent applied to the discount when deriving the upper target bound in the low-discount branch (default 0.2).

  • min_utility_margin – Multiplier applied to min_utility for the lower target bound in the low-discount branch (default 1.05).

  • opening_time – Relative time before which the best outcome is offered unconditionally (default 0.02).

  • narrow_band – Fractional half-width of the first (narrow) utility band searched around the target, i.e. [target * (1 - narrow_band), target * (1 + narrow_band)] (default 0.01).

  • wide_band_tolerance – Absolute slack used for the fallback (wider) band search when the narrow band is empty (default 0.05).

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

discount_power: float[source]
discount_threshold: float[source]
e_high_discount: float[source]
e_low_discount: float[source]
eu: float[source]
min_utility: float[source]
min_utility_margin: float[source]
narrow_band: float[source]
on_preferences_changed(changes: list[PreferencesChange]) None[source]

Initialize utility function.

opening_time: float[source]
wide_band_tolerance: float[source]
class negmas.gb.GOppositeModel(no_information_utility: float = 0.5, *, 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.

no_information_utility: float[source]

Utility reported when our own ufun is unavailable.

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(ufun: BaseUtilityFunction | None = None, *, negotiator: GBNegotiator | None = None)[source]

Bases: PeekingOpponentModel

Perfect (oracle) opponent model — has access to the opponent’s true ufun.

This is the Genius PerfectModel: an oracle for testing/analysis where the opponent’s preferences are known. Pass the opponent’s true BaseUtilityFunction as ufun (at construction or later, model.ufun = ...); eval / eval_normalized then delegate to it. When no ufun is set it falls back to 0.5 (uniform).

Implemented as a thin alias of PeekingOpponentModel (the working oracle in gb.components.models.ufun) so the two share one code path; the only addition is the multilateral per-partner private_info update inherited from the Genius model family.

Transcompiled from: negotiator.boaframework.opponentmodel.PerfectModel

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

Register the oracle in private_info under partner_id (multilateral).

ufun[source]
class negmas.gb.GRandomOffering(utility_band_tolerance: float = 0.01, *, 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, initial_value_util: float = 0.5, decay_ratio: 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

decay_ratio: float[source]

Fraction of learning_rate used to decay the values the opponent did not offer.

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.

initial_value_util: float[source]

Utility assigned to an issue value before anything is learned about it.

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(initial_value_util: float = 0.5, value_util_increment: float = 0.05, unchanged_issue_weight_boost: float = 1.05, max_value_util: float = 1.0, 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.

initial_value_util: float[source]

Utility assigned to an issue value before anything is learned about it.

max_value_util: float[source]

Upper clamp on a learned value utility.

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

Handle preference changes.

unchanged_issue_weight_boost: float[source]

Multiplier applied to an issue’s weight when it does not change between two consecutive opponent bids (weights are renormalized afterwards).

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

Update model based on opponent’s offer.

value_util_increment: float[source]

Amount added to a value’s utility each time the opponent offers it.

class negmas.gb.GTheNegotiatorOffering(utility_band_tolerance: float = 0.01, phase1_end: float = 0.5, phase2_end: float = 0.8, phase2_drop: float = 0.2, phase3_base_factor: float = 0.8, phase3_drop: float = 0.5, *, 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.

phase1_end: float[source]

Relative time until which the maximum is offered unchanged.

phase2_drop: float[source]

Fraction of the utility range conceded during phase 2.

phase2_end: float[source]

Relative time ending the moderate-concession phase.

phase3_base_factor: float[source]

Fraction of the maximum utility phase 3 starts from.

phase3_drop: float[source]

Fraction of the remaining range conceded during phase 3.

class negmas.gb.GTheNegotiatorReloadedOffering(utility_band_tolerance: float = 0.01, phase1_end: float = 0.4, phase2_end: float = 0.75, phase2_drop: float = 0.15, phase3_base_factor: float = 0.85, phase3_drop: float = 0.45, *, 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.

phase1_end: float[source]

Relative time until which the maximum is offered unchanged.

phase2_drop: float[source]

Fraction of the utility range conceded during phase 2.

phase2_end: float[source]

Relative time ending the moderate-concession phase.

phase3_base_factor: float[source]

Fraction of the maximum utility phase 3 starts from.

phase3_drop: float[source]

Fraction of the remaining range conceded during phase 3.

class negmas.gb.GTimeDependentOffering(utility_band_tolerance: float = 0.01, 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(utility_band_tolerance: float = 0.01, concession_exponent: float = 2, max_concession: float = 0.35, *, 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

concession_exponent: float[source]

Exponent applied to relative time in the polynomial concession curve.

max_concession: float[source]

Fraction of the utility range given away by the deadline.

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(utility_band_tolerance: float = 0.01, sigmoid_gain: float = 12.0, sigmoid_midpoint: float = 0.7, max_concession: float = 0.5, *, 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

max_concession: float[source]

Fraction of the utility range conceded once the sigmoid saturates.

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

Initialize utility function.

sigmoid_gain: float[source]

Steepness of the sigmoid concession curve.

sigmoid_midpoint: float[source]

Relative time at the sigmoid’s midpoint.

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

Bases: AcceptancePolicy

Base class for Genius acceptance policies.

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

Bases: OfferingPolicy

Base class for Genius offering policies.

Holds the search knobs shared by (almost) every transcompiled Genius offering strategy, so they can be tuned uniformly.

Parameters:

utility_band_tolerance – Slack added on each side of the target utility when asking the inverter for an outcome, i.e. the policy searches [target - tol, pmax + tol]. Defaults to 0.01.

utility_band_tolerance: float[source]
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, initial_utility: float = nan, concession_ratio: float = nan, final_utility: float = nan, empathy_score: float = nan, auto_initial_utility: float = 1.0, auto_concession_ratio: float = 0.75, auto_empathy_score: float = 0.5, domain_size_cap: int = 100000, final_utility_ladder: tuple[tuple[float, float], ...] = ((450, 0.8), (1500, 0.775), (4500, 0.75), (18000, 0.725), (33000, 0.7)), final_utility_floor: float = 0.675, behavior_min_offers: int = 2, enumeration_levels: int = 10, enumeration_max_cardinality: int = 1000000, frac_time_based: dict[int, tuple[float, ...]] | None = None, above_only: bool = False, **kwargs)[source]

Bases: MAPNegotiator

A negotiator mixing a time-based (Bezier) concession curve with a behaviour-based reaction to the opponent, accepting via ACnext.

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.

  • alpha – ACnext utility scale (see ACNext).

  • beta – ACnext utility offset (see ACNext).

  • initial_utility – Bezier control point at t=0. NaN means auto (see HybridOfferingPolicy).

  • concession_ratio – Middle Bezier control point. NaN means auto.

  • final_utility – Bezier control point at t=1. NaN means auto (derived from the domain size).

  • empathy_score – How strongly the opponent’s concession moves our target. NaN means auto.

  • auto_initial_utilityinitial_utility used in auto mode.

  • auto_concession_ratioconcession_ratio used in auto mode.

  • auto_empathy_scoreempathy_score used in auto mode.

  • domain_size_cap – Domain cardinality is clipped to this before consulting final_utility_ladder.

  • final_utility_ladder – Ordered (max_domain_size, final_utility) pairs used to derive final_utility in auto mode.

  • final_utility_floorfinal_utility in auto mode for domains larger than every ladder threshold.

  • behavior_min_offers – Offers to receive before mixing in the behaviour-based component.

  • enumeration_levels – Discretization levels for continuous outcome spaces.

  • enumeration_max_cardinality – Max outcomes enumerated for continuous outcome spaces.

  • frac_time_based – Window weights over the opponent’s recent utility differences.

  • above_only – Only consider outcomes at or above the target utility.

  • offering – A ready HybridOfferingPolicy to use instead of building one from the arguments above (which are then ignored).

  • acceptance – A ready AcceptancePolicy to use instead of ACNext.

Remarks:
  • Every hyperparameter of HybridOfferingPolicy is reachable here, so the negotiator can be tuned without constructing components by hand.

class negmas.gb.HybridOfferingPolicy(initial_utility: float = nan, concession_ratio: float = nan, final_utility: float = nan, empathy_score: float = nan, auto_initial_utility: float = 1.0, auto_concession_ratio: float = 0.75, auto_empathy_score: float = 0.5, domain_size_cap: int = 100000, final_utility_ladder: tuple[tuple[float, float], ...] = ((450, 0.8), (1500, 0.775), (4500, 0.75), (18000, 0.725), (33000, 0.7)), final_utility_floor: float = 0.675, behavior_min_offers: int = 2, enumeration_levels: int = 10, enumeration_max_cardinality: int = 1000000, frac_time_based: dict[int, tuple[float, ...]] = NOTHING, above_only: bool = False, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

HybridOffering policy implementation.

Combines a time-based (quadratic Bezier) concession curve with a behaviour-based reaction to the opponent’s concessions.

Parameters:
  • initial_utility – Bezier control point at t=0. NaN (default) means auto: use auto_initial_utility.

  • concession_ratio – Middle Bezier control point. NaN (default) means auto: use auto_concession_ratio.

  • final_utility – Bezier control point at t=1. NaN (default) means auto: derive it from the domain size using final_utility_ladder / final_utility_floor. Whether given or derived, it is always floored at the reserved value.

  • empathy_score – How strongly the opponent’s concession moves our target in behaviour_based. NaN (default) means auto: use auto_empathy_score.

  • auto_initial_utility – Value used for initial_utility in auto mode.

  • auto_concession_ratio – Value used for concession_ratio in auto mode.

  • auto_empathy_score – Value used for empathy_score in auto mode.

  • domain_size_cap – Domain cardinality is clipped to this before consulting final_utility_ladder.

  • final_utility_ladder – Ordered (max_domain_size, final_utility) pairs. The first pair whose max_domain_size exceeds the (clipped) domain size supplies final_utility in auto mode.

  • final_utility_floorfinal_utility used in auto mode when the domain is larger than every threshold in final_utility_ladder.

  • behavior_min_offers – Minimum number of offers received before the behaviour-based component is mixed in (pure time-based before that).

  • enumeration_levelslevels used to discretize a continuous outcome space when enumerating candidate outcomes.

  • enumeration_max_cardinalitymax_cardinality used when enumerating a continuous outcome space.

  • frac_time_based – Window weights (keyed by window length) applied to the opponent’s recent utility differences in behaviour_based.

  • above_only – Only consider outcomes at or above the target utility.

above_only: bool[source]
auto_concession_ratio: float[source]
auto_empathy_score: float[source]
auto_initial_utility: float[source]
behavior_min_offers: int[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]
domain_size_cap: int[source]
empathy_score: float[source]
enumeration_levels: int[source]
enumeration_max_cardinality: int[source]
final_utility: float[source]
final_utility_floor: float[source]
final_utility_ladder: tuple[tuple[float, 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.KDEWeightUFunModel(above_reserve: bool = True, levels: int = 10, threshold: float = 0.1, *, negotiator: GBNegotiator | None = None)[source]

Bases: _SequentialWeightUFunModel

Issue weights via kernel density estimation — Coehoorn & Jennings [50].

The most-established issue-weight method in the survey (§5.3.1). For each issue it collects the sequence of normalized distances between sequential offers and fits a Gaussian kernel density estimate (scipy.stats.gaussian_kde) to that distance distribution. An issue whose distances concentrate near zero (the opponent barely moves it) is important, so the issue weight is the KDE probability mass in [0, threshold] — i.e. P(distance <= threshold) — then normalized across issues. Per-issue value utilities are estimated from offer frequency.

Parameters:

threshold – The distance below which a move counts as “held” when integrating the KDE (a fraction of the normalized [0, 1] range).

Remarks:
  • The survey’s full method maps distance to weight using a database of previous negotiations; this is a domain-agnostic online rendition that estimates the distance distribution from the running negotiation.

  • Falls back to the mean-distance estimate 1 - mean_distance per issue until there are enough distinct distance samples to fit a KDE.

  • Returns utilities already normalized to [0, 1].

AI Generated (Coehoorn & Jennings KDE issue weights).

threshold: float[source]
class negmas.gb.KindConcessionRecommender(kindness: float = 0.0, punish: float = True, initial_concession: float = 0.0, must_concede: bool = True, inverter: UtilityInverter | None = None, no_concession_step: int = 0, kindness_start_step: int = 3, min_concession_eps: float = 1e-12, *, 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

  • no_concession_step – Steps at or below this index get zero concession (the agent does not concede on its very first call).

  • kindness_start_step – From this step onward the recommendation is simply the partner’s concession plus kindness (the initial_concession / must_concede logic no longer applies).

  • min_concession_eps – Numerical slack added to the smallest representable utility gap when must_concede forces a minimal concession.

initial_concession: float[source]
inverter: UtilityInverter | None[source]
kindness: float[source]
kindness_start_step: int[source]
min_concession_eps: float[source]
must_concede: bool[source]
no_concession_step: int[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, default_acceptance_probability: float = 0.5, 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

  • default_acceptance_probability – acceptance probability used when neither acceptable_outcomes nor acceptance_probabilities is given.

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, prob_sum_tolerance: float = 0.999, *, 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]
prob_sum_tolerance: float[source]

Probability sums at or above this are treated as 1.0 (no renormalization).

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

Bases: TimeBasedConcedingNegotiator

A time-based negotiator that concedes linearly.

Uses a PolyAspiration curve with exponent 1 ("linear") and stochastic=False.

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.LuceProfileClassifierModel(profiles: list[BaseUtilityFunction] = NOTHING, use_map: bool = False, max_outcomes: int = 10000, *, negotiator: GBNegotiator | None = None)[source]

Bases: UFunModel

Classifies the opponent among candidate profiles via Luce numbers.

The model is given a finite set of candidate opponent utility functions (profiles). Following Lin et al. [123,124], a rational opponent using profile t is assumed to offer outcome o with probability proportional to its Luce number L_t(o) = u_t(o) / Σ_{o'} u_t(o') — the outcome’s utility divided by the sum of utilities over the outcome space. Each observed opponent offer therefore updates a Bayesian posterior over the candidate profiles (accumulated in log-space for numerical stability).

The estimated opponent utility of an outcome is the posterior-weighted average of the candidate utilities (or, if use_map is set, the utility under the single most-probable profile — the choice the survey describes).

Parameters:
  • profiles – The candidate opponent utility functions to classify among.

  • use_map – If True, evaluate using only the maximum-a-posteriori profile; otherwise use the posterior-weighted average of all profiles.

  • max_outcomes – Cap on the number of outcomes sampled to compute the Luce denominators (for large/continuous spaces).

Remarks:
  • The Luce denominators and combination use each candidate’s normalized utility (eval_normalized), so utilities are non-negative and comparable across profiles.

  • Before any offer is observed the posterior is uniform, so eval returns the plain average of the candidate utilities.

AI Generated (Lin et al. Luce-number classifier).

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

Learn from the offer the negotiator is about to respond to.

eval(offer: Outcome) Value[source]

Estimate the opponent’s normalized utility of offer in [0, 1].

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

Eval normalized (the model already returns values in [0, 1]).

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

Learn from a partner proposal (only with enable_callbacks).

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

Compute Luce denominators and initialize a uniform log-posterior.

profiles: list[BaseUtilityFunction][source]
use_map: bool[source]
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.

  • accept_same – Accept an offer equal in utility to our own next offer.

  • offering – A ready MiCROOfferingPolicy to use instead of the default.

  • acceptance – A ready AcceptancePolicy to use instead of MiCROAcceptancePolicy.

class negmas.gb.MiCROOfferingPolicy(next_indx: int = 0, sorter: InverseUFun | 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: InverseUFun | 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, must_concede: bool = True, no_concession_step: int = 0, kindness_start_step: int = 3, min_concession_eps: float = 1e-12, **kwargs)[source]

Bases: MAPNegotiator

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

The negotiator mirrors the opponent’s concession: if the opponent’s last offer was better for this negotiator than the one before it, the negotiator considers that the opponent has conceded by the difference and concedes a matching amount (adjusted by kindness). This implicitly assumes a zero-sum situation (no opponent model is kept).

Parameters:
  • name – Negotiator name.

  • preferences – Negotiator preferences (deprecated; use ufun).

  • ufun – Negotiator utility function (overrides preferences).

  • parent – A controller that manages this negotiator.

  • kindness (float) – How ‘kind’ the agent is. 0.0 is standard tit-for-tat. Positive values make the negotiator concede faster; negative values make it concede slower. Defaults to 0.0.

  • stochastic (bool) – If True, offers are randomized within the band determined by the current concession (which reflects the opponent’s concession). If False (default), the worst outcome in the band is proposed. Defaults to False.

  • punish (bool) – If True, the agent punishes a partner who does not concede by requiring higher utilities. Defaults to False.

  • initial_concession (float | str) – How much the agent should concede at the beginning, in utility units. Can be a non-negative float or the string "min" (treated as 0.0 — minimum concession). Defaults to "min".

  • rank_only (bool) – If True, only the relative ranks of outcomes (not their actual utilities) are used for inversion. Defaults to False.

  • must_concede (bool) – If True (default) the negotiator is guaranteed to make a (minimal) concession on its second call. Forwarded to KindConcessionRecommender.

  • no_concession_step (int) – Steps at or below this index get zero concession. Forwarded to KindConcessionRecommender.

  • kindness_start_step (int) – From this step onward the recommendation is simply the partner’s concession plus kindness. Forwarded to KindConcessionRecommender.

  • min_concession_eps (float) – Numerical slack added to the smallest representable utility gap when must_concede forces a minimal concession. Forwarded to KindConcessionRecommender.

  • **kwargs – Forwarded to MAPNegotiator.

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[NegotiatorDescriptor][source]

Information about all negotiators participating in this negotiation.

Returns:

List of participant information including IDs and preferences

Return type:

list[NegotiatorDescriptor]

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.NiceTitForTatNegotiator(*args, opponent_model: UFunModel | None = None, opponent_model_type: type | None = None, target: str = 'nash', sample_size: int = 100, max_cardinality: int = 10000, nash_refresh: int = 1, stochastic: bool = False, levels: int = 20, nash_min: float = 0.5, nash_multiplier_base: float = 1.4, nash_multiplier_gap_weight: float = 0.6, default_nash_utility: float = 0.7, discount_bonus_base: float = 0.5, discount_bonus_weight: float = 0.4, big_domain_cardinality: float = 3000, bonus_start_time: float = 0.91, bonus_start_time_big_domain: float = 0.85, bonus_ramp_rate: float = 20.0, pareto_sampler_type: type | None = None, a: float = 1.0, b: float = 0.0, t: float = 0.98, **kwargs)[source]

Bases: MAPNegotiator

The Nice Tit for Tat agent (Baarslag, Hindriks & Jonker, 2013).

A MAP negotiator combining the NiceTitForTatOfferingPolicy bidding strategy (reciprocate in the agent’s own utility while aiming for a bargaining-solution point, and make offers attractive to the opponent) with the ACCombi acceptance condition (accept when the opponent’s offer beats our next planned offer, or when time is running out).

The opponent model is the one piece the bidding strategy depends on. It is accessed through the standard opponent_ufun property (read by the offering policy via self.negotiator.opponent_ufun), populated automatically from the model passed here. You can either:

  • pass a ready opponent model as opponent_model (any UFunModel, e.g. a learned FrequencyLinearUFunModel, an oracle PeekingOpponentModel for tests, or a ZeroSumModel), or

  • pass an opponent-model type as opponent_model_type (a UFunModel subclass), constructed with no required args, or

  • pass neither and use the default: FrequencyLinearUFunModel — a frequency-based learner assuming a linear-additive opponent ufun, the same assumption as the Bayesian opponent model of Hindriks & Tykhonov (2008) used in the paper. Use FrequencyUFunModel instead when the opponent’s ufun is not known to be linear-additive.

Parameters:

:param : :param discount_bonus_base: :param discount_bonus_weight: :param big_domain_cardinality: :param : :param bonus_start_time: The Baarslag reference constants of the bidding strategy, forwarded

to NiceTitForTatOfferingPolicy. Defaults reproduce the paper.

Parameters:
  • bonus_start_time_big_domain – The Baarslag reference constants of the bidding strategy, forwarded to NiceTitForTatOfferingPolicy. Defaults reproduce the paper.

  • bonus_ramp_rate – The Baarslag reference constants of the bidding strategy, forwarded to NiceTitForTatOfferingPolicy. Defaults reproduce the paper.

  • pareto_sampler_type – The ParetoSampler implementation used by the offering policy for the opponent-attractive trade-off query. None (default) uses the offering policy’s own default (DefaultParetoSampler / AdaptiveParetoSampler — exact brute-force on small spaces, a scalable backend on large ones). Pass a specific type (e.g. IPSParetoSampler) to override.

  • a – ACcombi parameters (forwarded to ACCombi).

  • b – ACcombi parameters (forwarded to ACCombi).

  • t – ACcombi parameters (forwarded to ACCombi).

Remarks:
  • Exposes opponent_model (the UFunModel in use) as a property.

  • The offering policy degrades to naive tit-for-tat if the opponent model is unavailable or uninformative.

AI Generated (Nice Tit for Tat MAP negotiator, after Baarslag et al. 2013).

property opponent_model: UFunModel | None[source]

The opponent utility-function model used by the offering strategy.

class negmas.gb.NiceTitForTatOfferingPolicy(sample_size: int = 100, max_cardinality: int = 10000, nash_refresh: int = 1, stochastic: bool = False, target: str = 'nash', levels: int = 20, nash_min: float = 0.5, pareto_sampler_type: type[ParetoSampler] = <class 'negmas.preferences.pareto_sampler.adaptive.AdaptiveParetoSampler'>, nash_multiplier_base: float = 1.4, nash_multiplier_gap_weight: float = 0.6, default_nash_utility: float = 0.7, discount_bonus_base: float = 0.5, discount_bonus_weight: float = 0.4, big_domain_cardinality: float = 3000, bonus_start_time: float = 0.91, bonus_start_time_big_domain: float = 0.85, bonus_ramp_rate: float = 20.0, *, negotiator: GBNegotiator | None = None)[source]

Bases: OfferingPolicy

The bidding (offering) strategy of the Nice Tit for Tat agent (Baarslag, Hindriks & Jonker, 2013, “A Tit for Tat Negotiation Strategy for Real-Time Bilateral Negotiations”).

The strategy reciprocates in the agent’s own utility (the opponent’s utility is unknown and any model of it is unreliable, so we measure the opponent’s concession as the change in our utility of the opponent’s successive offers) and aims for a bargaining solution point of the scenario rather than naively mirroring the opponent’s raw concession (naive mirroring settles for ~0.5 utility and misses win-win deals). By default the target is the Nash bargaining point (as in the paper); other solution concepts can be selected with target (see below):

This follows the algorithm of the reference Genius implementation (Baarslag’s NiceTitForTat), working entirely in the agent’s normalized [0, 1] utility:

  1. Cooperate first. Initially the agent offers its best outcome (it never defects first).

  2. Estimate ``my_nash``. Using the opponent model (negotiator.opponent_ufun) and the calculators in negmas.preferences.ops, estimate the chosen bargaining solution and take the agent’s own utility p_me at it. Scale it by a multiplier that depends on how far the opponent started from the agent (1.4 - 0.6 * initial_gap) and floor it: for the Nash target at nash_min (0.5 by default, as in the reference); for other targets only at the reserved value.

  3. Reciprocate the opponent’s observed concession. Measure the opponent’s concession in the agent’s own utility as max_offered_to_me - first_offered_to_me (how far the best bid it has offered us has moved from its starting bid — directly observed, not model-estimated) and express it as a fraction of the way to my_nash. The agent concedes the same fraction of its own gap from 1 down to my_nash: target = 1 - factor * (1 - my_nash). Then a concession bonus (a small constant baseline from the discount factor plus a ramp near the deadline) pulls the target the rest of the way toward my_nash — this is what lets a mirror match concede and agree instead of deadlocking at maximum utility.

  4. Make the offer attractive to the opponent. Among the outcomes in the agent’s acceptable utility band [target, 1], pick the one the opponent model rates highest — the trade-off query argmax_{u_me >= target} u_opp, answered by a ParetoSampler (pareto_sampler_type) built on the normalized agent ufun with the opponent model as the opponent ufun (via ufun.make_pareto_sampler, cached and re-initialized as the same model instance learns). If the sampler cannot answer (no result, or its additivity requirements are not met), the policy falls back to inverting the normalized ufun over the band. Finally, if the best bid the opponent has already offered us is worth at least as much to us as our planned bid, we offer that bid instead (the reference’s makeAppropriate), so consensus forms as soon as the opponent’s standing offer beats our plan.

The opponent model is accessed through self.negotiator.opponent_ufun (a UFunModel), which may be provided to the negotiator or left to a default (see NiceTitForTatNegotiator).

AI Generated (implementation of the Baarslag 2013 Nice Tit for Tat bidding strategy for negmas).

Parameters:
  • sample_size – Maximum number of outcomes to sample from the utility band when selecting the opponent-attractive offer.

  • max_cardinality – Maximum number of outcomes to enumerate/sample when estimating the bargaining point.

  • nash_refresh – Re-estimate the bargaining point every this many rounds (1 = every round, reflecting an opponent model that keeps learning).

  • stochastic – If True and no opponent model is available, pick a random in-band outcome instead of the worst-in-band one.

  • target – The bargaining solution to aim for. One of "nash" (default, Nash bargaining), "kalai" (Kalai egalitarian), "kalai_smorodinsky" / "ks" (Kalai-Smorodinsky), "max_welfare" (utilitarian / max sum of utilities), or "max_relative_welfare" (max sum of relative gains). Selected via the corresponding calculator in negmas.preferences.ops.

  • nash_min – Lower clamp on the estimated my_nash target utility, applied only for the "nash" target (the reference agent never asks for less than 0.5). For other solution concepts the target is floored at the reserved value instead, so a legitimately lower p_me is not inflated.

  • pareto_sampler_type – The ParetoSampler implementation used for step iv (the opponent-attractive trade-off query). Defaults to DefaultParetoSampler (AdaptiveParetoSampler), which uses the exact BruteForceParetoSampler on small outcome spaces and a scalable backend on large ones. Pass a specific sampler type (e.g. BruteForceParetoSampler, or IPSParetoSampler for very large additive domains) to override. The sampler is queried each round via best_for_opponent with the opponent model as the opponent ufun; if it cannot answer the query the policy falls back to the inverter path.

Remarks:
  • Requires the negotiator to expose opponent_ufun (a UFunModel or None). When it is None the policy degrades to naive tit-for-tat.

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

Remember the opponent’s offers and update the offer-history stats.

Tracks, in the agent’s own normalized utility, the utility of the opponent’s first bid (the reference point for its concession) and the running maximum utility it has offered us (a ratchet), plus the bid that achieved it (used to avoid overshooting — see makeAppropriate in the reference).

big_domain_cardinality: float[source]
bonus_ramp_rate: float[source]
bonus_start_time: float[source]
bonus_start_time_big_domain: float[source]
default_nash_utility: float[source]
discount_bonus_base: float[source]
discount_bonus_weight: float[source]
levels: int[source]
max_cardinality: int[source]
nash_min: float[source]
nash_multiplier_base: float[source]
nash_multiplier_gap_weight: float[source]
nash_refresh: int[source]
pareto_sampler_type: type[ParetoSampler][source]
sample_size: int[source]
stochastic: bool[source]
target: str[source]
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.

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

Bases: UFunModel

An oracle opponent model that wraps the opponent’s true utility function.

Intended for testing/analysis: the model “peeks” at the opponent’s actual BaseUtilityFunction and delegates eval / eval_normalized to it. This lets a Nice Tit for Tat agent (or any consumer of opponent_model) be tested against a correct opponent model, so its concession/Nash-aiming behaviour can be checked without the noise of a learned model.

Parameters:

ufun – The opponent’s true utility function. May be set at construction or assigned later (model.ufun = ...) before the negotiation starts.

Remarks:

AI Generated (oracle opponent model for testing).

eval(offer: Outcome) Value[source]

Return the opponent’s true (normalized) utility of offer.

Parameters:

offer – Offer being considered.

Returns:

The opponent’s normalized utility, or 0.5 if no ufun is set.

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

Return the opponent’s true normalized utility of offer.

Parameters:
  • offer – Offer being considered.

  • above_reserve – Forwarded to the wrapped ufun.

  • expected_limits – Forwarded to the wrapped ufun.

Returns:

The opponent’s normalized utility, or 0.5 if no ufun is set.

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

Register the model in the negotiator’s private info.

Parameters:

changes – Changes.

ufun: BaseUtilityFunction | None[source]
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, prob_sum_tolerance: float = 0.999, *, 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]
prob_sum_tolerance: float[source]

Probability sums at or above this are treated as 1.0 instead of raising.

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

A time-based conceding negotiator using an Aspiration curve.

This is the main entry point for aspiration-based time-only negotiators. It accepts an Aspiration curve (or a string/float shorthand) for both offering and accepting, plus a starting_utility that controls the first offer’s utility level.

Parameters:
  • offering_curve (Aspiration | str | float) – An Aspiration curve (or "boulware" / "linear" / "conceder" or a float exponent) controlling how fast the negotiator concedes when offering. Defaults to "boulware" (slow concession).

  • accepting_curve (Aspiration | str | float | None) – An Aspiration curve (or string/float) controlling the acceptance threshold. If None or falsy, the offering curve is reused.

  • starting_utility (float) – The relative utility (in [0, 1]) at which the first offer is made. Only used when offering_curve is a string/float (not a pre-built Aspiration object). Defaults to 1.0 (start at the best outcome).

  • **kwargs – Forwarded to TimeBasedNegotiator (e.g. stochastic, ufun_inverter, eps, offer_selector).

Remarks:
  • BoulwareTBNegotiator, LinearTBNegotiator, and ConcederTBNegotiator are convenience subclasses that fix offering_curve to "boulware", "linear", and "conceder" respectively (with stochastic=False).

  • AspirationNegotiator is a simplified interface to this class with presort and tolerance parameters.

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

A time-based negotiation strategy that concedes independently of the offers received during the negotiation.

The negotiator maintains two concession curves: an offering curve that controls the utility range of its own proposals, and an accepting curve that controls the utility range of offers it will accept. Both are TimeCurve objects mapping relative time t [0, 1] to a utility range. At each step, the negotiator asks the inverter for an outcome within the offering curve’s range (for propose) or checks whether the opponent’s offer falls within the accepting curve’s range (for respond).

Parameters:
  • offering_curve (TimeCurve | str | float) – A TimeCurve (or a string "boulware" / "linear" / "conceder" or a float exponent) used to sample outcomes when offering. Defaults to "boulware".

  • accepting_curve (TimeCurve | str | float | None) – A TimeCurve (or string/float as above) used to decide the utility range to accept. If None, the offering curve is reused (same range for offering and accepting).

  • offer_selector (OfferSelector | None) – See UtilBasedNegotiator.

  • **kwargs – Forwarded to UtilBasedNegotiator (e.g. stochastic, ufun_inverter, eps, rank_only, max_cardinality).

Remarks:
  • This negotiator is time-only: it never reacts to the opponent’s offers (except accepting/rejecting them). For opponent-aware behavior, use NaiveTitForTatNegotiator or the OfferOrientedTBNegotiator family.

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: InverseUFun | 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.

Handles different change types appropriately: - Initialization/General: Initialize the sorter (warn if already initialized) - Scale/ReservedValue/ReservedOutcome: Ignored (don’t affect outcome ordering)

sorter: InverseUFun | 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.

A UFunModel is a full stand-in for a `BaseUtilityFunction`: anywhere a ufun is accepted (e.g. pareto_frontier, the bargaining-solution calculators in negmas.preferences.ops, or a ParetoSampler) a UFunModel can be passed without errors. Concrete subclasses are typically declared with @define and therefore skip BaseUtilityFunction.__init__, so the state it would have set up (_invalid_value, _constraints, _reserved_value and the caches) is initialised here in __attrs_post_init__ instead.

AI supported (made into a full ufun stand-in for use as an opponent model).

property outcome_space[source]

The outcome space the model is defined over.

A UFunModel models the opponent over the same outcomes the agent cares about, so its outcome space is the negotiator’s ufun outcome space. Exposing it (rather than leaving it unset, as the @define subclasses do by skipping BaseUtilityFunction.__init__) lets the model be used wherever a ufun is expected — e.g. minmax, pareto_frontier, and the bargaining-solution calculators all read outcome_space.

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.

It uses an InverseUFun (via the UtilityInverter component) to find outcomes with utilities in a desired range, and an optional OfferSelector to pick among multiple candidate outcomes.

Parameters:
  • stochastic (bool) – If False (default), the inverter’s worst_in is used so the negotiator proposes the outcome with the lowest utility still within its aspiration band (i.e. just above the aspiration level). If True, one_in is used so a random in-range outcome is proposed.

  • rank_only (bool) – If True, only the relative ranks of outcomes (not their actual utilities) are used for inversion. This maps all equal-utility outcomes to the same rank, which can be useful for non-stationary or noisy ufuns.

  • ufun_inverter (Callable[[BaseUtilityFunction], InverseUFun] | None) – A factory that constructs an InverseUFun from the negotiator’s utility function. If None, a DefaultInverseUtilityFunction (i.e. AdaptiveInverseUtilityFunction) is used.

  • offer_selector (OfferSelector | None) – A callable that selects one outcome from a sequence of candidates given the current state. If None and stochastic is True, a random candidate is chosen. If None and stochastic is False, worst_in is used directly (no selection needed).

  • max_cardinality (int) – The number of outcomes at which the default inverter may switch away from exact presorting to a scalable approximation. Used only if ufun_inverter is None.

  • eps (float) – A tolerance around the utility range used when sampling outcomes (passed to the inverter).

Remarks:
  • propose recovers from a None inverter result (which would otherwise break the SAO mechanism) by falling back to the best outcome. This matters for strict inverters (e.g. BruteForceInverseUtilityFunction) whose aspiration range contains no outcome, and as a safety net when a clamping inverter’s fallbacks are exhausted.

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

On preferences changed.

Parameters:

changes – Changes.

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

Propose.

Recovers from a None proposal (which would otherwise break the SAO mechanism — see negmas.sao.mechanism) by falling back to the best outcome. This is important when the inverter is strict (e.g. BruteForceInverseUtilityFunction) and the requested aspiration range contains no outcome: the negotiator would rather offer its best outcome than break the negotiation.

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.ValueDifferenceUFunModel(above_reserve: bool = True, levels: int = 10, *, negotiator: GBNegotiator | None = None)[source]

Bases: _SequentialWeightUFunModel

Issue weights from value-difference magnitudes — Carbonneau & Vahidov [37].

Unlike ConcessionRatioUFunModel, which only counts whether an issue’s value changed, this model uses the magnitude of the change between two sequential offers, normalized by the issue’s range (survey §5.3.1). For a numeric issue the per-step difference is |v_t - v_{t-1}| / range_i; for a categorical issue it is a 0/1 indicator. The running mean normalized difference d_i gives the issue weight w_i = 1 - d_i (then normalized). Per-issue value utilities are estimated from offer frequency.

Remarks:
  • Larger (normalized) moves on an issue ⇒ more concession ⇒ lower weight.

  • Returns utilities already normalized to [0, 1]; a neutral 0.5 before any offer is observed.

AI Generated (Carbonneau & Vahidov value-difference issue weights).

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: InverseUFun | 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: InverseUFun | 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’.