From ac914c719d401c44cb2633127952b022bf563ff3 Mon Sep 17 00:00:00 2001 From: René den Hertog Date: Thu, 26 Oct 2017 17:34:51 +0200 Subject: 'Bounded Retransmission Protocol' Blob --- .../Source/basiclearner/ExampleExperiment.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 assignments/assignment2/Bounded Retransmission Protocol Tester/Source/basiclearner/ExampleExperiment.java (limited to 'assignments/assignment2/Bounded Retransmission Protocol Tester/Source/basiclearner/ExampleExperiment.java') 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 (or SUL in + // general, with S and T the input and output types - but this class assumes strings) + SUL sul = new ExampleSUL(); + + // the input alphabet + Collection 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 + } + } + } + } +} -- cgit v1.2.3