Commit ad2d9d68 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

C++ API in get_unshift_code()

parent 33799fbd
......@@ -81,12 +81,16 @@ class RawSolution(object):
@return: DIMACS literal coding of x_0 with same value
"""
var_code = (abs(var_num) - 1) % self.__shift_step + 1
# Old API
# var_code = (abs(var_num) - 1) % self.__shift_step + 1
#
# if var_code <= self.__shift_step:
# return var_code * (-1 if var_num < 0 else 1)
# else:
# raise MCLException("Not a DIMACS code of an initial variable")
if var_code <= self.__shift_step:
return var_code * (-1 if var_num < 0 else 1)
else:
raise MCLException("Not a DIMACS code of an initial variable")
# New API via C++ module
get_unshift_code(var_num, self.__shift_step)
def get_var_name(self, var_num):
"""
......
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