Commit 70f59417 authored by Michele's avatar Michele

added test class for learning with 2 sets

parent 58ffec81
# Test learning algorithm with double set observation table
import os, inspect
from nose.tools import *
from learning.learning import LearningAlgorithm, LearningAlgorithm2Sets
from teachers.ltsteachers import InputOutputTeacher
from systems.implementations import InputOutputLTS
from teachers.ltsoracles import InputOutputPowerOracle
import helpers.graphhelper as gh
import helpers.bisimulation as bi
from testing.randomtesting import RandomTester
class TestLearningAlgorithm2:
def setUp(self):
inputs = set(['a','b'])
outputs = set(['x','y'])
quiescence = 'delta'
self.I1=InputOutputLTS(5, inputs, outputs, quiescence)
self.I1.addTransition(0,'a',1)
self.I1.addTransition(0,'a',2)
self.I1.addTransition(0,'b',0)
self.I1.addTransition(1,'a',0)
self.I1.addTransition(1,'b',3)
self.I1.addTransition(2,'a',0)
self.I1.addTransition(2,'b',3)
self.I1.addTransition(2,'x',4)
self.I1.addTransition(3,'a',0)
self.I1.addTransition(3,'x',4)
self.I1.addTransition(3,'b',3)
self.I1.addTransition(4,'y',2)
self.I1.addTransition(4,'b',4)
self.I1.addTransition(4,'a',0)
self.I1.makeInputEnabled()
self.T1 = InputOutputTeacher(self.I1)
self.O1 = InputOutputPowerOracle(self.I1)
self.tester = RandomTester(self.T1, 1000, 20)
self.L1 = LearningAlgorithm2Sets(self.T1, self.O1, self.tester)
def creation_test(self):
self._Hminus, self._Hplus = self.L1.run()
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