From e39989fb10ac032f699760a956da824fb5a2ed38 Mon Sep 17 00:00:00 2001 From: Mohcine Chraibi Date: Tue, 22 Oct 2024 11:37:56 +0900 Subject: [PATCH] Constrain number of high values to number of agents --- src/motivation_model.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/motivation_model.py b/src/motivation_model.py index e26338a..b56b17c 100644 --- a/src/motivation_model.py +++ b/src/motivation_model.py @@ -113,6 +113,12 @@ def __post_init__(self) -> None: if self.seed is not None: random.seed(self.seed) + if self.number_high_value > self.nagents: + logging.warning( + f"Configuration error: {self.number_high_value} > {self.nagents}. Change value to match!" + ) + self.number_high_value = self.nagents + high_value_agents = set(random.sample(self.agent_ids, self.number_high_value)) for n in self.agent_ids: if n in high_value_agents: