negmas.models.acceptance

Acceptance modeling.

class negmas.models.acceptance.AcceptanceModelType(*values)[source]

Bases: Enum

Represents types of acceptance models.

ACCEPTANCE_MODEL_AUTO = -1[source]
ACCEPTANCE_MODEL_BINARY = 11[source]
ACCEPTANCE_MODEL_BINARY_HOMOGENEOUS = 9[source]
ACCEPTANCE_MODEL_BINARY_HOMOGENEOUS_CONST = 8[source]
ACCEPTANCE_MODEL_BINARY_MONOTONIC = 10[source]
ACCEPTANCE_MODEL_BINARY_STATIC = 7[source]
ACCEPTANCE_MODEL_GENERAL = 4[source]
ACCEPTANCE_MODEL_HOMOGENEOUS = 2[source]
ACCEPTANCE_MODEL_HOMOGENEOUS_CONST = 1[source]
ACCEPTANCE_MODEL_MONOTONIC = 3[source]
ACCEPTANCE_MODEL_RANDOM = -100[source]
ACCEPTANCE_MODEL_STATIC = 0[source]
class negmas.models.acceptance.AdaptiveDiscreteAcceptanceModel(outcomes: Iterable[tuple], n_negotiators: int = 2, prob: float | list[float] = 0.5, end_prob=0.0, p_accept_after_reject=0.0, p_reject_after_accept=0.0, rejection_discount=0.98, rejection_delta=0.0, not_offering_rejection_ratio=0.75)[source]

Bases: DiscreteAcceptanceModel

An acceptance model that adapts its probability estimates based on observed rejections and offers.

The model starts with initial probabilities and updates them when outcomes are rejected (decreasing probability) or offered by opponents (increasing probability).

acceptance_probabilities()[source]

Probability of acceptance for all outcomes

classmethod from_negotiation(nmi: NegotiatorMechanismInterface, prob: float | list = 0.5, end_prob=0.0, p_accept_after_reject=0.0, p_reject_after_accept=0.0) AdaptiveDiscreteAcceptanceModel[source]

Creates an acceptance model from a negotiation mechanism interface.

Parameters:
  • nmi – The negotiator-mechanism interface providing negotiation context.

  • prob – Initial acceptance probability, either a single value or list per outcome.

  • end_prob – Probability used at negotiation end.

  • p_accept_after_reject – Minimum probability after a rejection is observed.

  • p_reject_after_accept – Probability of rejection after an acceptance.

Returns:

A new model initialized from the negotiation.

Return type:

AdaptiveDiscreteAcceptanceModel

probability_of_acceptance_indx(outcome_index: int) float[source]

Returns the estimated acceptance probability for the outcome at the given index.

Parameters:

outcome_index – Index into the outcomes list.

Returns:

The current acceptance probability estimate.

Return type:

float

update_offered_indx(outcome_index: int)[source]

Updates acceptance probability when opponent offers the outcome at the given index.

update_rejected_indx(outcome_index: int)[source]

Reduces acceptance probability for the outcome at the given index after observing rejection.

class negmas.models.acceptance.AggregatingDiscreteAcceptanceModel(outcomes: Collection[tuple], models: list[DiscreteAcceptanceModel], weights: list[float] | None = None)[source]

Bases: DiscreteAcceptanceModel

An acceptance model that combines multiple models using weighted averaging.

The final acceptance probability is computed as a weighted sum of the probabilities from each constituent model.

probability_of_acceptance_indx(outcome_index: int) float[source]

Returns weighted average of acceptance probabilities from all models.

Parameters:

outcome_index – Index into the outcomes list.

Returns:

Weighted average probability clamped to [0, 1].

Return type:

float

update_offered_indx(outcome_index: int)[source]

Propagates offer update to all constituent models.

update_rejected_indx(outcome_index: int)[source]

Propagates rejection update to all constituent models.

class negmas.models.acceptance.DiscreteAcceptanceModel(outcomes: Iterable[tuple])[source]

Bases: ABC

Abstract base class for modeling opponent acceptance behavior over discrete outcomes.

This model estimates the probability that opponents will accept each possible outcome in a negotiation, and updates these estimates based on observed behavior.

acceptance_probabilities() ndarray[source]

Returns the acceptance probabilities for all outcomes as an array.

Returns:

Array of acceptance probabilities, one per outcome.

Return type:

np.ndarray

probability_of_acceptance(outcome: tuple)[source]

Returns the estimated probability that opponents will accept the given outcome.

Parameters:

outcome – The outcome to evaluate.

abstractmethod probability_of_acceptance_indx(outcome_index: int) float[source]

