Changeset 1890 for trunk


Ignore:
Timestamp:
03/05/15 11:42:26 (10 years ago)
Author:
pharms
Message:
  • extended task similarity check to handle identical tasks also correctly
Location:
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/utils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/utils/MostSimilarTaskDeterminer.java

    r1851 r1890  
    118118 
    119119    /** 
    120      * filters the given list of similar tasks for those having the smalled diff level, which is 
     120     * filters the given list of similar tasks for those having the smallest diff level, which is 
    121121     * in turn the highest similarity 
    122122     */ 
     
    140140                } 
    141141            } 
     142             
     143            Console.println("smallest diff level is " + smallestDiffLevel); 
    142144        } 
    143145        else { 
     
    197199                                                 ITaskModel               taskModel) 
    198200    { 
     201        for (SimilarTasks similarTasks : mostSimilarTasksList) { 
     202            System.out.println(similarTasks.getLeftHandSide() + "  " + similarTasks.getRightHandSide()); 
     203        } 
     204         
    199205        // check, if several remaining similar tasks refer to the same task 
    200206        Map<ITask, LinkedList<SimilarTasks>> referredTasks = 
     
    597603                                getSimilarTasksToPrefer(similarTasks1, similarTasks2); 
    598604 
    599                             if (similarTasks.isInBetweenDifference()) { 
     605                            if (similarTasks.isInBetweenDifference() || 
     606                                (similarTasks.getPatch().getDeltas().size() == 0)) 
     607                            { 
    600608                                if (similarTasks.getDiffLevel() < mostSimilarDiffLevel) { 
    601609                                    mostSimilarTasks = similarTasks; 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/utils/SimilarTasks.java

    r1850 r1890  
    10951095            if (isInefficientAction(path.getLast())) { 
    10961096                diffCount++; 
     1097                allCount++; 
    10971098            } 
    10981099            else { 
     
    11041105            if (isInefficientAction(path.getLast())) { 
    11051106                diffCount++; 
     1107                allCount++; 
    11061108            } 
    11071109            else { 
     
    11101112        } 
    11111113         
    1112         return (100 * diffCount) / allCount; 
     1114        if (allCount == 0) { 
     1115            // this happens, if all actions are inefficient. Return the highest diff level 
     1116            return 100; 
     1117        } 
     1118        else { 
     1119            return (100 * diffCount) / allCount; 
     1120        } 
    11131121    } 
    11141122 
Note: See TracChangeset for help on using the changeset viewer.