diff options
Diffstat (limited to 'Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator')
-rw-r--r-- | Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend | 12 |
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 | ||