Commit 28d804a9 authored by Michele Volpato's avatar Michele Volpato

removed output set from input and output purposes

parent da8af2b2
......@@ -34,7 +34,7 @@ class TicTacToeInputPurpose(Purpose):
pass
# Given a trace returns the set of inputs enabled after it.
def getEnabled(self, trace, outputs):
def getEnabled(self, trace):
# If the trace ends with an input, return empty set, Otherwise the
# entire set of inputs
#TODO: can be improved by removing from inputs those already in the trace
......@@ -51,7 +51,7 @@ class TicTacToeOutputPurpose(Purpose):
pass
# Given a trace returns the set of outputs enabled after it.
def getEnabled(self, trace, outputs):
def getEnabled(self, trace):
# If the trace ends with an output, only quiescence is enabled
# TODO improve here
inputs = set(['0','1','2','3','4','5','6','7','8'])
......
......@@ -404,9 +404,9 @@ class LearningAlgorithm:
enabledInputs = self._teacher.getInputAlphabet()
enabledOutputs = self._teacher.getOutputAlphabet()
if self._inputPurpose != None:
enabledInputs = self._inputPurpose.getEnabled(row, outputs)
enabledInputs = self._inputPurpose.getEnabled(row)
if self._outputPurpose != None:
enabledOutputs = self._outputPurpose.getEnabled(row, outputs)
enabledOutputs = self._outputPurpose.getEnabled(row)
allLabels = enabledInputs.union(enabledOutputs)
return allLabels
......
......@@ -705,7 +705,7 @@ class Table:
outputs = set()
if output != None:
outputs.add(output)
self._entries[trace] = self._finalEntry(trace, outputs)
self._entries[trace] = self._finalEntry(trace)
# given a trace, query outputPurpose for the outputs that are possibly
# enabled after it
......@@ -713,7 +713,7 @@ class Table:
if self._outputPurpose == None:
return self._outputs.union(set((self._quiescence,)))
else:
return self._outputPurpose.getEnabled(trace, outputs)
return self._outputPurpose.getEnabled(trace)
# given a trace, query inputPurpose for the inputs that are
# enabled after it
......@@ -721,7 +721,7 @@ class Table:
if self._inputPurpose == None:
return self._inputs
else:
return self._inputPurpose.getEnabled(trace, outputs)
return self._inputPurpose.getEnabled(trace)
# Given two entries, check if the former is more specific than the latter
# entry1 ⊑ entry2 => entry2.first is subset of entry1.first and entry1.second is subset of entry2.second
......
......@@ -25,7 +25,7 @@ class Purpose(metaclass=ABCMeta):
# Given a trace, return the set of enabled actions after that trace
@abstractmethod
def getEnabled(self, trace, outputs):
def getEnabled(self, trace):
pass
# Given two sets of outputs return True if the first is included in the second.
......
......@@ -27,7 +27,7 @@ class InputPurpose(Purpose):
self._inputs = inputs.copy()
# Given a trace returns the set of inputs enabled after it.
def getEnabled(self, trace, outputs):
def getEnabled(self, trace):
return self._inputs
class OutputPurpose(Purpose):
......@@ -36,5 +36,5 @@ class OutputPurpose(Purpose):
self._outputs = outputs.copy()
# Given a trace returns the set of outputs enabled after it.
def getEnabled(self, trace, outputs):
def getEnabled(self, trace):
return self._outputs
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