From d30543ffc695dcc293cd9ded4070c30737d86130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20T=C3=A5quist?= Date: Fri, 15 Mar 2024 15:43:53 +0100 Subject: [PATCH 1/9] add support for constants in class analyzer --- pom.xml | 6 ++++ .../de/learnlib/ralib/data/DataValue.java | 28 +++++++++++++++ .../tools/AbstractToolWithRandomWalk.java | 34 +++++++++++++++++++ .../learnlib/ralib/tools/ClassAnalyzer.java | 9 +++++ 4 files changed, 77 insertions(+) diff --git a/pom.xml b/pom.xml index 370131d3..a624f50b 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ 4.0.5 0.9.9 0.17.0 + 2.8.0 @@ -206,5 +207,10 @@ org.slf4j slf4j-api + + com.google.code.gson + gson + ${gson.version} + diff --git a/src/main/java/de/learnlib/ralib/data/DataValue.java b/src/main/java/de/learnlib/ralib/data/DataValue.java index d828c9c2..336dbfa2 100644 --- a/src/main/java/de/learnlib/ralib/data/DataValue.java +++ b/src/main/java/de/learnlib/ralib/data/DataValue.java @@ -74,5 +74,33 @@ public DataType getType() { return type; } + public static

DataValue

valueOf(String strVal, DataType type) { + return new DataValue(type, valueOf(strVal, type.getBase())); + } + + public static

