Commit 232470de authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] Ability to fix the order of literals and their values in debug/test mode

parent 12c909a3
......@@ -201,7 +201,7 @@ class CLUnfolder(object):
- trajectory: list of state_vectors
"""
def __init__(self, dynamic_system):
def __init__(self, dynamic_system, debug=False):
"""
:param dynamic_system: Describe a dynamic system in clause form.
:type dynamic_system: <CLDynSys>
......@@ -236,7 +236,10 @@ class CLUnfolder(object):
# Fix order of variables names with a list:
# - indexes of __var_list are the values of the variables at these indexes
# - values begin from 1 (0 is a blacklisted value)
base_var_set = list(dynamic_system.base_var_set)
if debug:
base_var_set = sorted(list(dynamic_system.base_var_set))
else:
base_var_set = list(dynamic_system.base_var_set)
self.__var_list += base_var_set
# keys: are the names of the variables, values: their values
self.__var_code_table = \
......
......@@ -226,22 +226,25 @@ class MCLAnalyser(object):
:param nb_sols_to_be_pruned: For mac search: We search a number of
solutions that will be pruned later, in order to find the most
optimized MAC with a reduced the number of activated frontiers.
:key debug: (optional) Used to activate debug mode in the Unfolder
:type dynamical_system: None before loading a model / <CLDynSys>
:type unfolder: None before loading a model / <CLUnfolder>
:type debug: False / <boolean>
:type reporter: <ErrorRep>
:type translator_opti: True / <boolean>
:type nb_sols_to_be_pruned: 10
"""
def __init__(self, report):
def __init__(self, report, debug=False):
"""The built analyser is void by default
@param report: a standard reporter
"""
self.unfolder = None # computation management: unfolding; type <CLUnfolder>
self.reporter = report # for generic error display
self.translator_opti = True# turn on optimizations for ANTLR translation (subexpression elimination)
self.debug = debug
self.unfolder = None
self.reporter = report
self.translator_opti = True
# For mac search: We search a number of solutions that will be pruned
# in order to find the most optimized MAC with a reduced the number of
......@@ -285,7 +288,7 @@ class MCLAnalyser(object):
if self.reporter.error:
return
# Build unfolder
self.unfolder = CLUnfolder(dynamic_system)
self.unfolder = CLUnfolder(dynamic_system, debug=self.debug)
def build_from_chart_file(self, file_name):
"""Build an MCLAnalyser from a .bcx file
......
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