de.ls5.jlearn.algorithms.dhc
Class DHC

java.lang.Object
  extended by de.ls5.jlearn.algorithms.dhc.DHC
All Implemented Interfaces:
Learner, ObservableDataStructure

public class DHC
extends Object
implements Learner, ObservableDataStructure

Author:
merten

Constructor Summary
DHC()
          Empty constructor.
DHC(Alphabet startalphabet, Oracle oracle)
          Constructor.
 
Method Summary
 boolean addCounterExample(Word example, Word output)
          Take an counterexample, determine what prefix makes the difference, add that splitter to the alphabet, and reset the hypothesis automaton
 void addJokerSymbol(Symbol joker)
           
 int addLetter(Symbol letter)
          Insertion of new letter to the alphabet.
 void addSuffix(Word suffix)
          Add given Word to the internal set of suffixes of this Learner.
 void enableBigBatches(boolean b)
           
 void enableComlexSplitterOutput(boolean b)
           
 void enableDebugOutput(boolean b)
           
 void enableHypothesisRecording(boolean enabled)
           
 void enableMemoryLogging(boolean b)
           
 void enableSignatureDecisionTree(boolean b)
           
 void enableTraceOptimizedAutomaton(boolean b)
           
protected  void finalize()
           
 Automaton getResult()
          Provides the current hypothesis as Automaton object
 int getSigma()
          Return the size of the internal Alphabet this Learner uses to construct a hypothesis.
 void learn()
          Core of the learning algorithm.
 void setAlphabet(Alphabet startalphabet)
          Specifies the Alphabet used for construction of the hypothesis
 void setEquivalenceLookahead(int level)
           
 void setOracle(Oracle oracle)
          Set the Oracle to be queried during the learning process
 void setSplitterCreator(SplitterCreator splitterCreator)
          Setter for the SplitterCreator, which encapsulates logic for dealing with counterexamples (logic that, e.g., determines a suffix of the counterexample that witnesses unequality of states, thus "splitting" a state in the hypothesis).
 String toDot()
          return current state of data structure as dot text.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DHC

public DHC()
Empty constructor.


DHC

public DHC(Alphabet startalphabet,
           Oracle oracle)
Constructor. Set up the hypothesis automaton, initialize the alphabet, create the query database etc. etc.

Method Detail

setSplitterCreator

public void setSplitterCreator(SplitterCreator splitterCreator)
Description copied from interface: Learner
Setter for the SplitterCreator, which encapsulates logic for dealing with counterexamples (logic that, e.g., determines a suffix of the counterexample that witnesses unequality of states, thus "splitting" a state in the hypothesis).

Specified by:
setSplitterCreator in interface Learner
Parameters:
splitterCreator - instance of SplitterCreator to be used for processing counterexamples

setAlphabet

public void setAlphabet(Alphabet startalphabet)
Description copied from interface: Learner
Specifies the Alphabet used for construction of the hypothesis

Specified by:
setAlphabet in interface Learner
Parameters:
startalphabet - Alphabet to be used for construction

setOracle

public void setOracle(Oracle oracle)
Description copied from interface: Learner
Set the Oracle to be queried during the learning process

Specified by:
setOracle in interface Learner
Parameters:
oracle - Oracle to be queried

learn

public void learn()
           throws LearningException
Core of the learning algorithm. Determine a full set of transitions for all states, trigger merging of states which have the same output signature.

Specified by:
learn in interface Learner
Throws:
LearningException - if any learning-related exception occurs an instance of this exception will be thrown

addCounterExample

public boolean addCounterExample(Word example,
                                 Word output)
                          throws ObservationConflictException
Take an counterexample, determine what prefix makes the difference, add that splitter to the alphabet, and reset the hypothesis automaton

Specified by:
addCounterExample in interface Learner
Parameters:
example - counterexample provided by the equivalence oracle
output - output produced by the SUT when processing the counterexample
Returns:
boolean flag if the counterexample was processed
Throws:
ObservationConflictException - exception that is thrown if the counterexample and its output diverges from already observed behavior

addLetter

public int addLetter(Symbol letter)
Insertion of new letter to the alphabet. Insert in such a way as that the alphabet with the lower indices are "real" letters, followed by "virtual" letters (splitters) at higher indices. The value of sigma denotes how many letters are "real". Creates a fresh hypothesis automaton. Return the index of the new letter.

Specified by:
addLetter in interface Learner
Parameters:
letter - Symbol to be additionally considered when construction a hypothesis
Returns:
index into the internal Alphabet this letter was added to

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getSigma

public int getSigma()
Description copied from interface: Learner
Return the size of the internal Alphabet this Learner uses to construct a hypothesis.

Specified by:
getSigma in interface Learner
Returns:
size of the internal alphabet

getResult

public Automaton getResult()
Description copied from interface: Learner
Provides the current hypothesis as Automaton object

Specified by:
getResult in interface Learner
Returns:
current hypothesis

enableHypothesisRecording

public void enableHypothesisRecording(boolean enabled)

addJokerSymbol

public void addJokerSymbol(Symbol joker)

enableDebugOutput

public void enableDebugOutput(boolean b)

enableBigBatches

public void enableBigBatches(boolean b)

enableSignatureDecisionTree

public void enableSignatureDecisionTree(boolean b)

enableTraceOptimizedAutomaton

public void enableTraceOptimizedAutomaton(boolean b)

enableMemoryLogging

public void enableMemoryLogging(boolean b)

enableComlexSplitterOutput

public void enableComlexSplitterOutput(boolean b)

setEquivalenceLookahead

public void setEquivalenceLookahead(int level)

addSuffix

public void addSuffix(Word suffix)
Description copied from interface: Learner
Add given Word to the internal set of suffixes of this Learner.

Specified by:
addSuffix in interface Learner
Parameters:
suffix - Word to be additionally considered when constructing a hypothesis

toDot

public String toDot()
Description copied from interface: ObservableDataStructure
return current state of data structure as dot text.

Specified by:
toDot in interface ObservableDataStructure
Returns:


Copyright © 2011. All Rights Reserved.