User Tools

Site Tools


how_to_use

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
how_to_use [2018/01/24 14:15] adminhow_to_use [2018/03/29 16:54] (current) liyong
Line 21: Line 21:
 [2] [2]
 </code> </code>
 +In ROLL, one can create the above Büchi automaton as follows:
 +<code java>
 +// first create an alphabet
 +Alphabet alphabet = new Alphabet();
 +alphabet.addLetter('a');
 +alphabet.addLetter('b');
 +// create an NBA with alphabet
 +NBA target = new NBA(alphabet);
 +target.createState();
 +target.createState();
 +target.createState();
 +        
 +// add transitions for NBA recognizing a^w + ab^w
 +int fst = 0, snd = 1, thd = 2;
 +target.getState(fst).addTransition(alphabet.indexOf('a'), snd);
 +target.getState(fst).addTransition(alphabet.indexOf('a'), thd);
 +target.getState(snd).addTransition(alphabet.indexOf('a'), snd);
 +target.getState(thd).addTransition(alphabet.indexOf('b'), thd);
 +target.setInitial(fst);
 +target.setFinal(snd);
 +target.setFinal(thd);
  
 +</code>
 === Prepare a HANOI file === === Prepare a HANOI file ===
 The input automaton should have only one initial state. The input automaton should have only one initial state.
Line 62: Line 84:
 // use the under-approximation method to construct a BA from an FDFA // use the under-approximation method to construct a BA from an FDFA
 options.approximation = Options.Approximation.UNDER; options.approximation = Options.Approximation.UNDER;
-// specify FDFA learner, here we use tree-based periodic FDFA learner+// set NBA learner, here we use tree-based syntactic FDFA learner 
 +options.algorithm = Options.Algorithm.SYNTACTIC; 
 +options.structure = Options.Structure.TREE;
 LearnerBase<NBA> learner = null; LearnerBase<NBA> learner = null;
 if(options.algorithm == Options.Algorithm.NBA_LDOLLAR) { if(options.algorithm == Options.Algorithm.NBA_LDOLLAR) {
-       learner = new LearnerNBALDollar(options, nba.getAlphabet(), teacher);+       // input teacher as a membership oracle for the learner 
 +       learner = new LearnerNBALDollar(options, target.getAlphabet(), teacher);
 }else if(options.algorithm == Options.Algorithm.PERIODIC }else if(options.algorithm == Options.Algorithm.PERIODIC
        || options.algorithm == Options.Algorithm.SYNTACTIC        || options.algorithm == Options.Algorithm.SYNTACTIC
        || options.algorithm == Options.Algorithm.RECURRENT) {        || options.algorithm == Options.Algorithm.RECURRENT) {
-       learner = new LearnerNBALOmega(options, nba.getAlphabet(), teacher);+       learner = new LearnerNBALOmega(options, target.getAlphabet(), teacher);
 } else { } else {
        throw new UnsupportedOperationException("Unsupported BA Learner");        throw new UnsupportedOperationException("Unsupported BA Learner");
Line 112: Line 137:
  
 The complete code is the class roll.main.Executor. The complete code is the class roll.main.Executor.
 +
 ===== Acknowledgement ===== ===== Acknowledgement =====
 We use [[http://www.ej-technologies.com/products/jprofiler/overview.html We use [[http://www.ej-technologies.com/products/jprofiler/overview.html
how_to_use.1516774548.txt.gz · Last modified: 2018/01/24 14:15 by admin