aboutsummaryrefslogtreecommitdiffstats
path: root/Metrics
diff options
context:
space:
mode:
authorLibravatar 20001LastOrder <boqi.chen@mail.mcgill.ca>2019-05-29 09:56:55 -0400
committerLibravatar 20001LastOrder <boqi.chen@mail.mcgill.ca>2019-05-29 09:56:55 -0400
commit5f2c937412d0f8bb0442016e15e4c78e197a45ec (patch)
tree61a9cc812b149bd0c9ef8bfde4a431ea2534f996 /Metrics
parentmetric plot based on chosen rep with k-medoid method (diff)
parentcalculate metrics at the end of model generation (diff)
downloadVIATRA-Generator-5f2c937412d0f8bb0442016e15e4c78e197a45ec.tar.gz
VIATRA-Generator-5f2c937412d0f8bb0442016e15e4c78e197a45ec.tar.zst
VIATRA-Generator-5f2c937412d0f8bb0442016e15e4c78e197a45ec.zip
Merge branch 'Realistic-Generation-SURE' of https://github.com/viatra/VIATRA-Generator into Realistic-Generation-SURE
Diffstat (limited to 'Metrics')
-rw-r--r--Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend12
1 files changed, 9 insertions, 3 deletions
diff --git a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend
index 1a7e846b..d786e6f0 100644
--- a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend
+++ b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend
@@ -19,7 +19,7 @@ class PartialInterpretationMetric {
19 var static state = 0; 19 var static state = 0;
20 20
21 // calculate the metrics for a state 21 // calculate the metrics for a state
22 def static void calculateMetric(PartialInterpretation partial, String path, String currentStateId){ 22 def static void calculateMetric(PartialInterpretation partial, String path, String currentStateId, Integer counter){
23 val metrics = new ArrayList<Metric>(); 23 val metrics = new ArrayList<Metric>();
24 metrics.add(new OutDegreeMetric()); 24 metrics.add(new OutDegreeMetric());
25 metrics.add(new NodeActivityMetric()); 25 metrics.add(new NodeActivityMetric());
@@ -27,7 +27,7 @@ class PartialInterpretationMetric {
27 27
28 //make dir since the folder can be none existing 28 //make dir since the folder can be none existing
29 new File(path).mkdir(); 29 new File(path).mkdir();
30 val filename = path + "/state_"+currentStateId+".csv"; 30 val filename = path + "/state_"+currentStateId+"-"+counter+".csv";
31 state++; 31 state++;
32 val metricCalculator = new PartialInterpretationGraph(partial, metrics, currentStateId); 32 val metricCalculator = new PartialInterpretationGraph(partial, metrics, currentStateId);
33 33
@@ -44,10 +44,16 @@ class PartialInterpretationMetric {
44 // state codes that will record the trajectory 44 // state codes that will record the trajectory
45 val stateCodes = newArrayList() 45 val stateCodes = newArrayList()
46 46
47 var counter = 0
47 //transform and record the state codes for each state 48 //transform and record the state codes for each state
48 while(trajectory.doNextTransformation){ 49 while(trajectory.doNextTransformation){
49 //println(trajectory.stateCoder.createStateCode) 50 //println(trajectory.stateCoder.createStateCode)
50 stateCodes.add(trajectory.stateCoder.createStateCode.toString) 51 val stateId = trajectory.stateCoder.createStateCode.toString
52 val interpretation = trajectory.getModel();
53 //calculate metrics of current state
54 calculateMetric(interpretation as PartialInterpretation, "debug/metric/output", stateId, counter)
55 stateCodes.add(stateId)
56 counter++
51 } 57 }
52 58
53 59