From 308cb6f6479a78656479d803def39ad0819e9aca Mon Sep 17 00:00:00 2001 From: VIGNET Pierre <pierre.vignet@irisa.fr> Date: Fri, 20 Dec 2019 00:39:46 +0100 Subject: [PATCH] [lib] DimacsFrontierSol: Fix security cast for hash() (the concerned attr has changed) --- .../models/clause_constraints/mcl/MCLSolutions.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/cadbiom/models/clause_constraints/mcl/MCLSolutions.py b/library/cadbiom/models/clause_constraints/mcl/MCLSolutions.py index 5d8c8c7..6ecf299 100644 --- a/library/cadbiom/models/clause_constraints/mcl/MCLSolutions.py +++ b/library/cadbiom/models/clause_constraints/mcl/MCLSolutions.py @@ -670,9 +670,7 @@ class DimacsFrontierSol(object): """ # Frontier places # /!\ Most of the time spent in the constructor is due to this line - # Already a frozenset but this attribute must be immutable for __hash__, - # cast is a security. - self.frontier_values = frozenset(raw_sol.frontier_pos_and_neg_values) + self.frontier_values = raw_sol.frontier_pos_and_neg_values # Activated input/events (clocks) # Callable of raw_sol method (avoid to store raw_sol in this object) @@ -687,7 +685,11 @@ class DimacsFrontierSol(object): # - by FrontierSolution.from_dimacs_front_sol() # - to accelerate the call of self.nb_activated_frontiers # - as a criterion of uniqueness, to do set operations - self.activated_frontier_values = raw_sol.extract_activated_frontier_values() + # Already a frozenset but this attribute must be immutable for __hash__, + # cast is a security. + self.activated_frontier_values = frozenset( + raw_sol.extract_activated_frontier_values() + ) # Pre-compute nb of activated frontiers in the current solution # PS: use numpy to accelerate this ? The cast is costly... -- GitLab