from __future__ import annotations
import time
from ..common import MechanismState, Value
from ..outcomes import Outcome
from .base import BaseElicitor
__all__ = ["DummyElicitor", "FullKnowledgeElicitor"]
[docs]
class DummyElicitor(BaseElicitor):
"""
A dummy elicitation algorithm that does not do any elicitation.
"""
[docs]
def utility_on_rejection(self, outcome: Outcome, state: MechanismState) -> Value:
return self.reserved_value
[docs]
def can_elicit(self) -> bool:
return True
[docs]
def elicit_single(self, state: MechanismState):
return False
[docs]
def init_elicitation(
self, preferences: IPUtilityFunction | Distribution | None, **kwargs
):
super().init_elicitation(preferences=preferences, **kwargs)
strt_time = time.perf_counter()
self.offerable_outcomes = self._nmi.outcomes
self._elicitation_time += time.perf_counter() - strt_time
[docs]
class FullKnowledgeElicitor(BaseElicitor):
"""
An elicitor that does not *need* to do any elicitation because it has full access
to the user ufun.
"""
[docs]
def utility_on_rejection(self, outcome: Outcome, state: MechanismState) -> Value:
return self.reserved_value
[docs]
def can_elicit(self) -> bool:
return True
[docs]
def elicit_single(self, state: MechanismState):
return False
[docs]
def init_elicitation(
self, preferences: IPUtilityFunction | Distribution | None, **kwargs
):
super().init_elicitation(preferences=self.user.ufun)
strt_time = time.perf_counter()
self.offerable_outcomes = self._nmi.outcomes
self._elicitation_time += time.perf_counter() - strt_time