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
Next revisionBoth sides next revision
how_to_use [2018/01/24 13:11] adminhow_to_use [2018/01/27 15:19] liyong
Line 8: Line 8:
  
  
-Below we demonstrate how to use our learner to learn the ω-regular language L=a<sup>ω</sup>b<sup>ω</sup>. Please make sure you have all dependent libraries when you use ROLL.+Below we demonstrate how to use our learner to learn the ω-regular language L=a<sup>ω</sup>ab<sup>ω</sup>. Please make sure you have all dependent libraries when you use ROLL.
      
 === Prepare a BA file === === Prepare a BA file ===
Line 16: Line 16:
 a,[0]->[1] a,[0]->[1]
 a,[1]->[1] a,[1]->[1]
-b,[0]->[2]+a,[0]->[2]
 b,[2]->[2] b,[2]->[2]
 [1] [1]
 [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 60: Line 82:
 === Call a learner and specify the BA construction === === Call a learner and specify the BA construction ===
 <code java> <code java>
-// specify FDFA learner, here we use tree-based periodic FDFA learner+// use the under-approximation method to construct a BA from an FDFA 
 +options.approximation = Options.Approximation.UNDER; 
 +// 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) {
 +       // input teacher as a membership oracle for the learner
        learner = new LearnerNBALDollar(options, nba.getAlphabet(), teacher);        learner = new LearnerNBALDollar(options, nba.getAlphabet(), teacher);
 }else if(options.algorithm == Options.Algorithm.PERIODIC }else if(options.algorithm == Options.Algorithm.PERIODIC
Line 109: Line 136:
 </code> </code>
  
-The complete code is the class roll.main.Executor+The complete code is the class roll.main.Executor
 + 
 +====== Set up ROLL in Eclipse ====== 
 +This tutorial has been tested on the following distributions: 
 +  * Ubuntu 16.04 LTS, 64-bits 
 +=====  Prerequisites ===== 
 + 
 + 
 +  *  Java Development Kit (only tested with JDK 8.0) 
 +  *  [[https://eclipse.org/oxygen/|Eclipse Oxygen]] 
 +  *  Javacc plugin in Eclipse 
 +  *  Maven Integration for Eclipse 
 +  *  [[https://spot.lrde.epita.fr|SPOT]] (only if you want to run some JUnit tests via autfilt in SPOT) 
 + 
 +===== Set up ROLL in Eclipse ===== 
 + 
 + 
 +1. Use following command to clone the repository to your local file system. 
 +<code> 
 +    git clone https://github.com/ISCAS-PMC/roll-library 
 +</code> 
 +2. Import roll-library as Maven Existing Projects. 
 + 
 +You may have life cycle problem with Javacc in pom.xml but this can be fixed by the operations suggested by Eclipse. Then you should be able to run ROLL as a java application by choosing roll.main.ROLL as the main class. 
 ===== 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.txt · Last modified: 2018/03/29 16:54 by liyong