- Timestamp:
- 09/04/14 18:43:49 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1723 r1724 195 195 public RuleApplicationResult apply(List<IUserSession> sessions) { 196 196 RuleApplicationData appData = new RuleApplicationData(sessions); 197 File harmonized = new File("harmonized.dat");198 if(harmonized.exists() && !harmonized.isDirectory()) {199 Console.traceln(Level.INFO,"loading harmonized sessions from file");200 appData = loadAppData("harmonized");201 }202 else {197 //File harmonized = new File("harmonized.dat"); 198 //if(harmonized.exists() && !harmonized.isDirectory()) { 199 // Console.traceln(Level.INFO,"loading harmonized sessions from file"); 200 // appData = loadAppData("harmonized"); 201 //} 202 //else { 203 203 //appData.getStopWatch().start("harmonization"); 204 204 harmonizeEventTaskInstancesModel(appData); … … 207 207 //Saving intermediate results to file 208 208 Console.traceln(Level.INFO,"saving substitution matrix to file"); 209 saveAppData("harmonized");210 }211 212 File substitution = new File("substitution.dat");213 if(!(substitution.exists() && !substitution.isDirectory())) {209 //saveAppData("harmonized"); 210 //} 211 212 //File substitution = new File("substitution.dat"); 213 //if(!(substitution.exists() && !substitution.isDirectory())) { 214 214 Console.traceln(Level.INFO, "generating substitution matrix from " + appData.getUniqueTasks().size() + " unique tasks"); 215 215 appData.getStopWatch().start("substitution matrix"); 216 216 appData.getSubmat().generate(appData.getUniqueTasks()); 217 217 appData.getStopWatch().stop("substitution matrix"); 218 GlobalDataContainer.getInstance().addData("substitution", appData);219 saveAppData("substitution");220 }221 else {222 Console.traceln(Level.INFO,"loading substitution matrix from file");223 appData = loadAppData("substitution");224 }218 // GlobalDataContainer.getInstance().addData("substitution", appData); 219 // saveAppData("substitution"); 220 //} 221 //else { 222 // Console.traceln(Level.INFO,"loading substitution matrix from file"); 223 // appData = loadAppData("substitution"); 224 //} 225 225 226 226 … … 229 229 Console.traceln(Level.INFO, "Iteration Number: " + iteration); 230 230 iteration++; 231 232 231 appData.detectedAndReplacedTasks = false; 233 232 appData.getStopWatch().start("whole loop"); … … 654 653 655 654 // Generate pairwise alignments 656 appData.setMatchseqs(generatePairwiseAlignments(appData)); 655 //appData.setMatchseqs(generatePairwiseAlignments(appData)); 656 generatePairwiseAlignments(appData); 657 657 658 658 //Searching each match in all other sessions, counting its occurences … … 687 687 .get(i).getOccurences().iterator(); it.hasNext();) { 688 688 MatchOccurence oc = it.next(); 689 690 689 691 690 // Check if nothing has been replaced in the sequence we … … 732 731 } 733 732 } 734 System.out.println("Replacing ");733 System.out.println("Replacing in sequence" + oc.getSequenceId()); 735 734 ISequenceInstance sequenceInstances = RuleUtils 736 735 .createNewSubSequenceInRange(appData.getSessions() … … 747 746 } 748 747 } 749 appData.setMatchseqs(null);748 //appData.setMatchseqs(null); 750 749 appData.getStopWatch().stop("replacing tasks"); 751 750 } … … 880 879 } 881 880 882 private LinkedList<Match> generatePairwiseAlignments(RuleApplicationData appData) { 881 //private LinkedList<Match> generatePairwiseAlignments(RuleApplicationData appData) { 882 private void generatePairwiseAlignments(RuleApplicationData appData) { 883 883 int numberSeqSize = appData.getNumberSequences().size(); 884 LinkedList<Match> result;884 appData.matchseqs = new LinkedList<Match>(); 885 885 //Checking if i have an already calculated file result of this action in the working directory 886 File aligned = new File("aligned" + iteration + ".dat"); 887 if(!(aligned.exists() && !aligned.isDirectory())) { 888 Console.traceln(Level.INFO, "generating pairwise alignments from " + numberSeqSize + " sessions"); 889 result = new LinkedList<Match>(); 890 886 //File aligned = new File("aligned" + iteration + ".dat"); 887 //if(!(aligned.exists() && !aligned.isDirectory())) { 888 Console.traceln(Level.INFO, "generating pairwise alignments from " + numberSeqSize + " sessions with " + nThreads + " threads"); 891 889 ExecutorService executor = Executors.newFixedThreadPool(nThreads); 892 890 int interval = Math.round(numberSeqSize/nThreads); … … 901 899 int from = i; 902 900 int to = i+interval+offset; 903 System.out.println("Creating thread with matches from " + from + " to" + to);901 System.out.println("Creating thread for sessions " + from + " till " + to); 904 902 ParallelPairwiseAligner aligner = new ParallelPairwiseAligner(appData,from,to); 905 903 executor.execute(aligner); … … 913 911 } 914 912 915 GlobalDataContainer.getInstance().addData("aligned" + iteration, appData); 916 saveAppData("aligned" + iteration); 917 return result; 918 } 919 else { 920 Console.traceln(Level.INFO,"loading matches from file"); 921 appData = loadAppData("aligned"+iteration); 922 return appData.getMatchseqs(); 923 } 924 } 913 //GlobalDataContainer.getInstance().addData("aligned" + iteration, appData); 914 //saveAppData("aligned" + iteration); 915 // return result; 916 } 917 //else { 918 // Console.traceln(Level.INFO,"loading matches from file"); 919 // appData = loadAppData("aligned"+iteration); 920 // return appData.getMatchseqs(); 921 //} 925 922 926 923 … … 980 977 submat= new ObjectDistanceSubstitionMatrix(6,-3,false); 981 978 newTasks = new LinkedList<ITask>(); 982 983 979 this.detectedAndReplacedTasks = true; 984 980 } … … 988 984 } 989 985 990 public void setMatchseqs(LinkedList<Match> matchseqs) {991 this.matchseqs = matchseqs;992 }993 986 994 987 private ObjectDistanceSubstitionMatrix getSubmat() {
Note: See TracChangeset
for help on using the changeset viewer.