From 3e5f727edab5500ddd5574021e0c75d4b3163fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Mon, 14 Oct 2024 13:46:54 +0200 Subject: [PATCH] bugfix: correct [] initialization in dataclass --- src/hanabi/live/instance_finder.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hanabi/live/instance_finder.py b/src/hanabi/live/instance_finder.py index 8c8ed4f..eaf1048 100644 --- a/src/hanabi/live/instance_finder.py +++ b/src/hanabi/live/instance_finder.py @@ -96,14 +96,17 @@ def get_decks_for_all_seeds(): @dataclass class SolutionData: + infeasibility_reasons: Optional[List[deck_analyzer.InfeasibilityReason]] seed: str = None time_ms: int = 0 feasible: Optional[bool] = None solution: Optional[GameState] = None - infeasibility_reasons: Optional[List[deck_analyzer.InfeasibilityReason]] = None num_remaining_cards: Optional[int] = None skipped: bool = False + def __init__(self): + self.infeasibility_reasons = [] + def solve_instance(instance: hanab_game.HanabiInstance)-> SolutionData: retval = SolutionData() @@ -114,7 +117,7 @@ def solve_instance(instance: hanab_game.HanabiInstance)-> SolutionData: retval.feasible = False retval.infeasibility_reasons = result return retval - for num_remaining_cards in [0, 20]: + for num_remaining_cards in [0, 10, 20]: # logger.info("trying with {} remaining cards".format(num_remaining_cards)) game = hanab_game.GameState(instance) strat = greedy_solver.GreedyStrategy(game) @@ -214,8 +217,7 @@ def process_solve_result(result: SolutionData): database.cur, "INSERT INTO infeasibility_reasons (seed, reason, value) " "VALUES %s " - "ON CONFLICT (seed, reason) " - "DO UPDATE SET value = EXCLUDED.value", + "ON CONFLICT (seed, reason) DO NOTHING", vals ) database.conn.commit()