P valueOf(String strVal, Class

cls) { + P realValue = null; + if (Number.class.isAssignableFrom(cls)) { + Object objVal; + try { + objVal = cls.getMethod("valueOf", String.class).invoke(cls, strVal); + + realValue = cls.cast(objVal); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + if (cls.isPrimitive()) { + if (cls.equals(int.class)) + return (P) Integer.valueOf(strVal); + else if (cls.equals(double.class)) + return (P) Double.valueOf(strVal); + else if (cls.equals(long.class)) + return (P) Long.valueOf(strVal); + } + throw new RuntimeException("Cannot deserialize values of the class " + cls); + } + return realValue; + } } diff --git a/src/main/java/de/learnlib/ralib/tools/AbstractToolWithRandomWalk.java b/src/main/java/de/learnlib/ralib/tools/AbstractToolWithRandomWalk.java index 24f0b09a..aadb2fa8 100644 --- a/src/main/java/de/learnlib/ralib/tools/AbstractToolWithRandomWalk.java +++ b/src/main/java/de/learnlib/ralib/tools/AbstractToolWithRandomWalk.java @@ -22,6 +22,10 @@ import java.util.Random; import java.util.logging.Level; +import com.google.gson.Gson; + +import de.learnlib.ralib.data.DataType; +import de.learnlib.ralib.data.DataValue; import de.learnlib.ralib.solver.ConstraintSolver; import de.learnlib.ralib.solver.ConstraintSolverFactory; import de.learnlib.ralib.tools.classanalyzer.TypedTheory; @@ -134,6 +138,11 @@ public Level parse(Configuration c) throws ConfigurationException { ", " + ConstraintSolverFactory.ID_Z3 + ".", ConstraintSolverFactory.ID_SIMPLE, true); + protected static final ConfigurationOption.StringOption OPTION_CONSTANTS + = new ConfigurationOption.StringOption("constants", + "Regular constants of form [{\"type\":typeA,\"value\":\"valueA\"}, ...]", + null, true); + protected Random random = null; protected boolean useCeOptimizers; @@ -210,4 +219,29 @@ private Pair parseTeacherConfig(String config) throw new ConfigurationException(ex.getMessage()); } } + + protected DataValue[] parseDataValues(String gsonDataValueArray, Map typeMap) { + Gson gson = new Gson(); + GsonDataValue[] gDvs = gson.fromJson(gsonDataValueArray, GsonDataValue[].class); + DataValue[] dataValues = new DataValue[gDvs.length]; + for (int i = 0; i < gDvs.length; i++) { + DataType type = typeMap.get(gDvs[i].type); + dataValues[i] = gDvs[i].toDataValue(type); + } + + return dataValues; + } + + static class GsonDataValue { + public String type; + public String value; + + public DataValue toDataValue(DataType type) { + if (type.getName().compareTo(this.type) != 0) { + throw new RuntimeException("Type name mismatch"); + } + DataValue dv = new DataValue(type, DataValue.valueOf(value, type.getBase())); + return dv; + } + } } diff --git a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java index bf187460..cd650b4a 100644 --- a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java +++ b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java @@ -31,6 +31,8 @@ import de.learnlib.ralib.automata.xml.RegisterAutomatonExporter; import de.learnlib.ralib.data.Constants; import de.learnlib.ralib.data.DataType; +import de.learnlib.ralib.data.DataValue; +import de.learnlib.ralib.data.util.SymbolicDataValueGenerator; import de.learnlib.ralib.equivalence.IOCounterExamplePrefixFinder; import de.learnlib.ralib.equivalence.IOCounterExamplePrefixReplacer; import de.learnlib.ralib.equivalence.IOCounterexampleLoopRemover; @@ -183,6 +185,13 @@ public void setup(Configuration config) throws ConfigurationException { final Constants consts = new Constants(); + String cstString = OPTION_CONSTANTS.parse(config); + if (cstString != null) { + final SymbolicDataValueGenerator.ConstantGenerator cgen = new SymbolicDataValueGenerator.ConstantGenerator(); + DataValue[] cstArray = super.parseDataValues(cstString, types); + Arrays.stream(cstArray).forEach(c -> consts.put(cgen.next(c.getType()), c)); + } + // create teachers teachers = new LinkedHashMap(); // create teachers From 2121dd803d536bb7a6a64d161b8466a46c388268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20T=C3=A5quist?= Date: Mon, 22 Apr 2024 15:13:41 +0200 Subject: [PATCH 2/9] add constants to hypothesis check --- src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java index cd650b4a..33223409 100644 --- a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java +++ b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java @@ -127,6 +127,8 @@ public class ClassAnalyzer extends AbstractToolWithRandomWalk { private IOOracle back; private Map teachers; + + private final Constants consts = new Constants(); private Class target = null; @@ -183,7 +185,7 @@ public void setup(Configuration config) throws ConfigurationException { actList.add(SpecialSymbols.DEPTH); ParameterizedSymbol[] actions = actList.toArray(new ParameterizedSymbol[]{}); - final Constants consts = new Constants(); +// final Constants consts = new Constants(); String cstString = OPTION_CONSTANTS.parse(config); if (cstString != null) { @@ -364,7 +366,7 @@ public void run() throws RaLibToolException { Word sysTrace = back.trace(ce.getInput()); System.out.println("### SYS TRACE: " + sysTrace); - SimulatorSUL hypSul = new SimulatorSUL(hyp, teachers, new Constants()); + SimulatorSUL hypSul = new SimulatorSUL(hyp, teachers, consts); IOOracle iosul = new SULOracle(hypSul, SpecialSymbols.ERROR); Word hypTrace = iosul.trace(ce.getInput()); System.out.println("### HYP TRACE: " + hypTrace); @@ -374,6 +376,9 @@ public void run() throws RaLibToolException { } System.out.println("=============================== STOP ==============================="); + System.out.println("FINAL HYP:------------------------------------------"); + System.out.println(hyp); + System.out.println("----------------------------------------------------"); SimpleProfiler.logResults(); System.out.println("ce lengths (original): " From ffa970295aa8da8e56a31cb63b757501033928d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20T=C3=A5quist?= Date: Mon, 22 Apr 2024 15:15:46 +0200 Subject: [PATCH 3/9] comment out code causing problems (temporary fix) --- .../ralib/learning/IOAutomatonBuilder.java | 16 +++++++--------- .../de/learnlib/ralib/oracles/io/IOCache.java | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java b/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java index a4cfb8df..1d0f1de7 100644 --- a/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java +++ b/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java @@ -33,13 +33,11 @@ import de.learnlib.ralib.automata.output.OutputMapping; import de.learnlib.ralib.automata.output.OutputTransition; import de.learnlib.ralib.data.Constants; -import de.learnlib.ralib.data.DataType; import de.learnlib.ralib.data.DataValue; import de.learnlib.ralib.data.SymbolicDataValue; import de.learnlib.ralib.data.SymbolicDataValue.Constant; import de.learnlib.ralib.data.SymbolicDataValue.Parameter; import de.learnlib.ralib.data.VarMapping; -import de.learnlib.ralib.data.util.SymbolicDataValueGenerator.ParameterGenerator; import de.learnlib.ralib.dt.DT; import de.learnlib.ralib.words.OutputSymbol; import de.learnlib.ralib.words.PSymbolInstance; @@ -94,13 +92,13 @@ protected Transition createTransition(ParameterizedSymbol action, analyzeExpression(expr, outmap); Set fresh = new LinkedHashSet<>(); - ParameterGenerator pgen = new ParameterGenerator(); - for (DataType t : action.getPtypes()) { - Parameter p = pgen.next(t); - if (!outmap.containsKey(p)) { - fresh.add(p); - } - } +// ParameterGenerator pgen = new ParameterGenerator(); +// for (DataType t : action.getPtypes()) { +// Parameter p = pgen.next(t); +// if (!outmap.containsKey(p)) { +// fresh.add(p); +// } +// } OutputMapping outMap = new OutputMapping(fresh, outmap); diff --git a/src/main/java/de/learnlib/ralib/oracles/io/IOCache.java b/src/main/java/de/learnlib/ralib/oracles/io/IOCache.java index b665d947..6932c677 100644 --- a/src/main/java/de/learnlib/ralib/oracles/io/IOCache.java +++ b/src/main/java/de/learnlib/ralib/oracles/io/IOCache.java @@ -137,7 +137,7 @@ private Boolean answerFromCache(Word query) { DataValue f = out.getParameterValues()[i]; DataValue d = ref.getParameterValues()[i]; if (f instanceof FreshValue) { - assert !replacements.containsKey(d); +// assert !replacements.containsKey(d); replacements.put(d, f); } DataValue r = replacements.containsKey(d) ? replacements.get(d) : d; From 6b413353d229b5d1a7791f5b80de7907e8d4b5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20T=C3=A5quist?= Date: Mon, 22 Apr 2024 15:16:33 +0200 Subject: [PATCH 4/9] apply spotless --- src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java index 33223409..ee97a6fc 100644 --- a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java +++ b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java @@ -127,7 +127,7 @@ public class ClassAnalyzer extends AbstractToolWithRandomWalk { private IOOracle back; private Map teachers; - + private final Constants consts = new Constants(); private Class target = null; From 0f33cf98445a200ee410bca76c3a317cdcebdc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20T=C3=A5quist?= Date: Mon, 22 Apr 2024 16:12:58 +0200 Subject: [PATCH 5/9] fresh output only if no constants --- .../ralib/learning/IOAutomatonBuilder.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java b/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java index 1d0f1de7..63bc5616 100644 --- a/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java +++ b/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java @@ -33,11 +33,13 @@ import de.learnlib.ralib.automata.output.OutputMapping; import de.learnlib.ralib.automata.output.OutputTransition; import de.learnlib.ralib.data.Constants; +import de.learnlib.ralib.data.DataType; import de.learnlib.ralib.data.DataValue; import de.learnlib.ralib.data.SymbolicDataValue; import de.learnlib.ralib.data.SymbolicDataValue.Constant; import de.learnlib.ralib.data.SymbolicDataValue.Parameter; import de.learnlib.ralib.data.VarMapping; +import de.learnlib.ralib.data.util.SymbolicDataValueGenerator.ParameterGenerator; import de.learnlib.ralib.dt.DT; import de.learnlib.ralib.words.OutputSymbol; import de.learnlib.ralib.words.PSymbolInstance; @@ -92,13 +94,13 @@ protected Transition createTransition(ParameterizedSymbol action, analyzeExpression(expr, outmap); Set fresh = new LinkedHashSet<>(); -// ParameterGenerator pgen = new ParameterGenerator(); -// for (DataType t : action.getPtypes()) { -// Parameter p = pgen.next(t); -// if (!outmap.containsKey(p)) { -// fresh.add(p); -// } -// } + ParameterGenerator pgen = new ParameterGenerator(); + for (DataType t : action.getPtypes()) { + Parameter p = pgen.next(t); + if (!outmap.containsKey(p) && consts.isEmpty()) { + fresh.add(p); + } + } OutputMapping outMap = new OutputMapping(fresh, outmap); From 71f000816f1a6e415e5bda8eb2bfe669fe044daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20T=C3=A5quist?= Date: Wed, 24 Apr 2024 13:50:43 +0200 Subject: [PATCH 6/9] add constants to class analyzer SUL --- .../ralib/learning/IOAutomatonBuilder.java | 2 +- .../de/learnlib/ralib/oracles/io/IOCache.java | 2 +- .../de/learnlib/ralib/tools/ClassAnalyzer.java | 10 +++++----- .../classanalyzer/ClasssAnalyzerDataWordSUL.java | 16 +++++++++++++--- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java b/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java index 63bc5616..a4cfb8df 100644 --- a/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java +++ b/src/main/java/de/learnlib/ralib/learning/IOAutomatonBuilder.java @@ -97,7 +97,7 @@ protected Transition createTransition(ParameterizedSymbol action, ParameterGenerator pgen = new ParameterGenerator(); for (DataType t : action.getPtypes()) { Parameter p = pgen.next(t); - if (!outmap.containsKey(p) && consts.isEmpty()) { + if (!outmap.containsKey(p)) { fresh.add(p); } } diff --git a/src/main/java/de/learnlib/ralib/oracles/io/IOCache.java b/src/main/java/de/learnlib/ralib/oracles/io/IOCache.java index 6932c677..b665d947 100644 --- a/src/main/java/de/learnlib/ralib/oracles/io/IOCache.java +++ b/src/main/java/de/learnlib/ralib/oracles/io/IOCache.java @@ -137,7 +137,7 @@ private Boolean answerFromCache(Word query) { DataValue f = out.getParameterValues()[i]; DataValue d = ref.getParameterValues()[i]; if (f instanceof FreshValue) { -// assert !replacements.containsKey(d); + assert !replacements.containsKey(d); replacements.put(d, f); } DataValue r = replacements.containsKey(d) ? replacements.get(d) : d; diff --git a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java index ee97a6fc..b62ff719 100644 --- a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java +++ b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java @@ -170,11 +170,6 @@ public void setup(Configuration config) throws ConfigurationException { Integer md = OPTION_MAX_DEPTH.parse(config); - sulLearn = new ClasssAnalyzerDataWordSUL(target, methods, md); - if (this.timeoutMillis > 0L) { - this.sulLearn = new TimeOutSUL(this.sulLearn, this.timeoutMillis); - } - ParameterizedSymbol[] inputSymbols = inList.toArray(new ParameterizedSymbol[]{}); actList.add(SpecialSymbols.ERROR); @@ -194,6 +189,11 @@ public void setup(Configuration config) throws ConfigurationException { Arrays.stream(cstArray).forEach(c -> consts.put(cgen.next(c.getType()), c)); } + sulLearn = new ClasssAnalyzerDataWordSUL(target, methods, md, consts); + if (this.timeoutMillis > 0L) { + this.sulLearn = new TimeOutSUL(this.sulLearn, this.timeoutMillis); + } + // create teachers teachers = new LinkedHashMap(); // create teachers diff --git a/src/main/java/de/learnlib/ralib/tools/classanalyzer/ClasssAnalyzerDataWordSUL.java b/src/main/java/de/learnlib/ralib/tools/classanalyzer/ClasssAnalyzerDataWordSUL.java index 4cf8c0ce..337281ac 100644 --- a/src/main/java/de/learnlib/ralib/tools/classanalyzer/ClasssAnalyzerDataWordSUL.java +++ b/src/main/java/de/learnlib/ralib/tools/classanalyzer/ClasssAnalyzerDataWordSUL.java @@ -22,6 +22,7 @@ import java.util.Map; import de.learnlib.exception.SULException; +import de.learnlib.ralib.data.Constants; import de.learnlib.ralib.data.DataType; import de.learnlib.ralib.data.DataValue; import de.learnlib.ralib.data.FreshValue; @@ -47,10 +48,17 @@ public class ClasssAnalyzerDataWordSUL extends DataWordSUL { private final Map> buckets = new HashMap<>(); + private final Constants consts; + public ClasssAnalyzerDataWordSUL(Class sulClass, Map methods, int d) { - this.sulClass = sulClass; - this.methods = methods; - this.maxDepth = d; + this(sulClass, methods, d, new Constants()); + } + + public ClasssAnalyzerDataWordSUL(Class sulClass, Map methods, int d, Constants consts) { + this.sulClass = sulClass; + this.methods = methods; + this.maxDepth = d; + this.consts = consts; } @Override @@ -152,6 +160,8 @@ private Object resolve(DataValue d) { private boolean isFresh(DataType t, Object id) { Map map = this.buckets.get(t); + if (consts.values().stream().filter(d -> d.getType().equals(t) && d.getId().equals(id)).findAny().isPresent()) + return false; return map == null || !map.containsValue(id); } From 42d51be94359dfda81927233faffd48987f5fcd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20T=C3=A5quist?= Date: Wed, 24 Apr 2024 15:18:24 +0200 Subject: [PATCH 7/9] test case for constants with class analyzer --- .../ralib/example/container/ContainerSUL.java | 16 +++++++++ .../ralib/tools/ClassAnalyzerTest.java | 35 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/test/java/de/learnlib/ralib/example/container/ContainerSUL.java diff --git a/src/test/java/de/learnlib/ralib/example/container/ContainerSUL.java b/src/test/java/de/learnlib/ralib/example/container/ContainerSUL.java new file mode 100644 index 00000000..eeb4c550 --- /dev/null +++ b/src/test/java/de/learnlib/ralib/example/container/ContainerSUL.java @@ -0,0 +1,16 @@ +package de.learnlib.ralib.example.container; + +public class ContainerSUL { + + public static final int ERROR = 0; + + private Integer val = null; + + public void put(Integer val) { + this.val = val; + } + + public Integer get() { + return val == null ? ERROR : val; + } +} diff --git a/src/test/java/de/learnlib/ralib/tools/ClassAnalyzerTest.java b/src/test/java/de/learnlib/ralib/tools/ClassAnalyzerTest.java index 57959a7b..264158ce 100644 --- a/src/test/java/de/learnlib/ralib/tools/ClassAnalyzerTest.java +++ b/src/test/java/de/learnlib/ralib/tools/ClassAnalyzerTest.java @@ -137,4 +137,39 @@ public void testClassAnalyzerInequalities() { } + @Test + public void classAnalyzerConstantsTest() { + + final String[] options = new String[] { + "class-analyzer", + "target=de.learnlib.ralib.example.container.ContainerSUL;" + + "methods=put(java.lang.Integer:int)void+" + + "get()java.lang.Integer:int;" + + "random.seed=652102309071547789;" + + "logging.level=WARNING;" + + "max.time.millis=600000;" + + "learner=sllambda;" + + "use.ceopt=false;" + + "use.suffixopt=true;" + + "use.fresh=true;" + + "use.rwalk=true;" + + "export.model=false;" + + "rwalk.prob.fresh=0.8;" + + "rwalk.prob.reset=0.1;" + + "rwalk.max.depth=6;" + + "rwalk.max.runs=1000;" + + "rwalk.reset.count=false;" + + "rwalk.draw.uniform=false;" + + "teachers=int:de.learnlib.ralib.tools.theories.IntegerEqualityTheory;" + + "constants=[{'type':'int','value':'0'}]"}; + + try { + ConsoleClient cl = new ConsoleClient(options); + int ret = cl.run(); + Assert.assertEquals(ret, 0); + } catch (Throwable t) { + Assert.fail(t.getClass().getName()); + } + } + } From 56f6e21dd2e9899c5ef96ceddba31d084fbb5246 Mon Sep 17 00:00:00 2001 From: FredrikTaquist <60506950+FredrikTaquist@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:44:42 +0200 Subject: [PATCH 8/9] fix spacing --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index a624f50b..a8138c7f 100644 --- a/pom.xml +++ b/pom.xml @@ -208,9 +208,9 @@ slf4j-api - com.google.code.gson - gson - ${gson.version} - + com.google.code.gson + gson + ${gson.version} + From fb9d076529c35c4c0b82907a4dd27a58926d9de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20T=C3=A5quist?= Date: Mon, 29 Apr 2024 11:59:59 +0200 Subject: [PATCH 9/9] cleanup code --- src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java | 7 ------- .../tools/classanalyzer/ClasssAnalyzerDataWordSUL.java | 8 ++++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java index b62ff719..0ccf1d63 100644 --- a/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java +++ b/src/main/java/de/learnlib/ralib/tools/ClassAnalyzer.java @@ -180,8 +180,6 @@ public void setup(Configuration config) throws ConfigurationException { actList.add(SpecialSymbols.DEPTH); ParameterizedSymbol[] actions = actList.toArray(new ParameterizedSymbol[]{}); -// final Constants consts = new Constants(); - String cstString = OPTION_CONSTANTS.parse(config); if (cstString != null) { final SymbolicDataValueGenerator.ConstantGenerator cgen = new SymbolicDataValueGenerator.ConstantGenerator(); @@ -246,8 +244,6 @@ public TreeOracle createTreeOracle(RegisterAutomaton hyp) { } }; - //this.rastar = new RaStar(mto, hypFactory, mlo, consts, true, actions); - switch (this.learner) { case AbstractToolWithRandomWalk.LEARNER_SLSTAR: this.rastar = new RaStar(mto, hypFactory, mlo, consts, true, actions); @@ -376,9 +372,6 @@ public void run() throws RaLibToolException { } System.out.println("=============================== STOP ==============================="); - System.out.println("FINAL HYP:------------------------------------------"); - System.out.println(hyp); - System.out.println("----------------------------------------------------"); SimpleProfiler.logResults(); System.out.println("ce lengths (original): " diff --git a/src/main/java/de/learnlib/ralib/tools/classanalyzer/ClasssAnalyzerDataWordSUL.java b/src/main/java/de/learnlib/ralib/tools/classanalyzer/ClasssAnalyzerDataWordSUL.java index 337281ac..58e7d33c 100644 --- a/src/main/java/de/learnlib/ralib/tools/classanalyzer/ClasssAnalyzerDataWordSUL.java +++ b/src/main/java/de/learnlib/ralib/tools/classanalyzer/ClasssAnalyzerDataWordSUL.java @@ -159,9 +159,13 @@ private Object resolve(DataValue d) { } private boolean isFresh(DataType t, Object id) { - Map map = this.buckets.get(t); - if (consts.values().stream().filter(d -> d.getType().equals(t) && d.getId().equals(id)).findAny().isPresent()) + if (consts.values() + .stream() + .filter(d -> d.getType().equals(t) && d.getId().equals(id)) + .findAny() + .isPresent()) return false; + Map map = this.buckets.get(t); return map == null || !map.containsValue(id); }