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