Changeset 1558 for branches/ralph/src/main/java
- Timestamp:
- 05/29/14 22:43:07 (11 years ago)
- Location:
- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NumberSequence.java
r1553 r1558 25 25 this.signature = signature; 26 26 } 27 28 public void printSequence() 29 { 30 for (int i = 0; i < sequence.length; i++) { 31 System.out.format("%4d", sequence[i]); 32 } 33 System.out.println(); 34 } 27 35 28 36 } -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWaterman.java
r1555 r1558 162 162 * Get the maximum value in the score matrix. 163 163 */ 164 p rivatedouble getMaxScore() {164 public double getMaxScore() { 165 165 double maxScore = 0; 166 166 … … 184 184 } 185 185 186 187 186 188 /** 187 189 * TODO: Iterative Version!!! Output the local alignments ending in the (i, … … 272 274 } 273 275 } 274 // Note: empty alignments are not printed.275 276 } 276 277 -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/substitution/ObjectDistanceSubstitionMatrix.java
r1555 r1558 30 30 31 31 public ObjectDistanceSubstitionMatrix( 32 SymbolMap<ITaskInstance, ITask> uniqueTasks ) {32 SymbolMap<ITaskInstance, ITask> uniqueTasks,float positiveThreshold) { 33 33 this.uniqueTasks = uniqueTasks; 34 this.positiveThreshold = positiveThreshold; 34 35 idmapping = new HashMap<Integer, Integer>(); 35 36 matrix = new TriangleMatrix(uniqueTasks.size()+1); 36 37 gapPenalty = -10; 37 //Todo: Calculate this value (the mean distance between every element) before 38 positiveThreshold =7; 38 39 39 } 40 40 … … 47 47 public void generate() { 48 48 int index = 0; 49 float meandistance = 0; 49 //TODO We need to determine this parameter before generating the matrix.. 50 float meandistance = 18; 51 //TODO We need to determine this parameter before generating the matrix.. 52 float maxDistance =34; 50 53 for (Iterator<ITaskInstance> it = uniqueTasks.getSymbols().iterator(); it 51 54 .hasNext();) { … … 87 90 tempindex2 = idmapping.get(eti2.getTask().getId()); 88 91 } 89 float distance = AlignmentHelpers.distanceBetween(first, second);90 meandistance += distance;92 float distance = -1*AlignmentHelpers.distanceBetween(first, second); 93 //meandistance += distance; 91 94 92 if (distance > positiveThreshold){93 distance = -1*distance;95 if(distance > maxDistance){ 96 maxDistance = distance; 94 97 } 98 99 distance += 5; 100 101 //if (distance < positiveThreshold) { 102 // distance = -1*distance; 103 //} 104 95 105 matrix.set(tempindex1, tempindex2,distance); 96 106 97 107 } 98 108 } 99 System.out.println(meandistance/(uniqueTasks.size()*uniqueTasks.size())); 109 //System.out.println("ObjectDistanceMatrix: MaxDistance: " + maxDistance); 110 //System.out.println(meandistance/(uniqueTasks.size()*uniqueTasks.size())); 100 111 //System.out.println(idmapping.toString()); 101 112 //System.out.println(matrix.toString()); … … 104 115 105 116 } 117 118 public String toString(){ 119 return matrix.toString(); 120 } 106 121 107 122 @Override 108 123 public float getDistance(int taskId1, int taskId2) { 109 124 //System.out.println("Taskid1: " + taskId1 + " Taskid2: " + taskId2 + " Idmapping1: " + idmapping.get(taskId1) + " Idmapping2: " + idmapping.get(taskId2)); 110 111 125 return matrix.get(idmapping.get(taskId1),idmapping.get(taskId2)); 112 126 } -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/substitution/TriangleMatrix.java
r1555 r1558 33 33 for(int j = 0; j< size; j++) { 34 34 if(i<j) { 35 result = result + (this.get(i,j) + " ");35 result = result + String.format("%+4.1f",this.get(i,j)); 36 36 } 37 37 else { 38 result = result + (" ");38 result = result + (" "); 39 39 } 40 40 } -
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1557 r1558 28 28 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; 29 29 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWaterman; 30 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated; 30 31 import de.ugoe.cs.autoquest.tasktrees.alignment.substitution.ObjectDistanceSubstitionMatrix; 31 32 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; … … 145 146 146 147 147 148 148 // this is the real rule application. Loop while something is replaced. 149 149 SymbolMap<ITaskInstance, ITask> uniqueTasks = harmonizeEventTaskInstancesModel(appData); 150 ObjectDistanceSubstitionMatrix submat = new ObjectDistanceSubstitionMatrix(uniqueTasks );150 ObjectDistanceSubstitionMatrix submat = new ObjectDistanceSubstitionMatrix(uniqueTasks,20); 151 151 submat.generate(); 152 153 SmithWaterman sw = new SmithWaterman(numberseqs.get(1).getSequence(), numberseqs.get(1).getSequence(), submat); 154 152 153 154 155 System.out.print("Sequence 1: "); 156 NumberSequence ns1 = numberseqs.get(7); 157 NumberSequence ns2 = numberseqs.get(8); 158 ns1.printSequence(); 159 System.out.print("Sequence 2: "); 160 ns2.printSequence(); 161 //SmithWatermanRepeated sw = new SmithWatermanRepeated(numberseqs.get(20).getSequence(), numberseqs.get(24).getSequence(), submat,10); 162 SmithWatermanRepeated sw = new SmithWatermanRepeated(ns1.getSequence(), ns2.getSequence(), submat,15); 163 System.out.println("Max Scrore: " + sw.getMaxScore()); 164 165 sw.printDPMatrix(); 155 166 156 167 157 168 158 159 160 161 //Hier mein kram hin 169 162 170 do { 163 171 System.out.println(); … … 165 173 166 174 167 appData.getStopWatch().start("whole loop");168 detectAndReplaceIterations(appData);169 170 appData.getStopWatch().start("task replacement");171 detectAndReplaceTasks(appData);172 appData.getStopWatch().stop("task replacement");173 appData.getStopWatch().stop("whole loop");174 175 176 appData.getStopWatch().dumpStatistics(System.out);177 appData.getStopWatch().reset();175 //appData.getStopWatch().start("whole loop"); 176 //detectAndReplaceIterations(appData); 177 178 //appData.getStopWatch().start("task replacement"); 179 //detectAndReplaceTasks(appData); 180 //appData.getStopWatch().stop("task replacement"); 181 //appData.getStopWatch().stop("whole loop"); 182 183 184 //appData.getStopWatch().dumpStatistics(System.out); 185 //appData.getStopWatch().reset(); 178 186 179 187 }
Note: See TracChangeset
for help on using the changeset viewer.