Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VIGNET Pierre
cadbiom
Commits
3b5d0c63
Commit
3b5d0c63
authored
Feb 14, 2017
by
VIGNET Pierre
Browse files
Correct very bad algos of set comparison...
parent
5ed41c4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
cadbiom/models/clause_constraints/mcl/MCLSolutions.py
View file @
3b5d0c63
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment