• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LearnLib / learnlib / 20199022329

13 Dec 2025 10:51PM UTC coverage: 94.914% (+0.4%) from 94.471%
20199022329

push

github

web-flow
Implementation for learning MMLTs, new model for collecting statistics (#153)

* Made RowImpl public to enable access in custom observation table implementations.

* Made several methods of RowImpl public, to enable external access from observation tables that are defined in the learner module.

* Started with integration of MMLT.

* Extended EquivalenceOracle.java with LocalTimerMealyEquivalenceOracle.

* Created module for symbol filters; added tests for counterexample handling for MMLT learner.

* Functions for printing stats as JSON/YAML.

* Renamed statsContainer; exporting mmlt caches.

* Included symbol-filters module in dependency management.

* Renamed fast cache to cache for MMLTs; added integration tests for MMLTs; allow access to stats during testing of learner.

* Added more test models for the MMLT learner.

* Added more test models for the MMLT learner.

* Added cache consistency test for MMLT learning.

* Removed location type parameter from LocalTimerMealyEquivalenceOracle.

* Cache for MMLTs now inherits LearningCache

* Multiple EQ tests for MMLTs can now respect the provided list of inputs for counterexamples.

* Added tests for the cache; cleaned-up some files.

* Added tests for the MMLT cache consistency test.

* Made the MMLT SUL an interface with default methods.

* Made symbol filters more independent from MMLTs

* StatisticsSymbolFilter has stats container as constructor parameter.

* Moved several MMLT examples to test-support.

* Added an example for learning MMLTs; added module info for symbol filter module.

* Added an example for learning MMLTs; added module info for symbol filter module.

* Added more descriptions for included MMLT models

* More info on model params

* Updated reset search oracle to check if it can return a counterexample with the provided inputs.

* adjust to AutomataLib refactorings

* adjust to AutomataLib refactorings

* adjust to AutomataLib refactorings

* Using correct function to render MMLT i... (continued)

1823 of 1873 new or added lines in 77 files covered. (97.33%)

1 existing line in 1 file now uncovered.

14258 of 15022 relevant lines covered (94.91%)

1.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/filters/statistics/src/main/java/de/learnlib/filter/statistic/oracle/CounterEQOracle.java
1
/* Copyright (C) 2013-2025 TU Dortmund University
2
 * This file is part of LearnLib <https://learnlib.de>.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package de.learnlib.filter.statistic.oracle;
17

18
import java.util.Collection;
19

20
import de.learnlib.oracle.EquivalenceOracle;
21
import de.learnlib.query.DefaultQuery;
22
import de.learnlib.query.Query;
23
import de.learnlib.statistic.Statistics;
24
import de.learnlib.statistic.StatisticsKey;
25
import de.learnlib.statistic.StatisticsService;
26
import org.checkerframework.checker.nullness.qual.Nullable;
27

28
/**
29
 * Wrapper for a {@link EquivalenceOracle} that gathers various statistics on queries sent to this oracle.
30
 *
31
 * @param <A>
32
 *         automaton type
33
 * @param <I>
34
 *         input symbol type
35
 * @param <D>
36
 *         output domain type
37
 */
38
public class CounterEQOracle<A, I, D> implements EquivalenceOracle<A, I, D> {
39

40
    /**
41
     * The {@link StatisticsKey} this class uses for counting the number of
42
     * {@link EquivalenceOracle#findCounterExample(Object, Collection) found counterexamples} of the equivalence
43
     * oracle.
44
     */
45
    public static final StatisticsKey KEY_COUNT = new StatisticsKey("cex-cnt", "Number of found counterexamples");
1✔
46

47
    /**
48
     * The {@link StatisticsKey} this class uses for counting the number of {@link Query#length() symbols} contained in
49
     * the found counterexamples.
50
     */
51
    public static final StatisticsKey KEY_LEN = new StatisticsKey("cex-len", "Length (cumulated) of counterexamples");
1✔
52

53
    private final EquivalenceOracle<A, I, D> delegate;
54
    private final StatisticsService statistics;
55
    private final StatisticsKey keyCount;
56
    private final StatisticsKey keyLen;
57

58
    /**
59
     * Convenience constructor for {@link CounterEQOracle#CounterEQOracle(EquivalenceOracle, String)} which uses
60
     * {@code null} as {@code id}.
61
     *
62
     * @param delegate
63
     *         the oracle to delegate calls to
64
     */
65
    public CounterEQOracle(EquivalenceOracle<A, I, D> delegate) {
NEW
66
        this(delegate, null);
×
NEW
67
    }
×
68

69
    /**
70
     * Constructs a new counter oracle that writes statistical data to a {@link StatisticsService}. The provided
71
     * {@code id} is used to refine the supported {@link StatisticsKey}s and allows for using multiple instances of this
72
     * class for different purposes.
73
     *
74
     * @param delegate
75
     *         the oracle to delegate calls to
76
     * @param id
77
     *         the id used for specialising the statistics keys
78
     */
79
    public CounterEQOracle(EquivalenceOracle<A, I, D> delegate, @Nullable String id) {
1✔
80
        this.delegate = delegate;
1✔
81
        this.statistics = Statistics.getService();
1✔
82
        this.keyCount = KEY_COUNT.withId(id);
1✔
83
        this.keyLen = KEY_LEN.withId(id);
1✔
84
    }
1✔
85

86
    @Override
87
    public @Nullable DefaultQuery<I, D> findCounterExample(A hypothesis, Collection<? extends I> inputs) {
88
        final DefaultQuery<I, D> cex = this.delegate.findCounterExample(hypothesis, inputs);
1✔
89
        if (cex != null) {
1✔
90
            statistics.increaseCounter(keyLen, cex.length(), this);
1✔
91
            statistics.increaseCounter(keyCount, this);
1✔
92
        }
93
        return cex;
1✔
94
    }
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc