diff options
author | René den Hertog | 2017-10-26 17:34:51 +0200 |
---|---|---|
committer | René den Hertog | 2017-10-26 17:34:51 +0200 |
commit | ac914c719d401c44cb2633127952b022bf563ff3 (patch) | |
tree | f7d2399b2ab6cddb86aa996096581a397ff407b9 /assignments/assignment2/Bounded Retransmission Protocol Tester/Source/basiclearner/ExampleExperiment.java | |
parent | Finish assignment 2, part 1 (diff) |
'Bounded Retransmission Protocol' Blob
Diffstat (limited to 'assignments/assignment2/Bounded Retransmission Protocol Tester/Source/basiclearner/ExampleExperiment.java')
-rw-r--r-- | assignments/assignment2/Bounded Retransmission Protocol Tester/Source/basiclearner/ExampleExperiment.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/assignments/assignment2/Bounded Retransmission Protocol Tester/Source/basiclearner/ExampleExperiment.java b/assignments/assignment2/Bounded Retransmission Protocol Tester/Source/basiclearner/ExampleExperiment.java new file mode 100644 index 0000000..3f67622 --- /dev/null +++ b/assignments/assignment2/Bounded Retransmission Protocol Tester/Source/basiclearner/ExampleExperiment.java @@ -0,0 +1,41 @@ +package basiclearner; + +import com.google.common.collect.ImmutableSet; +import de.learnlib.api.SUL; + +import java.io.IOException; +import java.util.Collection; + +/** + * Created by ramon on 13-12-16. + */ +public class ExampleExperiment { + /** + * Example of how to call a learner in a simple way with this class. Learns the ExampleSUL. + * @param args + * @throws IOException + */ + public static void main(String [] args) throws IOException { + // Load the actual SUL-class + // For a SUL over a socket, use the SocketSUL-class + // You can also program an own SUL-class if you extend SUL<String,String> (or SUL<S,T> in + // general, with S and T the input and output types - but this class assumes strings) + SUL<String,String> sul = new ExampleSUL(); + + // the input alphabet + Collection<String> inputAlphabet = ImmutableSet.of("a", "b", "c"); + + try { + // runControlledExperiment for detailed statistics, runSimpleExperiment for just the result + BasicLearner.runControlledExperiment(sul, BasicLearner.LearningMethod.LStar, BasicLearner.TestingMethod.RandomWalk, inputAlphabet); + } finally { + if (sul instanceof AutoCloseable) { + try { + ((AutoCloseable) sul).close(); + } catch (Exception exception) { + // should not happen + } + } + } + } +} |