Commit 293473bd authored by Michele's avatar Michele

removed some debug code

parent e15f092b
...@@ -45,7 +45,7 @@ import helpers.bisimulation as bi ...@@ -45,7 +45,7 @@ import helpers.bisimulation as bi
import csv import csv
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
HOST = 'localhost' HOST = 'localhost'
......
...@@ -303,7 +303,7 @@ class LearningAlgorithm: ...@@ -303,7 +303,7 @@ class LearningAlgorithm:
consistentCheck = self._table.isNotGloballyConsistent() consistentCheck = self._table.isNotGloballyConsistent()
while closingRows or consistentCheck: while closingRows or consistentCheck:
while closingRows: while closingRows:
self._logger.info("Table is not closed") self._logger.debug("Table is not closed")
self._logger.debug(closingRows) self._logger.debug(closingRows)
self._table.promote(closingRows) self._table.promote(closingRows)
# After promoting one should check if some one letter # After promoting one should check if some one letter
...@@ -316,7 +316,7 @@ class LearningAlgorithm: ...@@ -316,7 +316,7 @@ class LearningAlgorithm:
consistentCheck = self._table.isNotGloballyConsistent() consistentCheck = self._table.isNotGloballyConsistent()
# Table is closed, check for consistency # Table is closed, check for consistency
if consistentCheck: if consistentCheck:
self._logger.info("Table is not consistent") self._logger.debug("Table is not consistent")
self._logger.debug(consistentCheck) self._logger.debug(consistentCheck)
self._table.addColumn(consistentCheck, force=True) self._table.addColumn(consistentCheck, force=True)
if self._logger.isEnabledFor(logging.DEBUG): if self._logger.isEnabledFor(logging.DEBUG):
...@@ -452,7 +452,7 @@ class LearningAlgorithm: ...@@ -452,7 +452,7 @@ class LearningAlgorithm:
newSuffixes = self._table.isNotQuiescenceReducible() newSuffixes = self._table.isNotQuiescenceReducible()
while (newSuffixes or not self._table.isStable()): while (newSuffixes or not self._table.isStable()):
if newSuffixes: if newSuffixes:
self._logger.info("Table is not quiescence reducible") self._logger.debug("Table is not quiescence reducible")
self._logger.debug(newSuffixes) self._logger.debug(newSuffixes)
if self._table.addColumn(newSuffixes, force=True): if self._table.addColumn(newSuffixes, force=True):
if self._logger.isEnabledFor(logging.DEBUG): if self._logger.isEnabledFor(logging.DEBUG):
......
...@@ -71,7 +71,7 @@ class TestLearningAlgorithm2: ...@@ -71,7 +71,7 @@ class TestLearningAlgorithm2:
self.T1 = InputOutputTeacher(self.I1) self.T1 = InputOutputTeacher(self.I1)
self.O1 = InputOutputPowerOracle(self.I1) self.O1 = InputOutputPowerOracle(self.I1)
self.tester = RandomTester(self.T1, 10000, 60) self.tester = RandomTester(self.T1, 100000, 7)
outputExpert = OutputPurpose(set(['x','y', quiescence])) outputExpert = OutputPurpose(set(['x','y', quiescence]))
inputExpert = InputPurpose(set(['a','b'])) inputExpert = InputPurpose(set(['a','b']))
...@@ -236,7 +236,7 @@ class TestLearningAlgorithm2: ...@@ -236,7 +236,7 @@ class TestLearningAlgorithm2:
parentdir = os.path.dirname(currentdir) parentdir = os.path.dirname(currentdir)
path = os.path.join(parentdir, "tests", "models", "test_reducibility_check2") path = os.path.join(parentdir, "tests", "models", "test_reducibility_check2")
tester = RandomTester(T3, 50000, 25) tester = RandomTester(T3, 50000, 7)
L3 = LearningAlgorithm(T3, O3, tester, printPath=path, maxLoops=5, L3 = LearningAlgorithm(T3, O3, tester, printPath=path, maxLoops=5,
tablePreciseness = 10000, modelPreciseness = 0.8) tablePreciseness = 10000, modelPreciseness = 0.8)
...@@ -245,6 +245,7 @@ class TestLearningAlgorithm2: ...@@ -245,6 +245,7 @@ class TestLearningAlgorithm2:
# If fail it is because our test extension methods are not implemented # If fail it is because our test extension methods are not implemented
# yet # yet
assert_equal(bi.bisimilar(I3,Hplus), True) assert_equal(bi.bisimilar(I3,Hplus), True)
#print(bi.bisimilar(I3,Hplus))
assert_equal(Hminus.isNonBlocking(), True) assert_equal(Hminus.isNonBlocking(), True)
assert_equal(Hminus.isQuiescenceReducible(), True) assert_equal(Hminus.isQuiescenceReducible(), True)
assert_equal(Hminus.isAnomalyFree(), True) assert_equal(Hminus.isAnomalyFree(), True)
......
# Copyright (c) 2015 Michele Volpato
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Test learning algorithm with double set observation table
from nose.tools import * from nose.tools import *
from teachers.ltsteachers import InputOutputTeacher from teachers.ltsteachers import InputOutputTeacher
from systems.implementations import InputOutputLTS, SuspensionAutomaton from systems.implementations import InputOutputLTS, SuspensionAutomaton
from testing.randomtesting import RandomTester from testing.randomtesting import RandomTester
import helpers.bisimulation as bi
class TestRandomTester: class TestRandomTester:
...@@ -30,7 +52,7 @@ class TestRandomTester: ...@@ -30,7 +52,7 @@ class TestRandomTester:
self.T1 = InputOutputTeacher(self.I1) self.T1 = InputOutputTeacher(self.I1)
self.tester = RandomTester(self.T1, 1000, 20) self.tester = RandomTester(self.T1, 10000, 50)
def test_simple_tester_equal(self): def test_simple_tester_equal(self):
inputs = set(['a','b']) inputs = set(['a','b'])
...@@ -115,8 +137,8 @@ class TestRandomTester: ...@@ -115,8 +137,8 @@ class TestRandomTester:
assert_equal(model.isValid(), True) assert_equal(model.isValid(), True)
tester = RandomTester(self.T1, 4, 2) # model is not correct, but we cannot find the problem because of
# to few tests
tester = RandomTester(self.T1, 3, 2)
ce, output = tester.findCounterexample(model) ce, output = tester.findCounterexample(model)
assert_equal(ce, None)
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