Returns the estimated probability that opponents will accept the outcome at the given index.

Parameters:

outcome_index – Index into the outcomes list.

Returns:

Probability in [0, 1] that the outcome will be accepted.

Return type:

float

update_accepted(outcome)[source]

Updates the model after observing acceptance of the given outcome.

Parameters:

outcome – The outcome that was accepted.

update_offered(outcome)[source]

Updates the model after observing an offer of the given outcome.

Parameters:

outcome – The outcome that was offered.

abstractmethod update_offered_indx(outcome_index: int)[source]

Updates the model after observing an offer of the outcome at the given index.

Parameters:

outcome_index – Index into the outcomes list for the offered outcome.

update_rejected(outcome: tuple)[source]

Updates the model after observing a rejection of the given outcome.

Parameters:

outcome – The outcome that was rejected.

abstractmethod update_rejected_indx(outcome_index: int)[source]

Updates the model after observing a rejection of the outcome at the given index.

Parameters:

outcome_index – Index into the outcomes list for the rejected outcome.

class negmas.models.acceptance.PeekingDiscreteAcceptanceModel(outcomes: Collection[Outcome], opponents: SAONegotiator | Collection[SAONegotiator])[source]

Bases: DiscreteAcceptanceModel

An acceptance model that queries opponents directly to determine acceptance.

This model “peeks” at opponent negotiators by calling their respond_ method to get their actual response to each outcome. Returns 1.0 if all opponents accept, 0.0 otherwise.

probability_of_acceptance_indx(outcome_index: int) float[source]

Queries all opponents and returns 1.0 if all accept, 0.0 otherwise.

Parameters:

outcome_index – Index into the outcomes list.

Returns:

1.0 if all opponents accept, 0.0 if any rejects.

Return type:

float

update_offered_indx(outcome_index: int)[source]

No-op: peeking model queries opponents directly.

update_rejected_indx(outcome_index: int)[source]

No-op: peeking model queries opponents directly.

class negmas.models.acceptance.PeekingProbabilisticDiscreteAcceptanceModel(outcomes: Collection[Outcome], opponents: SAONegotiator | Collection[SAONegotiator])[source]

Bases: DiscreteAcceptanceModel

An acceptance model that estimates probability using opponents’ utility functions.

This model “peeks” at opponent utility functions and returns the product of their utilities for each outcome as the acceptance probability.

probability_of_acceptance_indx(outcome_index: int) float[source]

Returns the product of opponent utilities as the acceptance probability.

Parameters:

outcome_index – Index into the outcomes list.

Returns:

Product of all opponent utilities for this outcome.

Return type:

float

update_offered_indx(outcome_index: int)[source]

No-op: probabilistic peeking model uses utility functions directly.

update_rejected_indx(outcome_index: int)[source]

No-op: probabilistic peeking model uses utility functions directly.

class negmas.models.acceptance.RandomDiscreteAcceptanceModel(outcomes: Collection[tuple], **kwargs)[source]

Bases: DiscreteAcceptanceModel

An acceptance model that returns random probabilities, ignoring observed behavior.

Useful as a baseline or for experimentation with uncertainty effects.

probability_of_acceptance_indx(outcome_index: int) float[source]

Returns a random acceptance probability between 0 and 1.

Parameters:

outcome_index – Index into the outcomes list (ignored).

Returns:

A random probability value.

Return type:

float

update_offered_indx(outcome_index: int)[source]

No-op: random model does not learn from offers.

update_rejected_indx(outcome_index: int)[source]

No-op: random model does not learn from rejections.

class negmas.models.acceptance.UncertainOpponentModel(outcomes: Collection[Outcome], opponents: SAONegotiator | Collection[SAONegotiator], uncertainty: float = 0.5, adaptive: bool = False, rejection_discount: float = 0.95, rejection_delta: float = 0.0, constant_base=True, accesses_real_acceptance=False)[source]

Bases: AggregatingDiscreteAcceptanceModel

A model for which the uncertainty about the acceptance probability of different negotiators is controllable.

This is not a realistic model but it can be used to experiment with effects of this uncertainty on different negotiation related algorithms (e.g. elicitation algorithms)

Parameters:
  • outcomes – The list of possible outcomes

  • uncertainty (float) – The uncertainty level. Zero means no uncertainty and 1.0 means maximum uncertainty

  • adaptive (bool) – If true then the random part will learn from experience with the opponents otherwise it will not.

  • rejection_discount – Only effective if adaptive is True. See AdaptiveDiscreteAcceptanceModel

  • rejection_delta – Only effective if adaptive is True. See AdaptiveDiscreteAcceptanceModel