diff options
Diffstat (limited to 'Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations')
14 files changed, 176 insertions, 0 deletions
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcC.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcC.xtendbin new file mode 100644 index 00000000..0c2cbb6e --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcC.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcEDA.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcEDA.xtendbin new file mode 100644 index 00000000..056bbf88 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcEDA.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMPC.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMPC.xtendbin new file mode 100644 index 00000000..40092f54 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMPC.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMetric.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMetric.xtendbin new file mode 100644 index 00000000..ae757bb6 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMetric.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMetric2.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMetric2.xtendbin new file mode 100644 index 00000000..ed2b817f --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcMetric2.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNA.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNA.xtendbin new file mode 100644 index 00000000..6d0da896 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNA.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNDA.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNDA.xtendbin new file mode 100644 index 00000000..a50e372c --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNDA.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNDC.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNDC.xtendbin new file mode 100644 index 00000000..8d56931d --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcNDC.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRCNT.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRCNT.xtendbin new file mode 100644 index 00000000..0641ed7b --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRCNT.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRNUM.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRNUM.xtendbin new file mode 100644 index 00000000..99dd130b --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRNUM.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRTOT.xtendbin b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRTOT.xtendbin new file mode 100644 index 00000000..d397ff4c --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.CalcSQRTOT.xtendbin | |||
Binary files differ | |||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.gitignore b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.gitignore new file mode 100644 index 00000000..f2c394d6 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/.gitignore | |||
@@ -0,0 +1,20 @@ | |||
1 | /.CalculationsNA.java._trace | ||
2 | /.CalcNA.java._trace | ||
3 | /.CalcMPC.java._trace | ||
4 | /.CalcMetric.java._trace | ||
5 | /.CalcNDA.java._trace | ||
6 | /.CalcNDC.java._trace | ||
7 | /.CalcEDA.java._trace | ||
8 | /.CalcC.java._trace | ||
9 | /.CalcSQR.java._trace | ||
10 | /.CalcSQRtot.java._trace | ||
11 | /.CalcSQRMAX.java._trace | ||
12 | /.CalcSQRTOT.java._trace | ||
13 | /.CalcSQROSZ.java._trace | ||
14 | /.CalcSQROSZ2.java._trace | ||
15 | /.CalcSQROCOOL.java._trace | ||
16 | /.CalcSQRCNT.java._trace | ||
17 | /.CalcSQRNUM.java._trace | ||
18 | /.SQROSZ.java._trace | ||
19 | /.CalcSQRCC.java._trace | ||
20 | /.CalcMetric2.java._trace | ||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/CalcSQRMAX.xtend_ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/CalcSQRMAX.xtend_ new file mode 100644 index 00000000..071abe38 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/CalcSQRMAX.xtend_ | |||
@@ -0,0 +1,87 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.realistic.metrics.calculations | ||
2 | |||
3 | import ca.mcgill.ecse.dslreasoner.realistic.metrics.examples.Util | ||
4 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.PartialInterpretation2ImmutableTypeLattice | ||
5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | ||
6 | import java.util.HashMap | ||
7 | import java.util.Map | ||
8 | import java.util.Set | ||
9 | import org.eclipse.emf.ecore.EObject | ||
10 | |||
11 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | ||
12 | |||
13 | class CalcSQRMAX extends CalcMetric{ | ||
14 | |||
15 | // /////////////////// | ||
16 | // SQRMAX(v) = # squares containing v / (# neighbours of v * max # of neeighbours of any neighbour of v) | ||
17 | // /////////////////// | ||
18 | static val neighbourhoodComputer = new PartialInterpretation2ImmutableTypeLattice | ||
19 | |||
20 | override calcFromModel(EObject model) { | ||
21 | val nodes = model.eResource.allContents.toList | ||
22 | |||
23 | // fill HashSet | ||
24 | var Map<EObject, Set<EObject>> node2Neighbours = new HashMap | ||
25 | Util.fillWithNodes(nodes, node2Neighbours) | ||
26 | |||
27 | // iterate over nodes and add connected nodes | ||
28 | Util.getNeighboursList(nodes, node2Neighbours) | ||
29 | |||
30 | // Measurements | ||
31 | var totalC = 0.0 | ||
32 | var max2ndNeighbours = 0.0 | ||
33 | var num1stNeighbours = 0.0 | ||
34 | for (node : nodes) { | ||
35 | val neighbours = node.lookup(node2Neighbours) | ||
36 | num1stNeighbours = neighbours.size | ||
37 | max2ndNeighbours = 0 | ||
38 | var numSquares = 0.0 | ||
39 | for (neighbour1 : neighbours) { | ||
40 | for (neighbour2 : neighbours) { | ||
41 | if (neighbour1 != neighbour2) { | ||
42 | val neighsOfNeigh = neighbour1.lookup(node2Neighbours) | ||
43 | if (max2ndNeighbours < neighsOfNeigh.size) { | ||
44 | max2ndNeighbours = neighsOfNeigh.size | ||
45 | } | ||
46 | for (neighOfNeigh1 : neighsOfNeigh) { | ||
47 | if (neighOfNeigh1 != node && neighOfNeigh1.lookup(node2Neighbours).contains(neighbour2)) { | ||
48 | // print(neighbour1) | ||
49 | // print(" ") | ||
50 | // print(neighbour2) | ||
51 | // print(" ") | ||
52 | // print(neighOfNeigh1) | ||
53 | // println() | ||
54 | numSquares++ | ||
55 | } | ||
56 | } | ||
57 | |||
58 | } | ||
59 | } | ||
60 | } | ||
61 | // println(node) | ||
62 | val num2ndNeighbours = num1stNeighbours * max2ndNeighbours | ||
63 | |||
64 | // print("(" + numSquares + "x" + num2ndNeighbours) | ||
65 | var sqr = 0.0 | ||
66 | if (num2ndNeighbours != 0) { | ||
67 | sqr = numSquares / num2ndNeighbours | ||
68 | } | ||
69 | |||
70 | // println("=" + sqr + ")") | ||
71 | totalC += sqr | ||
72 | } | ||
73 | val numNodes = nodes.length | ||
74 | val avgC = totalC / numNodes | ||
75 | |||
76 | return avgC | ||
77 | } | ||
78 | |||
79 | override calcFromNHLattice(PartialInterpretation pm) { | ||
80 | return 0.0 | ||
81 | // return getCfromNHLattice(pm, 2, v) | ||
82 | } | ||
83 | |||
84 | override calcFromNHLattice(PartialInterpretation pm, Integer depth) { | ||
85 | return 0.0 | ||
86 | } | ||
87 | } \ No newline at end of file | ||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/CalcSQROSZ2.xtend_ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/CalcSQROSZ2.xtend_ new file mode 100644 index 00000000..e999d62f --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/bin/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculations/CalcSQROSZ2.xtend_ | |||
@@ -0,0 +1,69 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.realistic.metrics.calculations | ||
2 | |||
3 | import ca.mcgill.ecse.dslreasoner.realistic.metrics.examples.Util | ||
4 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.PartialInterpretation2ImmutableTypeLattice | ||
5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | ||
6 | import java.util.HashMap | ||
7 | import java.util.Map | ||
8 | import java.util.Set | ||
9 | import org.eclipse.emf.ecore.EObject | ||
10 | |||
11 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | ||
12 | |||
13 | class CalcSQROSZ2 extends CalcMetric { | ||
14 | |||
15 | // /////////////////// | ||
16 | // SQROSZ2(v) = # depth-4 paths that lead to v / total # depth-4 paths | ||
17 | // /////////////////// | ||
18 | static val neighbourhoodComputer = new PartialInterpretation2ImmutableTypeLattice | ||
19 | |||
20 | override calcFromModel(EObject model) { | ||
21 | val nodes = model.eResource.allContents.toList | ||
22 | |||
23 | // fill HashSet | ||
24 | var Map<EObject, Set<EObject>> node2Neighbours = new HashMap | ||
25 | Util.fillWithNodes(nodes, node2Neighbours) | ||
26 | |||
27 | // iterate over nodes and add connected nodes | ||
28 | Util.getNeighboursList(nodes, node2Neighbours) | ||
29 | |||
30 | // Measurements | ||
31 | var totalSQR = 0.0 | ||
32 | var totalDenom = 0.0 | ||
33 | var num4thNeighbours = 0.0 | ||
34 | for (node : nodes) { | ||
35 | val neighbours = node.lookup(node2Neighbours) | ||
36 | |||
37 | for (neighbour1 : neighbours) { | ||
38 | val neighbours1 = neighbour1.lookup(node2Neighbours) | ||
39 | |||
40 | for (neighbour2 : neighbours1) { | ||
41 | val neighbours2 = neighbour2.lookup(node2Neighbours) | ||
42 | |||
43 | for (neighbour3 : neighbours2) { | ||
44 | val neighbours3 = neighbour3.lookup(node2Neighbours) | ||
45 | num4thNeighbours = neighbours3.size | ||
46 | |||
47 | if (neighbours3.contains(node)) { | ||
48 | totalSQR += 1 | ||
49 | } | ||
50 | totalDenom += num4thNeighbours | ||
51 | } | ||
52 | } | ||
53 | } | ||
54 | |||
55 | } | ||
56 | val avgSQR = totalSQR / totalDenom | ||
57 | |||
58 | return avgSQR | ||
59 | } | ||
60 | |||
61 | override calcFromNHLattice(PartialInterpretation pm) { | ||
62 | return 0.0 | ||
63 | // return getCfromNHLattice(pm, 2, v) | ||
64 | } | ||
65 | |||
66 | override calcFromNHLattice(PartialInterpretation pm, Integer depth) { | ||
67 | return 0.0 | ||
68 | } | ||
69 | } \ No newline at end of file | ||