We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Commit ccdbfa37 authored by Michele Volpato's avatar Michele Volpato

tried LearnLib, did not work, missing file

parent 076601f8
......@@ -39,7 +39,7 @@ from testing.randomtesting import RandomTester
from systems.iopurpose import InputPurpose, OutputPurpose
logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
inputs = set(['a','be'])
......@@ -59,19 +59,19 @@ I1.addTransition(3,'a',0)
I1.addTransition(3,'x',4)
I1.addTransition(3,'be',3)
I1.addTransition(4,'y',2)
I1.addTransition(4,'be',4)
#I1.addTransition(4,'be',4)
I1.addTransition(4,'a',0)
#I1.addTransition(4,'x',0)
#I1.addTransition(1,'a',0)
#I1.addTransition(3,'b',1)
#I1.addTransition(3,'a',0)
#I1.addTransition(4,'b',2)
#I1.addTransition(2,'a',3)
#I1.addTransition(4,'y',0)
I1.addTransition(4,'x',0)
I1.addTransition(1,'a',0)
I1.addTransition(3,'be',1)
I1.addTransition(3,'a',0)
I1.addTransition(4,'be',2)
I1.addTransition(2,'a',3)
I1.addTransition(4,'y',0)
I1.makeInputEnabled()
#I1.makeInputEnabled()
T1 = InputOutputTeacher(I1)
O1 = InputOutputPowerOracle(I1)
......@@ -89,7 +89,7 @@ path = os.path.join(currentdir, "dotFiles")
print("Starting learning...")
# change printPath=None to printPath=path for dot files
L2 = LearningAlgorithm(T1, O1, printPath=None, maxLoops=4,
L2 = LearningAlgorithm(T1, O1, printPath=path, maxLoops=4,
tablePreciseness=10000, logger=logger, tester=tester, outputPurpose=outputExpert,
inputPurpose=inputExpert)
minus, plus = L2.run()
......
......@@ -90,7 +90,7 @@ T1.close()
# If there is a model learned by LearnLib, load it and run a bisimulation
# check with minus
# The file must be converted with learnlib_dot2jtorx_aut.py
with open("/home/mic/repo/learnLTS/examples/tictactoe/learnLib/TicTacToe.aut", 'r') as csvfile:
with open("/Users/michele/Repos/alnos/examples/tictactoe/learnLib/TicTacToe.aut", 'r') as csvfile:
first = True
reader = csv.reader(csvfile, delimiter=';',
quoting=csv.QUOTE_MINIMAL)
......
......@@ -198,11 +198,12 @@ public class TicTacToeLearner {
// w.close();
String filename = "/home/mic/repo/learnLTS/examples/tictactoe/learnLib/TicTacToe.dot";
filename = "/Users/michele/Repos/alnos/examples/tictactoe/learnLib/macOS/TicTacToe.dot";
PrintStream writer = new PrintStream(
new FileOutputStream(filename));
GraphDOT.write(result, inputs, writer); // may throw IOException!
System.out.println(executeCommand("dot -Tpdf /home/mic/repo/learnLTS/examples/tictactoe/learnLib/TicTacToe.dot -o /home/mic/repo/learnLTS/examples/tictactoe/learnLib/TicTacToe.pdf"));
System.out.println(executeCommand("dot -Tpdf /Users/michele/Repos/alnos/examples/tictactoe/learnLib/macOS/TicTacToe.dot -o /Users/michele/Repos/alnos/examples/tictactoe/learnLib/macOS/TicTacToe.pdf"));
System.out.println("-------------------------------------------------------");
......
......@@ -294,7 +294,7 @@ class Table:
return self._isNotReducible(chaos=True)
return set()
# TODO: check this method with new algorithm added to thesis
# TODO: check this method with new algorithm added to thesis (nondeterminism and chaos)
# TODO: chaos_quiescence should not exist anymore
def _isNotReducible(self, chaos=False):
# function used for filtering rows, we want only those which
......@@ -341,7 +341,7 @@ class Table:
enabledRow2 = set()
if current[1] == "chaos_quiescence":
self._logger.info("chaos_quiescence 1")
self._logger.error("chaos_quiescence 1")
# If we are in chaos_quiescence only quiescence is enabled
enabledRow2.add(self._quiescence)
else:
......@@ -352,7 +352,7 @@ class Table:
for label in enabledRow2:
enabledRow1 = set()
if current[0] == "chaos_quiescence":
self._logger.info("chaos_quiescence 2")
self._logger.error("chaos_quiescence 2")
# If we are in chaos_quiescence only quiescence is
# enabled
enabledRow1.add(self._quiescence)
......@@ -372,7 +372,7 @@ class Table:
else:
newRow1 = ""
if current[0] == "chaos_quiescence":
self._logger.info("chaos_quiescence 3")
self._logger.error("chaos_quiescence 3")
newRow1 = "chaos_quiescence"
else:
try:
......@@ -393,7 +393,7 @@ class Table:
# send the input to chaotic_delta
if self._entries[current[0] + (label,)] == self._emptyEntry(current[0] + (label,)):
newRow1 = "chaos_quiescence"
self._logger.info("chaos_quiescence 4")
self._logger.error("chaos_quiescence 4")
else:
self._logger.error("Quiescence reducibility check: cannot obtain new pair of states. Row1: "
+ str(current[0]) + " label: " + str(label))
......@@ -403,7 +403,7 @@ class Table:
raise
newRow2 = ""
if current[1] == "chaos_quiescence":
self._logger.info("chaos_quiescence 5")
self._logger.error("chaos_quiescence 5")
newRow2 = "chaos_quiescence"
else:
try:
......@@ -422,7 +422,7 @@ class Table:
# send the input to chaotic_delta
if self._entries[current[1] + (label,)] == self._emptyEntry(current[1] + (label,)):
newRow2 = "chaos_quiescence"
self._logger.info("chaos_quiescence 16")
self._logger.error("chaos_quiescence 16")
else:
self._logger.error("Quiescence reducibility check: cannot obtain new pair of states."
+ " Row2: " + str(current[1]) + " label: " + str(label))
......@@ -447,7 +447,7 @@ class Table:
return self._isNotConsistent(chaos=True)
return set()
# TODO: check if ok with latest version thesis (multiple moreSpecific rows)
def _isNotConsistent(self, chaos=False):
# get all combinations of rows in S, with repetitions for hPlus
combi = combinations(self._rowsInS, 2)
......@@ -598,7 +598,7 @@ class Table:
def _emptyFinalEntry(self, trace):
return (set(), set())
# is the entry final? If False, we can still observe some outputs
# is the entry final? If False, we might still observe some outputs
def _isFinal(self, entry):
if entry not in self._entries.keys():
self._logger.warning("Checking if "+str(entry)+ " is final: entry is not in the table.")
......@@ -610,6 +610,7 @@ class Table:
return (outputs.copy(), outputs.copy())
# Private method for creating entries from rows and columns
#TODO: check this method with latest version thesis
def _createEntries(self):
for row in self._rows:
for column in self._columns:
......
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