Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

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

[lib] Update Clause attr list_of_literals to literals

parent bfcec7e2
......@@ -52,23 +52,23 @@ class Clause():
Attributes:
:param list_of_literals: Variable name
:type list_of_literals: <list <Literal>>
:param literals: Variable name
:type literals: <list <Literal>>
"""
def __init__(self, list_lit=[]):
self.list_of_literals = list_lit
self.literals = list_lit
def add_lit(self, lit):
"""Add a literal to the clause
@param lit: <Literal>
"""
self.list_of_literals.append(lit)
self.literals.append(lit)
def __eq__(self, other):
"""Test if two clauses have the same literals
Used by clause_list_equal() (never used)
"""
return frozenset(self.list_of_literals) == frozenset(other.list_of_literals)
return frozenset(self.literals) == frozenset(other.literals)
def __ne__(self, other):
"""Test clause inequality"""
......@@ -76,14 +76,14 @@ class Clause():
def __lt__(self, other):
"""Test if the current clause is shorter than another"""
return len(self.list_of_literals) < len(other.list_of_literals)
return len(self.literals) < len(other.literals)
def __gt__(self, other):
"""Test if the current clause is longer than another"""
return len(self.list_of_literals) > len(other.list_of_literals)
return len(self.literals) > len(other.literals)
def __str__(self):
return "$" + ", ".join(str(lit) for lit in self.list_of_literals) + "$"
return "$" + ", ".join(str(lit) for lit in self.literals) + "$"
def __repr__(self):
return str(self)
......
......@@ -442,7 +442,7 @@ class CLUnfolder(object):
"""
# Old API
# num_clause = []
# for lit in clause.list_of_literals:
# for lit in clause.literals:
# if lit.name[-1] == '`': # t+1 variable
# num_clause.append(
# -(self.__var_code_table[lit.name[:-1]] + self.__shift_step) \
......@@ -500,7 +500,7 @@ class CLUnfolder(object):
:rtype: <list <int>>
"""
num_clause = []
for lit in clause.list_of_literals:
for lit in clause.literals:
# Get variable value with the given name
name = lit.name
if name in self.__var_code_table:
......
......@@ -76,7 +76,7 @@ def feed_forward_code():
class Clause():
def __init__(self, lits):
self.list_of_literals = lits
self.literals = lits
class Literal():
def __init__(self, name, sign):
......@@ -87,9 +87,9 @@ def feed_forward_code():
# Make a Clause with Literals objects
literal_defs = [('Hsp90', True), ('not _lit2', False), ('Hsp90`', False)]
list_of_literals = [Literal(name, sign) for name, sign in literal_defs]
#print(list_of_literals)
clause = Clause(list_of_literals)
literals = [Literal(name, sign) for name, sign in literal_defs]
#print(literals)
clause = Clause(literals)
var_code_table = \
{'Hsp90': 10,
......
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