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
80ae3ca5
Commit
80ae3ca5
authored
Feb 14, 2017
by
VIGNET Pierre
Browse files
get_unshift_code(): better algo; no more used by unflatten
parent
1c5602f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
cadbiom/models/clause_constraints/mcl/MCLSolutions.py
View file @
80ae3ca5
...
...
@@ -77,15 +77,11 @@ class RawSolution(object):
@param var_num: DIMACS literal coding of a shifted variable x_i
@return: DIMACS literal coding of x_0 with same value
"""
if
var_num
<
0
:
varnum1
=
-
var_num
sign
=
-
1
else
:
varnum1
=
var_num
sign
=
1
var_code
=
(
varnum1
-
1
)
%
self
.
__shift_step
+
1
var_code
=
(
abs
(
var_num
)
-
1
)
%
self
.
__shift_step
+
1
if
var_code
<=
self
.
__shift_step
:
return
var_code
*
sign
return
var_code
*
(
-
1
if
var_num
<
0
else
1
)
else
:
raise
MCLException
(
"Not a DIMACS code of an initial variable"
)
...
...
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