Commit 8e0da86e authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] CLUnfolder: properties to access internal protected attrs; fix typos

parent 905cc1bf
......@@ -42,6 +42,8 @@
"""
Main engine for constraint unfolding and solving
"""
from __future__ import print_function
#from pyCryptoMS import CryptoMS
from pycryptosat import Solver as CryptoMS
from cadbiom.models.biosignal.translators.gt_visitors import compile_cond, compile_event
......@@ -283,31 +285,38 @@ class CLUnfolder(object):
self.__include_aux_clauses = val
## Internal variable access for tests (never used) #########################
def vars_in_clause(self, clause):
"""DEBUG: Return variables names from values in the given clause"""
return [self.get_var_indexed_name(var) for var in clause]
def get_dynamic_constraints(self):
@property
def dynamic_constraints(self):
"""For tests: returns coded dynamic constraints"""
return self.__dynamic_constraints
def get_initial_constraints(self):
@property
def initial_constraints(self):
"""For tests: returns coded initial constraints"""
return self.__initial_constraints
def get_invariant_constraints(self):
@property
def invariant_constraints(self):
"""For tests: returns coded invariant constraints"""
return self.__invariant_constraints
def get_variant_constraints(self):
@property
def variant_constraints(self):
"""For tests: returns coded variant constraints"""
return self.__variant_constraints
def get_final_constraints(self):
@property
def final_constraints(self):
"""For tests: returns coded final constraints"""
self.__final_constraints
## Variables management ####################################################
def vars_in_clause(self, clause):
"""Return variables names from values in the given clause
(DEBUG never used)
"""
return [self.get_var_indexed_name(var) for var in clause]
def var_dimacs_code(self, var_name):
"""Returns DIMACS code of var_name (string) variable (for tests)"""
return self.__var_code_table[var_name]
......@@ -315,12 +324,18 @@ class CLUnfolder(object):
def get_system_var_number(self):
"""Get number of variables in the clause constraint dynamical system
(including inputs, entities, clocks/events, auxiliary variables) (for tests)
.. note:: This number should be equal to the number of variables
in self.get_var_number()
"""
return self.dynamic_system.get_var_number()
def get_var_number(self):
"""Get number of principal variables (properties excluded) in the unfolder
(including inputs, entities, clocks/events, auxiliary variables) (for tests)
.. note:: This number should be equal to the number of variables
in self.get_system_var_number()
"""
# Remove the blacklisted first item (##) for variables naming
return len(self.__var_list) - 1
......
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