From 0ef5412cdab897a9738f4987d00911457ad2151d Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Wed, 20 Apr 2011 10:05:48 +0000 Subject: [PATCH] Output format of simulator traces (from -simpath or GUI export) matches GUI better. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@2820 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/simulator/PathFull.java | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/prism/src/simulator/PathFull.java b/prism/src/simulator/PathFull.java index a1a7c027..96b16320 100644 --- a/prism/src/simulator/PathFull.java +++ b/prism/src/simulator/PathFull.java @@ -417,15 +417,16 @@ public class PathFull extends Path } // Write header - log.print("step"); + log.print("action"); + log.print(colSep + "step"); + if (stochastic) + log.print(colSep + (timeCumul ? "time" : "time_in_state")); if (vars == null) for (j = 0; j < nv; j++) log.print(colSep + engine.getVariableName(j)); else for (j = 0; j < varsNum; j++) log.print(colSep + engine.getVariableName(varsIndices[j])); - if (stochastic) - log.print(colSep + (timeCumul ? "time" : "time_in_state")); if (numRewardStructs == 1) { log.print(colSep + "state_reward" + colSep + "transition_reward"); } else { @@ -450,8 +451,17 @@ public class PathFull extends Path continue; } } + // write action + log.print(i == 0 ? "-" : getModuleOrAction(i - 1)); // write state index + log.print(colSep); log.print(i); + // print time (if continuous time) + if (stochastic) { + d = (i < n - 1) ? getTime(i) : 0.0; + log.print(colSep + (timeCumul ? t : d)); + t += d; + } // write vars if (vars == null) { for (j = 0; j < nv; j++) { @@ -464,11 +474,7 @@ public class PathFull extends Path log.print(getState(i).varValues[varsIndices[j]]); } } - if (stochastic) { - d = (i < n - 1) ? getTime(i) : 0.0; - log.print(colSep + (timeCumul ? t : d)); - t += d; - } + // write rewards for (j = 0; j < numRewardStructs; j++) { log.print(colSep + ((i < n - 1) ? getStateReward(i, j) : 0.0)); log.print(colSep + ((i < n - 1) ? getTransitionReward(i, j) : 0.0));