Source code for negmas.gb.constraints.unique

from __future__ import annotations
from ..common import ThreadState
from .base import LocalOfferingConstraint

__all__ = ["UniqueOffers"]


[docs] class UniqueOffers(LocalOfferingConstraint):
[docs] def __call__(self, state: ThreadState, history: list[ThreadState]) -> bool: offer = state.new_offer if not offer: return False return offer not in {_.new_offer for _ in history}