Commit 2f783745 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

C++ API in unflatten()

parent ae4ca084
......@@ -125,20 +125,30 @@ class RawSolution(object):
compiling are ignored.
@return: a list of state vectors (list<int>) in DIMACS format
"""
shift = self.__shift_step
lv_traj = []
step = 0
dec = 0
# n steps means h0, ..., h(n-1) in constraints for clocks and inputs
while dec + shift < len(self.__solution):
xic = []
for i in range(self.__unfolder.get_shift_step_init()):
xic.append(self.get_unshift_code(self.__solution[i+dec]))
lv_traj.append(xic)
step += 1
dec = step * shift # first index of time step
return lv_traj
# Old API
# lv_traj = []
# step = 0
# dec = 0
# len_shift_step_init = self.__unfolder.get_shift_step_init()
# # n steps means h0, ..., h(n-1) in constraints for clocks and inputs
# while dec + self.__shift_step < len(self.__solution):
# #assert [self.get_unshift_code(self.__solution[i+dec]) for i in range(len_shift_step_init)] == [get_unshift_code(self.__solution[i+dec], self.__shift_step) for i in range(len_shift_step_init)]
# lv_traj.append(
# [get_unshift_code(self.__solution[i+dec], self.__shift_step)
# for i in range(len_shift_step_init)]
# )
# step += 1
# dec = step * self.__shift_step # first index of time step
# return lv_traj # list of lists
# New API via C++ module
return unflatten(
self.__solution,
self.__unfolder.get_shift_step_init(),
self.__shift_step
)
def extract_frontier_values(self):
"""
......
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