Commit 4901b578 authored by Michele's avatar Michele

NOT STABLE: error in quiescence check to be fixed

parent 371d434f
......@@ -252,12 +252,25 @@ class Table:
past = set()
# filter rows
for row1 in filter(rowsWithQuiescence, self._rowsInS):
print(str(chaos)+" Row1: " + str(row1))
print(self._entries[row1])
row1Extended = row1 + (self._quiescence,)
# filter for rows in top part of the table that are
# moreSpecific than row1Extended
equivalentRows = lambda x: lambda y: self._moreSpecificRow(x, y, chaos)
row2 = next(filter(equivalentRows(row1Extended), self._rowsInS))
# moreSpecific than row1Extended,
moreSpecific = lambda x: lambda y: self._moreSpecificRow(y, x, chaos)
listOfRows = list(filter(moreSpecific(row1Extended), self._rowsInS))
# I want the most specific one
row2 = listOfRows.pop()
print(str(chaos)+" Less specific: " + str(row1Extended))
print(self._entries[row1Extended])
print(str(chaos)+" Temporary more specific: " + str(row2))
print(self._entries[row2])
for row in listOfRows:
if self._moreSpecificRow(row, row2, chaos):
row2 = row
print(str(chaos)+" Most specific: "+ str(row2))
print(self._entries[row2])
if row1 == row2:
# same row, simulation is trivial
continue
......@@ -268,6 +281,7 @@ class Table:
wait = set()
wait.add((row1, row2, ()))
print("Added: "+ str((row1, row2, ())))
while wait:
current = wait.pop()
past.add((current[0],current[1]))
......@@ -278,7 +292,7 @@ class Table:
enabledRow2.add(self._quiescence)
else:
# input enabledness
enabledInputs = self._inputPurpose.getEnabled(current[1])
enabledInputs = self._possibleInputs(current[1])
enabledRow2 = self._entries[current[1]][0].union(enabledInputs)
for label in enabledRow2:
enabledRow1 = set()
......@@ -287,7 +301,7 @@ class Table:
# enabled
enabledRow1.add(self._quiescence)
else:
enabledInputs = self._inputPurpose.getEnabled(current[0])
enabledInputs = self._possibleInputs(current[0])
enabledRow1 = self._entries[current[0]][0].union(enabledInputs)
if label not in enabledRow1:
suffixes = set()
......@@ -303,8 +317,12 @@ class Table:
newRow1 = "chaos_quiescence"
else:
try:
newRow1 = next(filter(equivalentRows(current[0] + (label,)), self._rowsInS))
except StopIteration as error:
listOfRows = list(filter(moreSpecific(current[0] + (label,)), self._rowsInS))
newRow1 = listOfRows.pop()
for row in listOfRows:
if self._moreSpecificRow(row, newRow1, chaos):
newRow1 = row
except IndexError as error:
# current[0] + (label,) might not have
# corresponding row in S. This is the case when
# the first entry is emptyEntry.
......@@ -326,8 +344,12 @@ class Table:
newRow2 = "chaos_quiescence"
else:
try:
newRow2 = next(filter(equivalentRows(current[1] + (label,)), self._rowsInS))
except StopIteration as error:
listOfRows = list(filter(moreSpecific(current[1] + (label,)), self._rowsInS))
newRow2 = listOfRows.pop()
for row in listOfRows:
if self._moreSpecificRow(row, newRow2, chaos):
newRow2 = row
except IndexError as error:
# current[1] + (label,) might not have
# corresponding row in S. This is the case when
# the first entry is (set(), false).
......@@ -612,10 +634,10 @@ class Table:
# Given two entries, check if the former is more specific than the latter
def _moreSpecificEntry(self, entry1, entry2, plus):
if not plus:
#return entry1 == entry2
return entry2[0].issubset(entry1[0])
return entry1[0] == entry2[0]
#return entry2[0].issubset(entry1[0])
else:
#return entry1[0] == entry2[0]
#return entry1 == entry2
return (entry2[0].issubset(entry1[0]) and entry1[1].issubset(entry2[1]))
# Given two rows, check if the former is more specific than the latter
......
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