Changeset 1710
- Timestamp:
- 09/01/14 22:05:22 (10 years ago)
- Location:
- branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1707 r1710 79 79 public static int nThreads; 80 80 public static boolean harmonizeSequences; 81 public static boolean loadSubstutionMatrix; 81 82 82 83 … … 127 128 this.preparationTaskHandlingStrategy = new TaskHandlingStrategy( 128 129 minimalTaskEquality); 129 130 130 } 131 131 … … 140 140 } 141 141 142 public void saveAppData(String name) { 143 String objectName = name; 144 String filename = name + ".dat"; 145 Object dataObject = GlobalDataContainer.getInstance().getData( 146 objectName); 147 if (dataObject == null) { 148 CommandHelpers.objectNotFoundMessage(objectName); 149 } 150 FileOutputStream fos = null; 151 ObjectOutputStream out = null; 152 try { 153 fos = new FileOutputStream(filename); 154 out = new ObjectOutputStream(fos); 155 out.writeObject(dataObject); 156 out.close(); 157 } catch (IOException ex) { 158 Console.logException(ex); 159 } 160 } 161 162 public RuleApplicationData loadAppData(String name) { 163 String objectName = name; 164 String filename = name + ".dat"; 165 166 Object data = null; 167 FileInputStream fis = null; 168 ObjectInputStream in = null; 169 try { 170 fis = new FileInputStream(filename); 171 in = new ObjectInputStream(fis); 172 data = in.readObject(); 173 in.close(); 174 } catch (IOException ex) { 175 Console.logException(ex); 176 } catch (ClassNotFoundException ex) { 177 Console.logException(ex); 178 } 179 if (GlobalDataContainer.getInstance().addData(objectName, data)) { 180 CommandHelpers.dataOverwritten(objectName); 181 } 182 return (RuleApplicationData) GlobalDataContainer.getInstance().getData(name); 183 } 184 142 185 /* 143 186 * (non-Javadoc) … … 151 194 RuleApplicationData appData = new RuleApplicationData(sessions); 152 195 if(SequenceForTaskDetectionRuleAlignment.harmonizeSequences) { 196 //appData.getStopWatch().start("harmonization"); 153 197 harmonizeEventTaskInstancesModel(appData); 198 //appData.getStopWatch().stop("harmonization"); 199 GlobalDataContainer.getInstance().addData("harmonized", appData); 200 //Saving intermediate results to file 201 Console.traceln(Level.INFO,"saving substitution matrix to file"); 202 saveAppData("harmonized"); 203 } 204 else { 205 Console.traceln(Level.INFO,"loading substitution matrix from file"); 206 appData = loadAppData("harmonized"); 207 } 208 209 if(!SequenceForTaskDetectionRuleAlignment.loadSubstutionMatrix) { 154 210 Console.traceln(Level.INFO, "generating substitution matrix from " + appData.getUniqueTasks().size() + " unique tasks"); 211 appData.getStopWatch().start("substitution matrix"); 155 212 appData.getSubmat().generate(appData.getUniqueTasks()); 156 213 appData.getStopWatch().stop("substitution matrix"); 157 GlobalDataContainer.getInstance().addData("appData", appData); 158 //Saving intermediate results to file 159 Console.traceln(Level.INFO,"saving substitution matrix to file"); 160 String objectName = "appData"; 161 String filename = "appData.dat"; 162 Object dataObject = GlobalDataContainer.getInstance().getData( 163 objectName); 164 if (dataObject == null) { 165 CommandHelpers.objectNotFoundMessage(objectName); 166 } 167 FileOutputStream fos = null; 168 ObjectOutputStream out = null; 169 try { 170 fos = new FileOutputStream(filename); 171 out = new ObjectOutputStream(fos); 172 out.writeObject(dataObject); 173 out.close(); 174 } catch (IOException ex) { 175 Console.logException(ex); 176 } 214 GlobalDataContainer.getInstance().addData("substitution", appData); 215 saveAppData("substitution"); 177 216 } 178 217 else { 179 Console.traceln(Level.INFO,"loading substitution matrix from file"); 180 String objectName = "appData"; 181 String filename = "appData.dat"; 182 Object data = null; 183 FileInputStream fis = null; 184 ObjectInputStream in = null; 185 try { 186 fis = new FileInputStream(filename); 187 in = new ObjectInputStream(fis); 188 data = in.readObject(); 189 in.close(); 190 } catch (IOException ex) { 191 Console.logException(ex); 192 } catch (ClassNotFoundException ex) { 193 Console.logException(ex); 194 } 195 if (GlobalDataContainer.getInstance().addData(objectName, data)) { 196 CommandHelpers.dataOverwritten(objectName); 197 } 198 appData = (RuleApplicationData) GlobalDataContainer.getInstance().getData("appData"); 218 appData = loadAppData("substitution"); 199 219 } 200 220 … … 204 224 Console.traceln(Level.INFO, "Iteration Number: " + iteration); 205 225 iteration++; 206 226 207 227 appData.detectedAndReplacedTasks = false; 208 228 appData.getStopWatch().start("whole loop"); -
branches/autoquest-ui-core-alignment/src/main/java/de/ugoe/cs/autoquest/commands/usability/CMDgenerateTaskTree.java
r1707 r1710 45 45 @Override 46 46 public String help() { 47 return "generateTaskTree <sequences> {<tasktree>} {<boolean: harmonize sequences or not (true or false)>} { <integer: number of threads>}";47 return "generateTaskTree <sequences> {<tasktree>} {<boolean: harmonize sequences or not (true or false)>} {boolean: load substitutionmatrix} {<integer: number of threads>}"; 48 48 } 49 49 … … 71 71 String harmonize = (String) parameters.get(2); 72 72 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.harmonizeSequences = true; 73 System.out.println(harmonize); 74 if (harmonize.equals("false")) { 75 System.out.println("Not harmonizing"); 73 if (harmonize.equals("false")) { 76 74 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.harmonizeSequences = false; 77 75 } 78 76 } 79 77 if (parameters.size() > 3) { 80 String threadCount = (String) parameters.get(3); 78 String loadSubMat = (String) parameters.get(3); 79 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.loadSubstutionMatrix = false; 80 if (loadSubMat.equals("true")) { 81 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.loadSubstutionMatrix = true; 82 } 83 } 84 if (parameters.size() > 4) { 85 String threadCount = (String) parameters.get(4); 81 86 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.nThreads = 1; 82 87 try { … … 85 90 } catch (Exception e) { 86 91 throw new IllegalArgumentException( 87 "The f ourth parameter must be an integer. Did you forget to name the tasktree?");92 "The fifth parameter must be an integer. Did you forget to name the tasktree?"); 88 93 } 89 94 } 95 96 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.loadSubstutionMatrix=false; 90 97 91 98 Collection<List<Event>> sequences = null; -
branches/java-utils-alignment/src/main/java/de/ugoe/cs/util/StopWatch.java
r1707 r1710 213 213 * internally used to store splits 214 214 */ 215 private static class Split { 216 217 /** 215 private static class Split implements Serializable { 216 217 /** 218 * 219 */ 220 private static final long serialVersionUID = 7767677492954506604L; 221 222 /** 218 223 * the id of the split 219 224 */
Note: See TracChangeset
for help on using the changeset viewer.