1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package brpcompare;
import com.google.common.collect.ImmutableSet;
import net.automatalib.util.automata.Automata;
import net.automatalib.words.Word;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Collection;
/**
* Created by petra on 14-12-16.
*/
public class BRPCompare {
public static void main(String[] args) throws IOException {
// String model1 = "/hypothesis0.dot",
// model2 = "/hypothesis1.dot";
String model1 = "/Final Model Of " + args[0] + ".dot",
model2 = "/Final Model Of Reference.dot";
Collection<String> inputAlphabet = ImmutableSet.of("IACK", "IREQ_0_0_0", "IREQ_0_0_1", "IREQ_0_1_0", "IREQ_0_1_1", "IREQ_1_0_0", "IREQ_1_0_1", "IREQ_1_1_0", "IREQ_1_1_1", "ISENDFRAME", "ITIMEOUT");
GraphvizParser p = new GraphvizParser(Paths.get(new File("").getAbsolutePath().concat(model1)));
GraphvizParser p2 = new GraphvizParser(Paths.get(new File("").getAbsolutePath().concat(model2)));
try {
Word<String> compareResult = Automata.findSeparatingWord(p.createMachine(), p2.createMachine(), inputAlphabet);
if(compareResult == null) {
System.out.println("The automata are equal!");
} else {
System.out.println("The automata are not equal! A counterexample is: " + compareResult);
}
} catch (NullPointerException e) {
e.printStackTrace();
System.err.println("Did you compare with the right input alphabet?");
}
}
}
|