Commit 3b5d0c63 by VIGNET Pierre

### Correct very bad algos of set comparison...

parent 5ed41c4f
 ... ... @@ -397,23 +397,15 @@ class FrontierSolution(object): for icc in self.ic_sequence: stro = stro + "\n " + icc return stro def has_same_frontier(self, other): """ Check if two FrontierSol have same frontier @param other: a DimacsFrontierSol @return bool """ if len(self.activated_frontier) == len(other.activated_frontier): self.activated_frontier.sort() other.activated_frontier.sort() for i in range(len(self.activated_frontier)): if other.activated_frontier[i] != self.activated_frontier[i]: return False return True else: return False return set(self.frontier_values) == set(other.frontier_values) def save(self, outfile): """ Save a symbolic solution in a file ... ... @@ -481,14 +473,8 @@ class DimacsFrontierSol(object): @param other: a DimacsFrontierSol @return bool """ # TODO wrong algorithm if len(self.frontier_values) == len(other.frontier_values): sfr = frozenset(self.frontier_values) xxx = sfr.intersection(other.frontier_values) return len(self.frontier_values) == len(xxx) else: return False return set(self.frontier_values) == set(other.frontier_values) def front_is_in(self, ldfs): """ Check if an object of ldfs has the same frontier list ... ... @@ -496,7 +482,8 @@ class DimacsFrontierSol(object): @return bool """ for dfs in ldfs: if self.has_same_frontier(dfs): #if self.has_same_frontier(dfs): if set(self.frontier_values) == set(dfs.frontier_values): return True return False ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!