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:
AcceptancePolicyThe 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).
- offering_strategy: OfferingPolicy[source]¶
- class negmas.gb.ACConst(th: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyAccepts outcomes with utilities above the given threshold
- class negmas.gb.ACLast(alpha: float = 1.0, beta: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyImplements the AClast acceptance strategy based on our last offer.
Accepts $omega$ if $lpha u(my-next-offer) + eta > u(omega)$
- 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:
AcceptancePolicyAccepts $omega$ if $lpha u(my-next-offer) + eta > f(u( ext{utils of offers received in the given fraction of time}))$
- 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:
AcceptancePolicyAccepts $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.
- class negmas.gb.ACNext(offering_strategy: OfferingPolicy, alpha: float = 1.0, beta: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyImplements the ACnext acceptance strategy based on our next offer.
Accepts $omega$ if $lpha u(my-next-offer) + eta > u(omega)$
- offering_strategy: OfferingPolicy[source]¶
- class negmas.gb.ACTime(tau: float, rational: bool = True, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyImplements the ACtime acceptance strategy based on our next offer.
Accepts if the relative time is greater than or equal to tau
- class negmas.gb.AcceptAbove(limit: float, above_reserve: bool = True, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyAccepts outcomes with utilities in the given top
limitfraction above reserve/minimum (based onabove_resrve).- on_preferences_changed(changes: list[PreferencesChange])[source]¶
Handle preference updates (no action needed for threshold-based acceptance).
- class negmas.gb.AcceptAnyRational(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyAccepts any rational outcome.
- class negmas.gb.AcceptAround(relative_time: float = 1.0, eps: float = 0.001, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyAccepts around the given relative time (i.e. eps from it)
- class negmas.gb.AcceptBest(best_util: float = inf, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyAccepts 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:
AcceptancePolicyAccept 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:
AcceptancePolicyAccepts in the given range of relative times.
- class negmas.gb.AcceptImmediately(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyAccepts immediately anything
- class negmas.gb.AcceptNotWorseRational(accepted: dict[str, Outcome] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyAccept 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:
AcceptancePolicyAccepts outcomes that are in the given top fraction or top
k. If neither is given it reverts to accepting the best outcome only.- Remarks:
- 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:
GBComponentAcceptance 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
GBStategiving current state of the negotiation.offer – offer being tested
- Returns:
The response to the offer
- Return type:
- Remarks:
The default implementation never ends the negotiation
The default implementation asks the negotiator to
propose`() and accepts the `offerif 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:
TimeBasedNegotiatorA 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:
TimeBasedNegotiatorA 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:
TimeBasedNegotiatorA 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:
PartnerOffersOrientedSelectorOrients 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
- class negmas.gb.AllAcceptEvaluationStrategy(strategies: list[EvaluationStrategy])[source]¶
Bases:
EvaluationStrategyAllAcceptEvaluation strategy.
- class negmas.gb.AllAcceptanceStrategies(strategies: list[AcceptancePolicy], *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
ConcensusAcceptancePolicyAccept 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:
OfferingConstraintAllOfferingConstraints implementation.
- constaints: list[OfferingConstraint][source]¶
- class negmas.gb.AnyAcceptEvaluationStrategy(strategies: list[EvaluationStrategy])[source]¶
Bases:
EvaluationStrategyAnyAcceptEvaluation strategy.
- class negmas.gb.AnyAcceptancePolicy(strategies: list[AcceptancePolicy], *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
ConcensusAcceptancePolicyAccept 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:
OfferingConstraintAnyOfferingConstraint 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:
TimeBasedConcedingNegotiatorA 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
InverseUFunto 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 to1.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) viaworst_in. IfTrue, it proposes a random in-range outcome viaone_in.presort (bool) – If
True(default), aDefaultInverseUtilityFunction(i.e.AdaptiveInverseUtilityFunction) is used, which presorts outcomes for exactO(log n)lookups on small/medium spaces and falls back to BIDS for large additive spaces. IfFalse, 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
epsto the inverter). Defaults to0.001.ufun_inverter (type[InverseUFun] | None) – An optional
InverseUFuntype to use for inverting the utility function. If given, it overrides thepresortdefault. Seenegmas.preferences.inv_ufunfor the full list of available inverters and their trade-offs.**kwargs – Forwarded to
TimeBasedConcedingNegotiator(e.g.name,ufun,parent,owner).
- Remarks:
This class provides a simpler interface to
TimeBasedConcedingNegotiatorwith less control over the accepting curve and offer selector. For more control, useTimeBasedConcedingNegotiatororTimeBasedNegotiatordirectly.proposenever returnsNonemid-negotiation: if the inverter finds no outcome in the aspiration range (e.g. for strict inverters likeBruteForceInverseUtilityFunction, or when the aspiration band is empty), it falls back to the best outcome rather than breaking the SAO mechanism.
- class negmas.gb.BestOfferOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, **kwargs)[source]¶
Bases:
OfferOrientedSelectorSelects the offer nearest the partner’s best offer for me 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:
FirstOfferOrientedTBNegotiatorA 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:
OfferSelectorSelects the outcome with the highest utility value.
- class negmas.gb.BoulwareTBNegotiator(*args, **kwargs)[source]¶
Bases:
TimeBasedConcedingNegotiatorA time-based negotiator that concedes sub-linearly (boulware).
Uses a
PolyAspirationcurve with exponent 4 ("boulware") andstochastic=False(proposes the worst outcome within the aspiration band).
- class negmas.gb.CABNegotiator(*args, **kwargs)[source]¶
Bases:
MAPNegotiatorConceding 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
Agentthat owns the negotiator.
- class negmas.gb.CABOfferingPolicy(next_indx: int = 0, sorter: InverseUFun | None = None, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
OfferingPolicyCABOffering policy implementation.
- 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:
MAPNegotiatorConceding 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
Agentthat owns the negotiator.
- class negmas.gb.CARNegotiator(*args, **kwargs)[source]¶
Bases:
MAPNegotiatorConceding 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
Agentthat owns the negotiator.
- class negmas.gb.CandidateEliminationModel(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
UFunModelOrdinal 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
1if confirmed acceptable,0if only ever seen in a rejected offer, and0.5if 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.5for 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_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
offeras 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:
TimeBasedConcedingNegotiatorA time-based negotiator that concedes super-linearly (conceder).
Uses a
PolyAspirationcurve with exponent 0.25 ("conceder") andstochastic=False.
- class negmas.gb.ConcensusAcceptancePolicy(strategies: list[AcceptancePolicy], *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicy,ABCAccepts 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(seefilterfor 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:
Should we continue trying other strategies
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,ABCOffers 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(seefilterfor 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:
Should we continue trying other strategies
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:
_SequentialWeightUFunModelIssue weights from concession ratios — Niemann & Lang [143] (survey §5.3.1).
For each issue a concession ratio
c_iis 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 isw_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_iis 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 neutral0.5before any offer is observed.
AI Generated (Niemann & Lang concession-ratio issue weights).
- class negmas.gb.ConcessionRecommender(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GBComponentDecides the level of concession to use
- class negmas.gb.EndImmediately(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyEnds negotiation immediately regardless of the offer.
- class negmas.gb.ExtendedResponseType(response: ResponseType, data: dict[str, Any] | None = None)[source]¶
Bases:
objectA 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.
- 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.
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
negmas.outcomes.common.ExtendedOutcome: For extending offer outcomes.negmas.sao.common.SAOResponse.from_extended(): For creating SAOResponse from extended types.
- 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:
MAPNegotiatorRational 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
Agentthat 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.5rounds to nearest).offering – A ready
FastMiCROOfferingPolicyto use instead of building one from the arguments above (which are then ignored).acceptance – A ready
AcceptancePolicyto use instead ofMiCROAcceptancePolicy.
- class negmas.gb.FirstOfferOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, **kwargs)[source]¶
Bases:
OfferOrientedSelectorSelects the offer nearest the partner’s first offer
- class negmas.gb.FirstOfferOrientedTBNegotiator(*args, distance_fun: ~typing.Callable[[tuple, tuple, ~negmas.outcomes.protocols.OutcomeSpace | None], float] = <function generalized_minkowski_distance>, **kwargs)[source]¶
Bases:
OfferOrientedNegotiatorA 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:
UFunModelA 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_entropyof 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, fromon_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
levelsgrid values (viaIssue.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.5for 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).
- 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].
- 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:
UFunModelA 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 neutral0.5.The model is updated from every offer the negotiator responds to (
before_responding) and, when the mechanism enables callbacks, fromon_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).
- 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].
- 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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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_utilityabove which an offer counts as “close to max” and is accepted (default 0.999).
Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2010.AC_AgentFSEGA
- 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:
GeniusAcceptancePolicyAC_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 to0.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
- class negmas.gb.GACAgentK2(base_accept_probability: float = 0.5, time_accept_weight: float = 0.5, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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=0for 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
- 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:
GeniusAcceptancePolicyAC_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_ratioapplies (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
- 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:
GeniusAcceptancePolicyAC_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
- class negmas.gb.GACAgentSmith(accept_margin: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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_thresholdandmin_threshold(default 2).
Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_BRAMAgent
- offering_policy: OfferingPolicy[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:
GeniusAcceptancePolicyAC_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
- offering_policy: OfferingPolicy[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:
GeniusAcceptancePolicyAC_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_thresholdandmin_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
- 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:
GeniusAcceptancePolicyAC_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
- offering_policy: OfferingPolicy[source]¶
- class negmas.gb.GACCombiAvg(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- class negmas.gb.GACCombiBestAvg(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- class negmas.gb.GACCombiBestAvgDiscounted(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- class negmas.gb.GACCombiMax(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- class negmas.gb.GACCombiMaxInWindow(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- class negmas.gb.GACCombiMaxInWindowDiscounted(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- class negmas.gb.GACCombiProb(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- class negmas.gb.GACCombiProbDiscounted(offering_policy: OfferingPolicy, t: float = 0.98, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- 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:
GeniusAcceptancePolicyAC_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
- offering_policy: OfferingPolicy[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:
GeniusAcceptancePolicyAC_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
- offering_policy: OfferingPolicy[source]¶
- class negmas.gb.GACCombiV4(offering_policy: OfferingPolicy, t: float = 0.98, w: float = 0.5, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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]¶
- class negmas.gb.GACConst(c: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- class negmas.gb.GACConstDiscounted(c: float = 0.9, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- class negmas.gb.GACFalse(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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:
GeniusAcceptancePolicyAC_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_thresholdalone triggers acceptance (default 0.5).
Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_Gahboninho
- class negmas.gb.GACGap(c: float = 0.01, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- class negmas.gb.GACHardHeaded(offering_policy: OfferingPolicy, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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_valuntil the very end (default 27).
Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2013.AC_InoxAgent
- class negmas.gb.GACInoxAgentOneIssue(reservation_value: float = 0.0, median_util: float = 0.5, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- class negmas.gb.GACMAC(offering_policy: OfferingPolicy, constant: float = 0.95, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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
- class negmas.gb.GACOMACagent(offering_policy: OfferingPolicy, discount_threshold: float = 0.845, endgame_time: float = 0.97, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- offering_policy: OfferingPolicy[source]¶
- class negmas.gb.GACPrevious(a: float = 1.0, b: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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_scaleof the most recent partner offers (default 10).
Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2013.AC_TheFawkes
- offering_policy: OfferingPolicy[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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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_divisorpartner offers (default 4).
Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2012.AC_TheNegotiatorReloaded
- offering_policy: OfferingPolicy[source]¶
- class negmas.gb.GACTime(t: float = 0.99, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- class negmas.gb.GACTrue(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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:
GeniusAcceptancePolicyAC_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
- 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:
GeniusAcceptancePolicyAC_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_approvedinside 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_thresholdlate on (default 0.01).
Transcompiled from: negotiator.boaframework.acceptanceconditions.anac2011.AC_ValueModelAgent
- class negmas.gb.GACYushu(initial_target: float = 0.95, final_target: float = 0.7, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusAcceptancePolicyAC_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
- class negmas.gb.GAOEvaluationStrategy[source]¶
Bases:
LocalEvaluationStrategyGAOEvaluation 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:
GeniusOfferingPolicyAgentFSEGA 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
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GAgentK2Offering(utility_band_tolerance: float = 0.01, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyAgentK2 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:
GeniusOfferingPolicyAgentK 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:
GeniusOpponentModelAgentLG opponent model.
This model uses learning-based estimation of opponent preferences.
Transcompiled from: negotiator.boaframework.opponentmodel.AgentLGModel
- 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.
- 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).
- 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:
GeniusOfferingPolicyAgentLG offering strategy from ANAC 2012.
This strategy uses learning-based concession.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.AgentLG_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GAgentMROffering(utility_band_tolerance: float = 0.01, base_risk: float = 0.3, risk_growth: float = 0.2, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyAgentMR offering strategy from ANAC 2012.
This strategy uses risk-based concession.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.AgentMR_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GAgentSmithOffering(utility_band_tolerance: float = 0.01, concession_exponent: float = 0.2, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyAgentSmith 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:
GeniusOpponentModelAgentX 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_rateused to shrink the weight of an issue whose value changed between two consecutive opponent bids.
- 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.
- 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:
ComponentGBComponent 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_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.
state –
MechanismStategiving 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.
state –
MechanismStategiving 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.
state –
MechanismStategiving 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:
state –
MechanismStategiving 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_callbacksis 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:
state –
MechanismStategiving 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_callbacksis 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:
state –
MechanismStategiving 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_callbacksis 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:
BaseGBMechanismGeneralized 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 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.
- 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,GBNegotiatorA meta-negotiator for GB (General Bargaining) protocols that aggregates multiple
GBNegotiatorinstances.Unlike
GBModularNegotiatorwhich usesGBComponentbehavior pieces,GBMetaNegotiatorworks with completeGBNegotiatorinstances. This allows for ensemble strategies where multiple negotiators can vote on proposals or responses.Subclasses must implement
aggregate_proposalsandaggregate_responsesto define how proposals and responses from sub-negotiators are combined.- Parameters:
negotiators – An iterable of
GBNegotiatorinstances to manage. Mutually exclusive withnegotiator_types.negotiator_types – An iterable of
GBNegotiatortypes 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:
proposecollects proposals from all sub-negotiators and aggregates them.respondcollects 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 usingnegotiator_types, you can optionally providenegotiator_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_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:
NegotiatorMechanismInterfaceGBNMI 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
- max_n_negotiators[source]¶
Maximum allowed number of negotiators in the session. None indicates no limit
- 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
OutcomeSpaceobject. The most common type isCartesianOutcomeSpacewhich 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=…)
The shared allowed number of steps for this negotiation. Applies to all negotiators. None indicates infinity
The shared time limit in seconds for this negotiation session. Applies to all negotiators. inf indicates infinity
- 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
Agentthat owns the negotiator.
Remarks:
- 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:
state –
GBStategiving 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_callbacksis 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:
state –
GBStategiving 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_callbacksis 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:
state –
GBStategiving 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_callbacksis set for the mechanism
- abstractmethod propose(state: GBState, dest: str | None = None) tuple | ExtendedOutcome | None[source]¶
Propose an offer or None to refuse.
- Parameters:
state –
GBStategiving 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
GBStategiving current state of the negotiation.- Returns:
The response to the offer
- Return type:
Remarks:
The default implementation never ends the negotiation
The default implementation asks the negotiator to
propose`() and accepts the `offerif 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:
- 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:
GeniusOfferingPolicyBRAMAgent2 offering strategy from ANAC 2012.
Enhanced version of BRAMAgent with improved statistics tracking.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.BRAMAgent2_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GBRAMAgentOffering(utility_band_tolerance: float = 0.01, concession_rate: float = 0.3, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyBRAMAgent 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:
MechanismStateGBState implementation.
- property base_state: MechanismState[source]¶
Base state.
- Returns:
The result.
- Return type:
- left_negotiators: set[str][source]¶
Set of negotiator IDs that have left the negotiation via LEAVE response.
- classmethod thread_history(history: list[GBState], source: str) list[ThreadState][source]¶
Thread history.
- Parameters:
history – History.
source – Source identifier.
- Returns:
The result.
- Return type:
- 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:
GeniusOpponentModelBayesian 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.
- 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.
- class negmas.gb.GBoulwareOffering(utility_band_tolerance: float = 0.01, e: float = 0.2, k: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyBoulware 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
- 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:
GeniusOfferingPolicyCUHKAgent offering strategy from ANAC 2012.
This strategy uses sophisticated opponent modeling and adaptive concession.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.CUHKAgent_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GCUHKFrequencyModel(no_information_utility: float = 0.5, issue_weights: dict[int, float] = NOTHING, value_counts: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOpponentModelCUHK 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_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.
- class negmas.gb.GChoosingAllBids(utility_band_tolerance: float = 0.01, all_outcomes: list[Outcome] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyChoosingAllBids 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:
GeniusOfferingPolicyConceder 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
- 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:
GeniusOpponentModelDefault 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
utilityfor 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.
- 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:
GeniusOpponentModelFSEGA 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_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.
- 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:
GeniusOfferingPolicyTheFawkes offering strategy from ANAC 2013.
This strategy uses wavelet-based prediction for opponent modeling.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2013.Fawkes_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GGahboninhoOffering(utility_band_tolerance: float = 0.01, concession_exponent: float = 3, max_concession: float = 0.4, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyGahboninho offering strategy from ANAC 2011.
This strategy uses adaptive concession based on opponent behavior analysis.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.Gahboninho_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GHardHeadedFrequencyModel(learning_coef: float = 0.2, learning_value_addition: int = 1, default_value: int = 1, issue_weights: dict[int, float] = NOTHING, value_weights: dict[int, dict] = NOTHING, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOpponentModelHard-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)
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
- 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).
- 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:
GeniusOfferingPolicyHardHeaded 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.
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function and parameters.
- class negmas.gb.GHardlinerOffering(utility_band_tolerance: float = 0.01, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyHardliner 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:
GeniusOfferingPolicyIAMCrazyHaggler 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
- 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:
GeniusOfferingPolicyIAMHaggler2012 offering strategy from ANAC 2012.
Further refined version of IAMhaggler.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.IAMHaggler2012_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GIAMhaggler2010Offering(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:
GeniusOfferingPolicyIAMhaggler2010 offering strategy from ANAC 2010.
This strategy uses sophisticated time-dependent concession with opponent modeling considerations.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.IAMhaggler2010_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GIAMhaggler2011Offering(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:
GeniusOfferingPolicyIAMhaggler2011 offering strategy from ANAC 2011.
Updated version of IAMhaggler with improved time management.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.IAMhaggler2011_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GIAMhagglerBayesianModel(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:
GeniusOpponentModelIAMhaggler 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_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.
- 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:
GeniusOpponentModelInoxAgent opponent model.
This model uses adaptive preference estimation.
Transcompiled from: negotiator.boaframework.opponentmodel.InoxAgent_OM
- 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.
- 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:
GeniusOfferingPolicyInoxAgent offering strategy from ANAC 2013.
This strategy uses adaptive concession based on negotiation dynamics.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2013.InoxAgent_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GLinearOffering(utility_band_tolerance: float = 0.01, k: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyLinear 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
- 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:
GeniusOpponentModelNash 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
- eval(offer: Outcome | None) Value[source]¶
Evaluate opponent utility with Nash-optimal bias.
- Parameters:
offer – The outcome to evaluate.
- Returns:
Estimated opponent utility (0 to 1).
- eval_normalized(offer: Outcome | None, above_reserve: bool = True, expected_limits: bool = True) Value[source]¶
Return normalized utility.
- on_partner_proposal(state: GBState, partner_id: str, offer: Outcome) None[source]¶
Update model based on opponent’s offer.
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Reset the model when preferences change.
- class negmas.gb.GNiceTitForTatOffering(utility_band_tolerance: float = 0.01, max_concession: float = 0.25, concession_exponent: float = 0.8, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyNiceTitForTat offering strategy from ANAC 2011.
This strategy mirrors opponent concessions while maintaining a minimum acceptable utility level.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.NiceTitForTat_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GNozomiOffering(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:
GeniusOfferingPolicyNozomi offering strategy from ANAC 2010.
This strategy uses adaptive concession based on opponent behavior and time pressure.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.Nozomi_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GOMACagentOffering(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:
GeniusOfferingPolicyOMACagent 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_utilityfor 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
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GOppositeModel(no_information_utility: float = 0.5, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOpponentModelOpposite opponent model from Genius.
Assumes the opponent has exactly opposite preferences - what’s good for us is bad for them and vice versa. Returns 1 - our_utility.
This is a pessimistic assumption useful for competitive scenarios.
Transcompiled from: negotiator.boaframework.opponentmodel.OppositeModel
- eval(offer: Outcome | None) Value[source]¶
Return opposite utility (1 - our utility).
- Parameters:
offer – The outcome to evaluate.
- Returns:
1 - our_utility for the outcome.
- eval_normalized(offer: Outcome | None, above_reserve: bool = True, expected_limits: bool = True) Value[source]¶
Return normalized opposite utility.
- on_partner_proposal(state: GBState, partner_id: str, offer: Outcome) None[source]¶
No-op - this model uses our utility function inversely.
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
No special initialization needed.
- class negmas.gb.GPerfectModel(ufun: BaseUtilityFunction | None = None, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
PeekingOpponentModelPerfect (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 trueBaseUtilityFunctionasufun(at construction or later,model.ufun = ...);eval/eval_normalizedthen delegate to it. When noufunis set it falls back to0.5(uniform).Implemented as a thin alias of
PeekingOpponentModel(the working oracle ingb.components.models.ufun) so the two share one code path; the only addition is the multilateral per-partnerprivate_infoupdate inherited from the Genius model family.Transcompiled from: negotiator.boaframework.opponentmodel.PerfectModel
- class negmas.gb.GRandomOffering(utility_band_tolerance: float = 0.01, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyRandom 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:
GeniusOpponentModelScalable 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_rateused 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.
- 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:
GeniusOpponentModelSmith 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
- 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:
GeniusOpponentModelTheFawkes opponent model.
This model uses wavelet-based analysis for opponent preference estimation.
Transcompiled from: negotiator.boaframework.opponentmodel.TheFawkes_OM
- 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.
- 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).
- 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:
GeniusOfferingPolicyTheNegotiator offering strategy from ANAC 2011.
This strategy uses time-dependent concession with adaptive parameters.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2011.TheNegotiator_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GTheNegotiatorReloadedOffering(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:
GeniusOfferingPolicyTheNegotiatorReloaded offering strategy from ANAC 2012.
Enhanced version of TheNegotiator with improved time management.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2012.TheNegotiatorReloaded_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GTimeDependentOffering(utility_band_tolerance: float = 0.01, e: float = 0.2, k: float = 0.0, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOfferingPolicyTime-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
- 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:
GeniusOpponentModelUniform 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:
GeniusOfferingPolicyValueModelAgent 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.
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GWorstModel(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GeniusOpponentModelWorst-case opponent model.
This model assumes the opponent has opposite preferences to ours.
Transcompiled from: negotiator.boaframework.opponentmodel.WorstModel
- 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.
- 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:
GeniusOfferingPolicyYushu offering strategy from ANAC 2010.
This strategy uses a sigmoid-like concession curve.
Transcompiled from: negotiator.boaframework.offeringstrategy.anac2010.Yushu_Offering
- on_preferences_changed(changes: list[PreferencesChange]) None[source]¶
Initialize utility function.
- class negmas.gb.GeniusAcceptancePolicy(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyBase class for Genius acceptance policies.
- class negmas.gb.GeniusOfferingPolicy(utility_band_tolerance: float = 0.01, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
OfferingPolicyBase 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 to0.01.
- class negmas.gb.GeniusOpponentModel(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GBComponent,BaseUtilityFunctionBase 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:
MAPNegotiatorA 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
Agentthat owns the negotiator.alpha – ACnext utility scale (see
ACNext).beta – ACnext utility offset (see
ACNext).initial_utility – Bezier control point at
t=0.NaNmeans auto (seeHybridOfferingPolicy).concession_ratio – Middle Bezier control point.
NaNmeans auto.final_utility – Bezier control point at
t=1.NaNmeans auto (derived from the domain size).empathy_score – How strongly the opponent’s concession moves our target.
NaNmeans auto.auto_initial_utility –
initial_utilityused in auto mode.auto_concession_ratio –
concession_ratioused in auto mode.auto_empathy_score –
empathy_scoreused 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 derivefinal_utilityin auto mode.final_utility_floor –
final_utilityin 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
HybridOfferingPolicyto use instead of building one from the arguments above (which are then ignored).acceptance – A ready
AcceptancePolicyto use instead ofACNext.
- Remarks:
Every hyperparameter of
HybridOfferingPolicyis 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:
OfferingPolicyHybridOffering 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: useauto_initial_utility.concession_ratio – Middle Bezier control point.
NaN(default) means auto: useauto_concession_ratio.final_utility – Bezier control point at
t=1.NaN(default) means auto: derive it from the domain size usingfinal_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: useauto_empathy_score.auto_initial_utility – Value used for
initial_utilityin auto mode.auto_concession_ratio – Value used for
concession_ratioin auto mode.auto_empathy_score – Value used for
empathy_scorein 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 whosemax_domain_sizeexceeds the (clipped) domain size suppliesfinal_utilityin auto mode.final_utility_floor –
final_utilityused in auto mode when the domain is larger than every threshold infinal_utility_ladder.behavior_min_offers – Minimum number of offers received before the behaviour-based component is mixed in (pure time-based before that).
enumeration_levels –
levelsused to discretize a continuous outcome space when enumerating candidate outcomes.enumeration_max_cardinality –
max_cardinalityused 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.
- 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.
- 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.
- class negmas.gb.KDEWeightUFunModel(above_reserve: bool = True, levels: int = 10, threshold: float = 0.1, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
_SequentialWeightUFunModelIssue 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_distanceper 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).
- 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:
ConcessionRecommenderA 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
Truethe agent is guaranteed to concede in the first stepinverter – Used only if
must_concedeisTrueto determine the lowest level of concession possibleno_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(theinitial_concession/must_concedelogic no longer applies).min_concession_eps – Numerical slack added to the smallest representable utility gap when
must_concedeforces a minimal concession.
- inverter: UtilityInverter | None[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:
OfferOrientedSelectorSelects the offer nearest the partner’s last offer
- class negmas.gb.LastOfferOrientedTBNegotiator(*args, distance_fun: ~typing.Callable[[tuple, tuple, ~negmas.outcomes.protocols.OutcomeSpace | None], float] = <function generalized_minkowski_distance>, **kwargs)[source]¶
Bases:
FirstOfferOrientedTBNegotiatorA 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:
AcceptancePolicyAccepts from a list of predefined outcomes
- Remarks:
- 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.
- 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,GBNegotiatorA 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:
MAPNegotiatorA 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_outcomesnoracceptance_probabilitiesis 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_outcomesis passed as None, it is considered the same asacceptable_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:
OfferingPolicyOffers from a given list of outcomes
- class negmas.gb.LinearTBNegotiator(*args, **kwargs)[source]¶
Bases:
TimeBasedConcedingNegotiatorA time-based negotiator that concedes linearly.
Uses a
PolyAspirationcurve with exponent 1 ("linear") andstochastic=False.
- class negmas.gb.LocalEvaluationStrategy[source]¶
Bases:
EvaluationStrategyLocalEvaluation 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:
UFunModelClassifies 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 profiletis assumed to offer outcomeowith probability proportional to its Luce numberL_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_mapis 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
evalreturns 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_normalized(offer: Outcome | None, above_reserve: bool = True, expected_limits: bool = True) Value[source]¶
Eval normalized (the model already returns values in
[0, 1]).
- 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]¶
- class negmas.gb.MedianOfferSelector(*args, **kwargs)[source]¶
Bases:
OfferSelectorSelects the outcome with the median utility value.
- class negmas.gb.MiCRONegotiator(*args, accept_same: bool = True, **kwargs)[source]¶
Bases:
MAPNegotiatorRational 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
Agentthat owns the negotiator.accept_same – Accept an offer equal in utility to our own next offer.
offering – A ready
MiCROOfferingPolicyto use instead of the default.acceptance – A ready
AcceptancePolicyto use instead ofMiCROAcceptancePolicy.
- 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:
OfferingPolicyMiCROOffering policy implementation.
- best_offer_so_far() Outcome | ExtendedOutcome | None[source]¶
Returns the highest-utility outcome offered so far, or None if none sent.
- 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.
- 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:
TimeBasedNegotiatorA 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:
TimeBasedNegotiatorA 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:
TimeBasedNegotiatorA 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:
PartnerOffersOrientedSelectorOrients 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
- class negmas.gb.MyBestConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
UtilBasedConcensusOfferingPolicyOffers my best outcome from the list of stratgies (different strategy every time).
- class negmas.gb.MyWorstConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
UtilBasedConcensusOfferingPolicyOffers my worst outcome from the list of stratgies (different strategy every time) based on outcome utilities
- 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:
MAPNegotiatorImplements 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.0is standard tit-for-tat. Positive values make the negotiator concede faster; negative values make it concede slower. Defaults to0.0.stochastic (bool) – If
True, offers are randomized within the band determined by the current concession (which reflects the opponent’s concession). IfFalse(default), the worst outcome in the band is proposed. Defaults toFalse.punish (bool) – If
True, the agent punishes a partner who does not concede by requiring higher utilities. Defaults toFalse.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 as0.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 toFalse.must_concede (bool) – If
True(default) the negotiator is guaranteed to make a (minimal) concession on its second call. Forwarded toKindConcessionRecommender.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 toKindConcessionRecommender.min_concession_eps (float) – Numerical slack added to the smallest representable utility gap when
must_concedeforces a minimal concession. Forwarded toKindConcessionRecommender.**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:
AcceptancePolicyUses 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:
objectAll 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:
Shared limits (
shared_time_limit,shared_n_steps): Apply to all negotiatorsPrivate limits (
private_time_limit,private_n_steps): Apply to individual negotiatorsEffective 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)
- annotation: dict[str, Any][source]¶
An arbitrary annotation as a
dict[str, Any]that is always available for all negotiators
- property atomic_steps: bool[source]¶
Whether steps in this mechanism are atomic (cannot be interrupted).
- property cartesian_outcome_space: CartesianOutcomeSpace[source]¶
Returns the
outcome_spaceas aCartesianOutcomeSpaceor raises aValueErrorif that was not possible.Remarks:
Useful for negotiators that only work with
CartesianOutcomeSpaces (i.e.GeniusNegotiator)
- 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
- 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:
- property issues: tuple[Issue, ...][source]¶
The negotiation issues defining the outcome space dimensions.
- max_n_negotiators: int | None[source]¶
Maximum allowed number of negotiators in the session. None indicates no limit
- 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__
- 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
OutcomeSpaceobject. The most common type isCartesianOutcomeSpacewhich 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 participants: list[NegotiatorDescriptor][source]¶
Information about all negotiators participating in this negotiation.
- Returns:
List of participant information including IDs and preferences
- Return type:
- 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_outcomes(n: int = 1) list[tuple][source]¶
A set of random outcomes from the outcome-space of this negotiation
- property requirements: dict[source]¶
The protocol requirements
- Returns:
A dict of str/Any pairs giving the requirements
The shared allowed number of steps for this negotiation. Applies to all negotiators. None indicates infinity
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
AgentMechanismInterfaceobject, 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
- class negmas.gb.NegotiatorOfferingPolicy(*, negotiator: GBNegotiator | None = None, proposer: GBNegotiator)[source]¶
Bases:
OfferingPolicyUses a negotiator as an offering strategy
- proposer: GBNegotiator[source]¶
- class negmas.gb.NiceNegotiator(*args, **kwargs)[source]¶
Bases:
MAPNegotiatorOffers 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
Agentthat 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:
MAPNegotiatorThe Nice Tit for Tat agent (Baarslag, Hindriks & Jonker, 2013).
A MAP negotiator combining the
NiceTitForTatOfferingPolicybidding strategy (reciprocate in the agent’s own utility while aiming for a bargaining-solution point, and make offers attractive to the opponent) with theACCombiacceptance 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_ufunproperty (read by the offering policy viaself.negotiator.opponent_ufun), populated automatically from the model passed here. You can either:pass a ready opponent model as
opponent_model(anyUFunModel, e.g. a learnedFrequencyLinearUFunModel, an oraclePeekingOpponentModelfor tests, or aZeroSumModel), orpass an opponent-model type as
opponent_model_type(aUFunModelsubclass), constructed with no required args, orpass 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. UseFrequencyUFunModelinstead when the opponent’s ufun is not known to be linear-additive.
- Parameters:
opponent_model – A ready
UFunModelto use as the opponent model. Takes precedence overopponent_model_type.opponent_model_type – A
UFunModelsubclass to instantiate as the default opponent model. Defaults toFrequencyLinearUFunModel.target – Bargaining solution the offering strategy aims for — one of
"nash"(default),"kalai","kalai_smorodinsky"/"ks","max_welfare","max_relative_welfare". Forwarded toNiceTitForTatOfferingPolicy.sample_size – Forwarded to
NiceTitForTatOfferingPolicy.max_cardinality – Forwarded to
NiceTitForTatOfferingPolicy.nash_refresh – Forwarded to
NiceTitForTatOfferingPolicy.stochastic – Forwarded to
NiceTitForTatOfferingPolicy.levels – Forwarded to
NiceTitForTatOfferingPolicy.nash_min – Forwarded to
NiceTitForTatOfferingPolicy.nash_multiplier_base
nash_multiplier_gap_weight
default_nash_utility
: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
ParetoSamplerimplementation 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(theUFunModelin 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).
- 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:
OfferingPolicyThe 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:Cooperate first. Initially the agent offers its best outcome (it never defects first).
Estimate ``my_nash``. Using the opponent model (
negotiator.opponent_ufun) and the calculators innegmas.preferences.ops, estimate the chosen bargaining solution and take the agent’s own utilityp_meat 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 atnash_min(0.5by default, as in the reference); for other targets only at the reserved value.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 tomy_nash. The agent concedes the same fraction of its own gap from1down tomy_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 towardmy_nash— this is what lets a mirror match concede and agree instead of deadlocking at maximum utility.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 queryargmax_{u_me >= target} u_opp, answered by aParetoSampler(pareto_sampler_type) built on the normalized agent ufun with the opponent model as the opponent ufun (viaufun.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’smakeAppropriate), so consensus forms as soon as the opponent’s standing offer beats our plan.
The opponent model is accessed through
self.negotiator.opponent_ufun(aUFunModel), which may be provided to the negotiator or left to a default (seeNiceTitForTatNegotiator).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
Trueand 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 innegmas.preferences.ops.nash_min – Lower clamp on the estimated
my_nashtarget utility, applied only for the"nash"target (the reference agent never asks for less than0.5). For other solution concepts the target is floored at the reserved value instead, so a legitimately lowerp_meis not inflated.pareto_sampler_type – The
ParetoSamplerimplementation used for step iv (the opponent-attractive trade-off query). Defaults toDefaultParetoSampler(AdaptiveParetoSampler), which uses the exactBruteForceParetoSampleron small outcome spaces and a scalable backend on large ones. Pass a specific sampler type (e.g.BruteForceParetoSampler, orIPSParetoSamplerfor very large additive domains) to override. The sampler is queried each round viabest_for_opponentwith 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(aUFunModelorNone). When it isNonethe 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
makeAppropriatein the reference).
- pareto_sampler_type: type[ParetoSampler][source]¶
- class negmas.gb.NoneOfferingPolicy(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
OfferingPolicyAlways offers
Nonewhich means it never gets an agreement.
- class negmas.gb.OfferBest(best: Outcome | None = None, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
OfferingPolicyOffers Only the best outcome.
- Remarks:
You can pass the best outcome if you know it as
bestotherwise 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:
OfferSelectorSelects the nearest outcome to the pivot outcome which is updated before responding
- class negmas.gb.OfferSelector(*args, **kwargs)[source]¶
Bases:
OfferSelectorProtocol,GBComponentCan select the best offer in some sense from a list of offers based on an inverter
- class negmas.gb.OfferSelectorProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolCan 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:
OfferingPolicyOffers outcomes that are in the given top fraction or top
k. If neither is given it reverts to only offering the best outcome- Remarks:
- on_preferences_changed(changes: list[PreferencesChange])[source]¶
Computes the set of top outcomes based on fraction and k constraints.
- class negmas.gb.OfferingPolicy(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
GBComponentOffering policy implementation.
- propose(state: GBState, dest: str | None = None) Outcome | ExtendedOutcome | None[source]¶
Propose an offer or None to refuse.
- Parameters:
state –
GBStategiving 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:
OfferSelectorSelects 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:
GBMechanismParallelGB mechanism.
- class negmas.gb.PartnerOffersOrientedSelector(distance_fun: DistanceFun = <function generalized_minkowski_distance>, offer_filter: OfferFilterProtocol = <function NoFiltering>, **kwargs)[source]¶
Bases:
OutcomeSetOrientedSelectorOrients offes toward the set of past opponent offers
- class negmas.gb.PeekingOpponentModel(ufun: BaseUtilityFunction | None = None, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
UFunModelAn oracle opponent model that wraps the opponent’s true utility function.
Intended for testing/analysis: the model “peeks” at the opponent’s actual
BaseUtilityFunctionand delegateseval/eval_normalizedto it. This lets a Nice Tit for Tat agent (or any consumer ofopponent_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:
Unlike
FrequencyLinearUFunModel/FrequencyUFunModel, this model does not learn; it simply reads the opponent’s true utility. Use it only in tests/simulation where the opponent’s ufun is known.
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.5if 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.5if 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:
AcceptancePolicyResponds randomly with configurable probabilities for accept, reject, end, or no response.
- 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:
MAPNegotiatorRandomAlwaysAccepting 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:
ConcensusOfferingPolicyOffers 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.
- class negmas.gb.RandomNegotiator(p_acceptance=0.15, p_rejection=0.75, p_ending=0.1, can_propose=True, **kwargs)[source]¶
Bases:
MAPNegotiatorA 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:
OfferSelectorSelects a random outcome from the candidate set.
- class negmas.gb.RandomOfferingPolicy(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
OfferingPolicyOffers random outcomes from the negotiation outcome space.
- class negmas.gb.RejectAlways(*, negotiator: GBNegotiator | None = None)[source]¶
Bases:
AcceptancePolicyRejects everything
- class negmas.gb.RepeatFinalOfferOnly(n: int = 9223372036854775807)[source]¶
Bases:
LocalOfferingConstraintRepeatFinalOfferOnly implementation.
- class negmas.gb.RepeatLastOfferOnly(n: int = 9223372036854775807)[source]¶
Bases:
LocalOfferingConstraintRepeatLastOfferOnly 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.
- class negmas.gb.ResponseType(*values)[source]¶
Bases:
IntEnumPossible responses to offers during negotiation.
- class negmas.gb.SerialGBMechanism(*args, **kwargs)[source]¶
Bases:
GBMechanismSerialGB 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:
SerialGBMechanismImplements 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:
EvaluationStrategyImplements the Tentative-Accept Unique-Offers Generalized Bargaining Protocol.
- class negmas.gb.TAUMechanism(*args, accept_in_any_thread: bool = True, parallel: bool = True, **kwargs)[source]¶
Bases:
BaseGBMechanismTAU (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:
AcceptancePolicyAn acceptance strategy that concedes as much as the partner (or more)
- recommender: ConcessionRecommender[source]¶
- class negmas.gb.TFTOfferingPolicy(partner_ufun: UFunModel, recommender: ConcessionRecommender, stochastic: bool = False, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
OfferingPolicyAn 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.
- recommender: ConcessionRecommender[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:
objectThreadState implementation.
- 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:
TimeBasedNegotiatorA time-based conceding negotiator using an
Aspirationcurve.This is the main entry point for aspiration-based time-only negotiators. It accepts an
Aspirationcurve (or a string/float shorthand) for both offering and accepting, plus astarting_utilitythat controls the first offer’s utility level.- Parameters:
offering_curve (Aspiration | str | float) – An
Aspirationcurve (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
Aspirationcurve (or string/float) controlling the acceptance threshold. IfNoneor falsy, the offering curve is reused.starting_utility (float) – The relative utility (in
[0, 1]) at which the first offer is made. Only used whenoffering_curveis a string/float (not a pre-builtAspirationobject). Defaults to1.0(start at the best outcome).**kwargs – Forwarded to
TimeBasedNegotiator(e.g.stochastic,ufun_inverter,eps,offer_selector).
- Remarks:
BoulwareTBNegotiator,LinearTBNegotiator, andConcederTBNegotiatorare convenience subclasses that fixoffering_curveto"boulware","linear", and"conceder"respectively (withstochastic=False).AspirationNegotiatoris a simplified interface to this class withpresortandtoleranceparameters.
- 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:
UtilBasedNegotiatorA 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
TimeCurveobjects mapping relative timet ∈ [0, 1]to a utility range. At each step, the negotiator asks the inverter for an outcome within the offering curve’s range (forpropose) or checks whether the opponent’s offer falls within the accepting curve’s range (forrespond).- 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. IfNone, 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
NaiveTitForTatNegotiatoror theOfferOrientedTBNegotiatorfamily.
- class negmas.gb.TimeBasedOfferingPolicy(curve: PolyAspiration = NOTHING, stochastic: bool = False, sorter: InverseUFun | None = None, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
OfferingPolicyTimeBasedOffering 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]¶
- class negmas.gb.TopFractionNegotiator(min_utility=0.95, top_fraction=0.05, best_first=True, can_propose=True, **kwargs)[source]¶
Bases:
MAPNegotiatorOffers and accepts only one of the top outcomes for the negotiator.
- Parameters:
name – Negotiator name
parent – Parent controller if any
can_propose – If
Falsethe negotiator will never propose but can only acceptpreferences – 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_fractionandmin_utilityowner – The
Agentthat owns the negotiator.
- class negmas.gb.ToughNegotiator(can_propose=True, **kwargs)[source]¶
Bases:
MAPNegotiatorAccepts and proposes only the top offer (i.e. the one with highest utility).
- Parameters:
- 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,BaseUtilityFunctionA
SAOComponentthat 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 toSAOComponentto update the model.A
UFunModelis a full stand-in for a `BaseUtilityFunction`: anywhere a ufun is accepted (e.g.pareto_frontier, the bargaining-solution calculators innegmas.preferences.ops, or aParetoSampler) aUFunModelcan be passed without errors. Concrete subclasses are typically declared with@defineand therefore skipBaseUtilityFunction.__init__, so the state it would have set up (_invalid_value,_constraints,_reserved_valueand 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
UFunModelmodels 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@definesubclasses do by skippingBaseUtilityFunction.__init__) lets the model be used wherever a ufun is expected — e.g.minmax,pareto_frontier, and the bargaining-solution calculators all readoutcome_space.
- class negmas.gb.UnanimousConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
ConcensusOfferingPolicyOffers 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:
LocalOfferingConstraintUniqueOffers implementation.
- class negmas.gb.UtilBasedConcensusOfferingPolicy(strategies: list[OfferingPolicy], *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
ConcensusOfferingPolicy,ABCOffers 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.
- 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:
GBNegotiatorA negotiator that bases its decisions on the utility value of outcomes only.
It uses an
InverseUFun(via theUtilityInvertercomponent) to find outcomes with utilities in a desired range, and an optionalOfferSelectorto pick among multiple candidate outcomes.- Parameters:
stochastic (bool) – If
False(default), the inverter’sworst_inis used so the negotiator proposes the outcome with the lowest utility still within its aspiration band (i.e. just above the aspiration level). IfTrue,one_inis 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
InverseUFunfrom the negotiator’s utility function. IfNone, aDefaultInverseUtilityFunction(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
NoneandstochasticisTrue, a random candidate is chosen. IfNoneandstochasticisFalse,worst_inis 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_inverterisNone.eps (float) – A tolerance around the utility range used when sampling outcomes (passed to the inverter).
- Remarks:
proposerecovers from aNoneinverter 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
Noneproposal (which would otherwise break the SAO mechanism — seenegmas.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:
- 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:
GBComponentRecommends 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
tolerancefrom 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.
- class negmas.gb.UtilityInverter(*args, offer_selector: OfferSelectorProtocol | Literal['min'] | Literal['max'] | None = None, **kwargs)[source]¶
Bases:
GBComponentA 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.
- set_negotiator(negotiator: GBNegotiator) None[source]¶
Attaches this component and its recommender to a negotiator.
- class negmas.gb.ValueDifferenceUFunModel(above_reserve: bool = True, levels: int = 10, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
_SequentialWeightUFunModelIssue 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 a0/1indicator. The running mean normalized differenced_igives the issue weightw_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 neutral0.5before any offer is observed.
AI Generated (Carbonneau & Vahidov value-difference issue weights).
- class negmas.gb.WABNegotiator(*args, **kwargs)[source]¶
Bases:
MAPNegotiatorWasting 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
Agentthat owns the negotiator.
- class negmas.gb.WANNegotiator(*args, **kwargs)[source]¶
Bases:
MAPNegotiatorWasting 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
Agentthat owns the negotiator.
- class negmas.gb.WARNegotiator(*args, **kwargs)[source]¶
Bases:
MAPNegotiatorWasting 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
Agentthat owns the negotiator.
- class negmas.gb.WAROfferingPolicy(next_indx: int = 0, sorter: InverseUFun | None = None, *, negotiator: GBNegotiator | None = None)[source]¶
Bases:
OfferingPolicyWAROffering policy implementation.
- 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:
OfferSelectorSelects 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:
UFunModelAssumes 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))
- eval(offer: Outcome) Value[source]¶
Eval.
- Parameters:
offer – Offer being considered.
- Returns:
The result.
- Return type:
- 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:
- on_preferences_changed(changes: list[PreferencesChange])[source]¶
On preferences changed.
- Parameters:
changes – Changes.
- 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’.