Changeset 1558 for branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/substitution
- Timestamp:
- 05/29/14 22:43:07 (10 years ago)
- Location:
- branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/substitution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.