Commit c22861cf by Michele

### learning now works for 2 sets, still there is a problem in creating Hplus and...

`learning now works for 2 sets, still there is a problem in creating Hplus and Hminus when not input complete`
parent a9423172
 ... ... @@ -13,12 +13,6 @@ def bisimilar(system1, system2, startState1=0, startState2=0): current = wait.pop() past.add((current[0],current[1])) system1Labels = system1.getInputs().union(system1.getOutputs()) system1Labels.add(system1.getQuiescence()) system2Labels = system2.getInputs().union(system2.getOutputs()) system2Labels.add(system2.getQuiescence()) enabledLabels_1 = set() for state in current[0]: enabledLabels_1 = enabledLabels_1.union(system1.outputs(state)) ... ...
 ... ... @@ -56,7 +56,6 @@ class LearningAlgorithm: # For all traces for which we did not observed all possible outputs oTraces = self._table.getObservableTraces() #prefixes = th.getPrefixes(oTraces) trie = th.make_trie(oTraces) # Until we tried K times with no results ... ... @@ -117,8 +116,7 @@ class LearningAlgorithm: else: # no input to process, ask an output output = self._teacher.output() #print("Ehi, we want an output for this trace " + str(currentTrace)) #print("Obtained output: "+str(output)) # we have an output for currentTrace, add it to observations # this is the first output we observe for currentTrace observations[currentTrace] = set([output]) ... ... @@ -145,9 +143,7 @@ class LearningAlgorithm: children = subtrie.keys() inputChildren = [x for x in children \ if x in self._teacher.getInputAlphabet()] #print("Current Trace: "+str(currentTrace)) #print("Children: " + str(children)) #print("Outputs of SUT (not processed some inputs?)"+ str(self._teacher._lts.outputs())) if len(inputChildren) > 0: # process this input, add it to consecutiveInputs # and navigate subtrie ... ... @@ -172,7 +168,7 @@ class LearningAlgorithm: else: # no input to process, ask an output output = self._teacher.output() #print("Obtained output: "+str(output)) # we have an output for currentTrace, # if currentTrace is in otraces add it to observations if currentTrace in oTraces: ... ... @@ -184,7 +180,7 @@ class LearningAlgorithm: # if that output is not a valid continuation if output not in subtrie.keys(): #print("Not the one we wanted!") # reset the process currentTrace = () subtrie = trie ... ... @@ -224,10 +220,6 @@ class LearningAlgorithm: if observation: self._table.updateEntry(trace, observation=observation) # # this update function uses teacher.process(trace) # # in case a InputOutputTeacher is used, outputs in trace are forced to happen # # this is not realistic, but still useful at the moment. ... ... @@ -269,7 +261,7 @@ class LearningAlgorithm: output = self._teacher.oneOutput(consecutiveInputs) if output == None: # SUT did not accept an input. self._logger.warning("SUT not input enabled") self._logger.warning("SUT did not accept input in " + str(consecutiveInputs)) return None return output return self._teacher.output() ... ... @@ -551,4 +543,6 @@ class LearningAlgorithm2Sets(LearningAlgorithm): self._table = DoubleSetTable(teacher.getInputAlphabet().copy(), teacher.getOutputAlphabet().copy(), teacher.getQuiescence(), closeStrategy, logger=logger) closeStrategy, logger=logger, outputPurpose=outputPurpose, inputPurpose=inputPurpose)