Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Alnos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Michele Volpato
Alnos
Commits
293473bd
Commit
293473bd
authored
Nov 18, 2015
by
Michele
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed some debug code
parent
e15f092b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
10 deletions
+33
-10
examples/tictactoe/learn.py
examples/tictactoe/learn.py
+1
-1
learning/learning.py
learning/learning.py
+3
-3
tests/learning_algorithm_test.py
tests/learning_algorithm_test.py
+3
-2
tests/tester_test.py
tests/tester_test.py
+26
-4
No files found.
examples/tictactoe/learn.py
View file @
293473bd
...
...
@@ -45,7 +45,7 @@ import helpers.bisimulation as bi
import
csv
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logging
.
basicConfig
(
level
=
logging
.
INFO
)
logger
=
logging
.
getLogger
(
__name__
)
HOST
=
'localhost'
...
...
learning/learning.py
View file @
293473bd
...
...
@@ -303,7 +303,7 @@ class LearningAlgorithm:
consistentCheck
=
self
.
_table
.
isNotGloballyConsistent
()
while
closingRows
or
consistentCheck
:
while
closingRows
:
self
.
_logger
.
info
(
"Table is not closed"
)
self
.
_logger
.
debug
(
"Table is not closed"
)
self
.
_logger
.
debug
(
closingRows
)
self
.
_table
.
promote
(
closingRows
)
# After promoting one should check if some one letter
...
...
@@ -316,7 +316,7 @@ class LearningAlgorithm:
consistentCheck
=
self
.
_table
.
isNotGloballyConsistent
()
# Table is closed, check for consistency
if
consistentCheck
:
self
.
_logger
.
info
(
"Table is not consistent"
)
self
.
_logger
.
debug
(
"Table is not consistent"
)
self
.
_logger
.
debug
(
consistentCheck
)
self
.
_table
.
addColumn
(
consistentCheck
,
force
=
True
)
if
self
.
_logger
.
isEnabledFor
(
logging
.
DEBUG
):
...
...
@@ -452,7 +452,7 @@ class LearningAlgorithm:
newSuffixes
=
self
.
_table
.
isNotQuiescenceReducible
()
while
(
newSuffixes
or
not
self
.
_table
.
isStable
()):
if
newSuffixes
:
self
.
_logger
.
info
(
"Table is not quiescence reducible"
)
self
.
_logger
.
debug
(
"Table is not quiescence reducible"
)
self
.
_logger
.
debug
(
newSuffixes
)
if
self
.
_table
.
addColumn
(
newSuffixes
,
force
=
True
):
if
self
.
_logger
.
isEnabledFor
(
logging
.
DEBUG
):
...
...
tests/learning_algorithm_test.py
View file @
293473bd
...
...
@@ -71,7 +71,7 @@ class TestLearningAlgorithm2:
self
.
T1
=
InputOutputTeacher
(
self
.
I1
)
self
.
O1
=
InputOutputPowerOracle
(
self
.
I1
)
self
.
tester
=
RandomTester
(
self
.
T1
,
10000
,
60
)
self
.
tester
=
RandomTester
(
self
.
T1
,
10000
0
,
7
)
outputExpert
=
OutputPurpose
(
set
([
'x'
,
'y'
,
quiescence
]))
inputExpert
=
InputPurpose
(
set
([
'a'
,
'b'
]))
...
...
@@ -236,7 +236,7 @@ class TestLearningAlgorithm2:
parentdir
=
os
.
path
.
dirname
(
currentdir
)
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
,
tablePreciseness
=
10000
,
modelPreciseness
=
0.8
)
...
...
@@ -245,6 +245,7 @@ class TestLearningAlgorithm2:
# If fail it is because our test extension methods are not implemented
# yet
assert_equal
(
bi
.
bisimilar
(
I3
,
Hplus
),
True
)
#print(bi.bisimilar(I3,Hplus))
assert_equal
(
Hminus
.
isNonBlocking
(),
True
)
assert_equal
(
Hminus
.
isQuiescenceReducible
(),
True
)
assert_equal
(
Hminus
.
isAnomalyFree
(),
True
)
...
...
tests/tester_test.py
View file @
293473bd
# 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
teachers.ltsteachers
import
InputOutputTeacher
from
systems.implementations
import
InputOutputLTS
,
SuspensionAutomaton
from
testing.randomtesting
import
RandomTester
import
helpers.bisimulation
as
bi
class
TestRandomTester
:
...
...
@@ -30,7 +52,7 @@ class TestRandomTester:
self
.
T1
=
InputOutputTeacher
(
self
.
I1
)
self
.
tester
=
RandomTester
(
self
.
T1
,
1000
,
2
0
)
self
.
tester
=
RandomTester
(
self
.
T1
,
1000
0
,
5
0
)
def
test_simple_tester_equal
(
self
):
inputs
=
set
([
'a'
,
'b'
])
...
...
@@ -115,8 +137,8 @@ class TestRandomTester:
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
)
assert_equal
(
ce
,
None
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment