Mentions légales du service

Skip to content
Snippets Groups Projects
Commit ad2d9d68 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

C++ API in get_unshift_code()

parent 33799fbd
No related branches found
No related tags found
No related merge requests found
...@@ -81,12 +81,16 @@ class RawSolution(object): ...@@ -81,12 +81,16 @@ class RawSolution(object):
@return: DIMACS literal coding of x_0 with same value @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: # New API via C++ module
return var_code * (-1 if var_num < 0 else 1) get_unshift_code(var_num, self.__shift_step)
else:
raise MCLException("Not a DIMACS code of an initial variable")
def get_var_name(self, var_num): def get_var_name(self, var_num):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment