de.ls5.jlearn.algorithms.packs
Class ObservationPack

java.lang.Object
  extended by de.ls5.jlearn.algorithms.packs.ObservationPack
All Implemented Interfaces:
Learner, ObservableDataStructure, DotPlottable, GraphPlottable, Plottable, TextPlottable

public class ObservationPack
extends Object
implements Learner, ObservableDataStructure, DotPlottable, TextPlottable, GraphPlottable

Author:
fh

Constructor Summary
ObservationPack()
           
ObservationPack(boolean fsa)
           
 
Method Summary
 boolean addCounterExample(Word example, Word output)
          Process a counterexample.
 int addLetter(Symbol letter)
          will add a letter to the input alphabet and will extend the set of long prefixes (one-letter extensions) accordingly
 void addPrefix(Word w)
          add a new prefix to the observations adding arbitrary words to the pack may break the algorithm: thus it will be checked that prefix of w is access sequence
 void addSuffix(Word suffix)
          Add given Word to the internal set of suffixes of this Learner.
 void addSuffixLocally(Word suffix, Word as)
           
 Class<? extends Plottable>[] getFormats()
          returns an array of currently available plotable formats.
 Alphabet getInputs()
           
 Automaton getResult()
          Provides the current hypothesis as Automaton object
 SelectiveExploration getSelectiveExploration()
           
 int getSigma()
          Return the size of the internal Alphabet this Learner uses to construct a hypothesis.
 boolean hasSelectiveExploration()
           
 void learn()
          Starts the learning algorithm, returns once a hypothesis has been constructed
 String plotAsDot()
          returns a dot view on the plotable objejt
 de.ls5.layouter.api.model.Graph plotAsGraph()
          Will plot this polatbale as Graph
 String plotAsString()
          Will plot this polatbale as String
 void setAlphabet(Alphabet alphabet)
          Specifies the Alphabet used for construction of the hypothesis
 void setCheckSemanticSuffixClosedness(boolean checkSemanticSuffixClosedness)
          set wether consistency checks should be omitted
 void setdInit(Collection<Word> dInit)
           
 void setFullTraces(boolean fullTraces)
           
 void setHypothesisChangeListener(HypothesisChangeListener listener)
           
 void setOracle(Oracle oracle)
          Set the Oracle to be queried during the learning process
 void setSelectiveExploration(SelectiveExploration selector)
           
 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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObservationPack

public ObservationPack()

ObservationPack

public ObservationPack(boolean fsa)
Method Detail

addPrefix

public void addPrefix(Word w)
               throws LearningException
add a new prefix to the observations adding arbitrary words to the pack may break the algorithm: thus it will be checked that prefix of w is access sequence

Parameters:
w -
Throws:
LearningException

learn

public void learn()
           throws LearningException
Description copied from interface: Learner
Starts the learning algorithm, returns once a hypothesis has been constructed

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
Description copied from interface: Learner
Process a counterexample. Usually invoked once a hypothesis was constructed and an EquivalenceOracle found proof (a counterexample) for diverging behavior between the hypothesis and the System Under Test (SUT).

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

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

addSuffixLocally

public void addSuffixLocally(Word suffix,
                             Word as)

getInputs

public Alphabet getInputs()
Returns:
the inputs

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

setAlphabet

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

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

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

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

addLetter

public int addLetter(Symbol letter)
will add a letter to the input alphabet and will extend the set of long prefixes (one-letter extensions) accordingly

Specified by:
addLetter in interface Learner
Parameters:
letter - to be added
Returns:
new size of the input alphabet

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:

setFullTraces

public void setFullTraces(boolean fullTraces)
Parameters:
fullTraces - the fullTraces to set

setdInit

public void setdInit(Collection<Word> dInit)
Parameters:
dInit - the dInit to set

setCheckSemanticSuffixClosedness

public void setCheckSemanticSuffixClosedness(boolean checkSemanticSuffixClosedness)
set wether consistency checks should be omitted


setSelectiveExploration

public void setSelectiveExploration(SelectiveExploration selector)

getSelectiveExploration

public SelectiveExploration getSelectiveExploration()

hasSelectiveExploration

public boolean hasSelectiveExploration()

setHypothesisChangeListener

public void setHypothesisChangeListener(HypothesisChangeListener listener)

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:

getFormats

public Class<? extends Plottable>[] getFormats()
Description copied from interface: Plottable
returns an array of currently available plotable formats.

Specified by:
getFormats in interface Plottable
Returns:
array of available plotable formats

plotAsDot

public String plotAsDot()
Description copied from interface: DotPlottable
returns a dot view on the plotable objejt

Specified by:
plotAsDot in interface DotPlottable
Returns:
dot view

plotAsString

public String plotAsString()
Description copied from interface: TextPlottable
Will plot this polatbale as String

Specified by:
plotAsString in interface TextPlottable
Returns:
String representation

plotAsGraph

public de.ls5.layouter.api.model.Graph plotAsGraph()
Description copied from interface: GraphPlottable
Will plot this polatbale as Graph

Specified by:
plotAsGraph in interface GraphPlottable
Returns:
String representation


Copyright © 2011. All Rights Reserved.