Package net.maswag.falcaun
Class AbstractSelectEQOracle
java.lang.Object
net.maswag.falcaun.AbstractSelectEQOracle
- All Implemented Interfaces:
EquivalenceOracle<net.automatalib.automaton.transducer.MealyMachine<?,,String, ?, String>, String, net.automatalib.word.Word<String>> EquivalenceOracle.MealyEquivalenceOracle<String,,String> EvaluationCountable,EvaluationCountable.MealyEquivalenceOracle<String,String>
- Direct Known Subclasses:
HillClimbingEQOracle,MutateSelectEQOracle
public abstract class AbstractSelectEQOracle
extends Object
implements EquivalenceOracle.MealyEquivalenceOracle<String,String>, EvaluationCountable.MealyEquivalenceOracle<String,String>
Abstract class for implementing equivalence oracles that select test cases based on a cost function.
This class serves as a foundational framework for generating and evaluating test cases aimed at finding
counterexamples in Mealy machines. It is designed to be extended by specific implementations that define
the logic for selecting test cases and evaluating their costs.
- Author:
- Masaki Waga <masakiwaga@gmail.com>
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.learnlib.oracle.EquivalenceOracle
EquivalenceOracle.DFAEquivalenceOracle<I extends Object>, EquivalenceOracle.MealyEquivalenceOracle<I extends Object,O extends Object>, EquivalenceOracle.MooreEquivalenceOracle<I extends Object, O extends Object> Nested classes/interfaces inherited from interface net.maswag.falcaun.EvaluationCountable
EvaluationCountable.MealyEquivalenceOracle<I,O>, EvaluationCountable.Sum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe number of child test cases generated from each successful (good) sample.A list containing the current set of test cases that are being evaluated.private intA counter that keeps track of the total number of test cases evaluated during the search process.protected intThe number of initial test cases generated to start the evaluation process.private intThe length of each generated test word.private static final org.slf4j.LoggerLogger instance for this class, used for logging debug and error information during the execution of the equivalence oracle.The property oracle responsible for checking whether a specific property (e.g., an LTL formula) is disproved by the generated test cases.private intThe maximum number of test cases to evaluate before terminating the search for counterexamples.protected NumericMembershipOracleCostThe membership oracle responsible for evaluating the generated test cases against the Mealy machine.private doubleMinimum cost observed during the evaluation process.protected RandomRandom number generator used for generating random test cases to ensure diversity in the test suite.protected booleanA flag that indicates whether the word generation process should be reset.A list containing all possible input symbols that can be used in the test cases. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSelectEQOracle(NumericMembershipOracleCost memOracle, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord) Constructs an instance ofAbstractSelectEQOraclewith the specified parameters.AbstractSelectEQOracle(NumericMembershipOracleCost memOracle, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord, PropertyOracle.MealyPropertyOracle<String, String, String> ltlOracle) Constructs an instance ofAbstractSelectEQOraclewith the specified parameters, including a property oracle. -
Method Summary
Modifier and TypeMethodDescriptioncreateNextGeneration(List<net.automatalib.word.Word<String>> goodSamples) Generates the next set of test cases based on the provided list of successful (good) samples.@Nullable DefaultQuery<String,net.automatalib.word.Word<String>> findCounterExample(net.automatalib.automaton.transducer.MealyMachine<?, String, ?, String> hypothesis, Collection<? extends String> inputs) Finds a counterexample to the given hypothesis Mealy machine using the specified set of input symbols.private net.automatalib.word.Word<String>generateTestWord(List<? extends String> symbolList) Generates a random test word of the specified length using the provided list of possible input symbols.private booleanChecks if a property has been disproved by evaluating the minimum observed cost.private voidResets the list of current samples by clearing it and generating a new set of random test words.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.maswag.falcaun.EvaluationCountable
getEvaluateCount
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGERLogger instance for this class, used for logging debug and error information during the execution of the equivalence oracle. -
random
Random number generator used for generating random test cases to ensure diversity in the test suite. -
generationSize
protected int generationSizeThe number of initial test cases generated to start the evaluation process. This parameter determines the diversity and coverage of the initial set of test cases. -
childrenSize
protected int childrenSizeThe number of child test cases generated from each successful (good) sample. This parameter controls the diversity and depth of the test case generation process. -
symbolList
A list containing all possible input symbols that can be used in the test cases. This list defines the alphabet of inputs for the Mealy machine being tested. -
memOracle
The membership oracle responsible for evaluating the generated test cases against the Mealy machine. It provides the cost associated with each test case and determines whether it is a counterexample. -
length
private int lengthThe length of each generated test word. This parameter defines how long each test case will be, affecting the complexity and coverage of the tests. -
maxTests
private int maxTestsThe maximum number of test cases to evaluate before terminating the search for counterexamples. This parameter prevents infinite loops and ensures that the process does not run indefinitely. -
resetWord
protected boolean resetWordA flag that indicates whether the word generation process should be reset. If set to true, it will clear and regenerate the initial set of test cases. -
currentSamples
A list containing the current set of test cases that are being evaluated. This list is updated as new generations of test cases are generated and evaluated. -
ltlOracle
The property oracle responsible for checking whether a specific property (e.g., an LTL formula) is disproved by the generated test cases. If provided, it overrides the cost-based evaluation mechanism. -
evaluateCount
private int evaluateCountA counter that keeps track of the total number of test cases evaluated during the search process. This helps in monitoring the progress and performance of the equivalence oracle. -
minCost
private double minCostMinimum cost observed during the evaluation process.
-
-
Constructor Details
-
AbstractSelectEQOracle
AbstractSelectEQOracle(NumericMembershipOracleCost memOracle, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord) Constructs an instance ofAbstractSelectEQOraclewith the specified parameters. This constructor initializes the equivalence oracle without a property oracle, relying solely on the cost function provided by the membership oracle to evaluate test cases.- Parameters:
memOracle- The membership oracle used to evaluate test cases and provide costs.length- The length of each generated test word.random- Random number generator for generating diverse test cases.maxTests- Maximum number of test cases to evaluate before terminating the search process.generationSize- Size of the initial set of test cases generated at the start.childrenSize- Number of child test cases generated from each successful (good) sample.resetWord- Flag indicating whether to reset the word generation process, clearing and regenerating the initial set of test cases if true.
-
AbstractSelectEQOracle
AbstractSelectEQOracle(NumericMembershipOracleCost memOracle, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord, PropertyOracle.MealyPropertyOracle<String, String, String> ltlOracle) Constructs an instance ofAbstractSelectEQOraclewith the specified parameters, including a property oracle. This constructor initializes the equivalence oracle with both a membership oracle and a property oracle, allowing it to evaluate test cases based on both cost functions and specific properties (e.g., LTL formulas).- Parameters:
memOracle- The membership oracle used to evaluate test cases and provide costs.length- The length of each generated test word.random- Random number generator for generating diverse test cases.maxTests- Maximum number of test cases to evaluate before terminating the search process.generationSize- Size of the initial set of test cases generated at the start.childrenSize- Number of child test cases generated from each successful (good) sample.resetWord- Flag indicating whether to reset the word generation process, clearing and regenerating the initial set of test cases if true.ltlOracle- The property oracle used to check if a specific property is disproved by the generated test cases. If provided, it overrides the cost-based evaluation mechanism.
-
-
Method Details
-
resetSamples
private void resetSamples()Resets the list of current samples by clearing it and generating a new set of random test words. This method is used to refresh the initial set of test cases when necessary. -
isDisproved
private boolean isDisproved()Checks if a property has been disproved by evaluating the minimum observed cost. If a property oracle is provided, it checks whether the property is disproved using the oracle; otherwise, it checks if the minimum observed cost is less than zero.- Returns:
trueif the property is disproved,falseotherwise.
-
findCounterExample
@Nullable public @Nullable DefaultQuery<String,net.automatalib.word.Word<String>> findCounterExample(net.automatalib.automaton.transducer.MealyMachine<?, String, ?, String> hypothesis, Collection<? extends String> inputs) Finds a counterexample to the given hypothesis Mealy machine using the specified set of input symbols. This method generates and evaluates test cases to determine if there is any input that causes the hypothesis to produce an output different from the expected output.- Specified by:
findCounterExamplein interfaceEquivalenceOracle<net.automatalib.automaton.transducer.MealyMachine<?,String, ?, String>, String, net.automatalib.word.Word<String>> - Parameters:
hypothesis- The Mealy machine hypothesis to be tested.inputs- A collection of possible input symbols for generating test cases.- Returns:
- A
DefaultQueryrepresenting a counterexample if found, ornullif no counterexample is discovered within the specified constraints.
-
generateTestWord
Generates a random test word of the specified length using the provided list of possible input symbols. This method is used to create initial test cases for evaluation.- Parameters:
symbolList- A list containing all possible input symbols that can be used in the test cases.- Returns:
- A randomly generated
Wordof the specified length.
-
createNextGeneration
abstract List<net.automatalib.word.Word<String>> createNextGeneration(List<net.automatalib.word.Word<String>> goodSamples) Generates the next set of test cases based on the provided list of successful (good) samples. This method is responsible for creating new test cases that are derived from the current set of successful samples, ensuring a diverse and evolving set of test cases.- Parameters:
goodSamples- A list of successful test cases used as the basis for generating the next generation of test cases.- Returns:
- A list of newly generated test cases for the next evaluation cycle.
-