Commit d2eb3621 authored by Michele's avatar Michele

Now it is not necessary to specify the alphabets when creating new LTSs

parent 73358705
...@@ -51,7 +51,7 @@ class TicTacToeTeacher(AbstractTeacher): ...@@ -51,7 +51,7 @@ class TicTacToeTeacher(AbstractTeacher):
sys.exit() sys.exit()
#self._socket.setblocking(0) #self._socket.setblocking(0)
self._socket.settimeout(1) # 1 second timeout, for quiescence self._socket.settimeout(0.5) # second timeout, for quiescence
#logging.basicConfig(level=logging.DEBUG) #logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -342,8 +342,6 @@ class LearningAlgorithm: ...@@ -342,8 +342,6 @@ class LearningAlgorithm:
self._teacher.getOutputAlphabet().copy(), self._teacher.getOutputAlphabet().copy(),
self._teacher.getQuiescence(), self._teacher.getQuiescence(),
chaos) chaos)
#if not chaos:
# print(rows)
# assign to each equivalence class a state number # assign to each equivalence class a state number
# start with equivalence class of empty trace to 0 # start with equivalence class of empty trace to 0
assignments = {():0} assignments = {():0}
...@@ -362,8 +360,6 @@ class LearningAlgorithm: ...@@ -362,8 +360,6 @@ class LearningAlgorithm:
for label in allLabels: for label in allLabels:
# create row and search it in the table # create row and search it in the table
extension = row + (label,) extension = row + (label,)
#if not chaos:
# print(extension)
if self._table.isInRows(extension): if self._table.isInRows(extension):
for target in rows: for target in rows:
found = False found = False
...@@ -372,6 +368,7 @@ class LearningAlgorithm: ...@@ -372,6 +368,7 @@ class LearningAlgorithm:
if self._table._moreSpecificRow(extension, target, chaos): if self._table._moreSpecificRow(extension, target, chaos):
hyp.addTransition(assignments[row], label, hyp.addTransition(assignments[row], label,
assignments[target]) assignments[target])
found = True found = True
break break
if not found: if not found:
......
...@@ -130,14 +130,14 @@ class InputOutputLTS(AbstractIOLTS): ...@@ -130,14 +130,14 @@ class InputOutputLTS(AbstractIOLTS):
validState1 = state1 < self._numstates and state1 >= 0 validState1 = state1 < self._numstates and state1 >= 0
validState2 = state2 < self._numstates and state2 >= 0 validState2 = state2 < self._numstates and state2 >= 0
if validState1 and validState2: if validState1 and validState2:
if label in self._inputs or label in self._outputs: #if label in self._inputs: #or label in self._outputs:
key = (state1, label) key = (state1, label)
if key in self._transitions.keys(): if key in self._transitions.keys():
self._transitions[key].add(state2) self._transitions[key].add(state2)
else: else:
self._transitions[key] = set([state2]) self._transitions[key] = set([state2])
else: #else:
success = False # success = False
else: else:
success = False success = False
return success return success
......
...@@ -48,7 +48,7 @@ class TestImplementations: ...@@ -48,7 +48,7 @@ class TestImplementations:
success = I3.addTransition(1,'a',2) success = I3.addTransition(1,'a',2)
assert_equal(success, True) assert_equal(success, True)
success = I3.addTransition(1,'c',2) success = I3.addTransition(1,'c',2)
assert_equal(success, False) assert_equal(success, True)
success = I3.addTransition(-1,'a',2) success = I3.addTransition(-1,'a',2)
assert_equal(success, False) assert_equal(success, False)
success = I3.addTransition(1,'b',4) success = I3.addTransition(1,'b',4)
......
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