Commit 80ae3ca5 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

get_unshift_code(): better algo; no more used by unflatten

parent 1c5602f6
......@@ -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")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment