Ignore:
Timestamp:
03/05/15 11:38:23 (10 years ago)
Author:
pharms
Message:
  • corrected selection of which task to detect first.
File:
1 edited

Legend:

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

    r1855 r1888  
    479479                    // Trie must be recreated with a longer sequence length to be sure that 
    480480                    // the found sequences occurring most often are found in their whole length 
    481                     appData.setTrainedSubsequenceLength(appData.getTrainedSubsequenceLength() + 1); 
     481                    appData.setTrainedSubsequenceLength(appData.getTrainedSubsequenceLength() + 3); 
    482482                    createNewTrie = true; 
    483483                    break; 
     
    835835                // checking now, if there is one sequence, having the lowest index for any of 
    836836                // its collisions and preserve it. If there are several ones with the same minimum 
    837                 // index, throw an exception 
     837                // index, check if they are indpendent. If not, throw an exception 
    838838                int minPosInAnySequence = Integer.MAX_VALUE; 
    839                 InterleavingSubsequence subsequenceWithMinPos = null; 
     839                List<InterleavingSubsequence> subsequencesWithMinPos = new LinkedList<>(); 
    840840                 
    841841                for (InterleavingSubsequence interleaving : interleavings) { 
     
    843843                        if (minPosInAnySequence > collision.getLocation().getIndex()) { 
    844844                            minPosInAnySequence = collision.getLocation().getIndex(); 
    845                             subsequenceWithMinPos = interleaving; 
     845                            subsequencesWithMinPos.clear(); 
    846846                        } 
    847                         else if (minPosInAnySequence == collision.getLocation().getIndex()) { 
     847                         
     848                        if (minPosInAnySequence == collision.getLocation().getIndex()) { 
    848849                            // several have the same min pos --> undecidable which to prefer 
    849                             subsequenceWithMinPos = null; 
     850                            subsequencesWithMinPos.add(interleaving); 
    850851                        } 
    851852                    } 
    852853                } 
    853854                 
    854                 if (subsequenceWithMinPos != null) { 
     855                if (subsequencesWithMinPos.size() > 0) { 
    855856                    List<Subsequence> subsequencesToRemove = new LinkedList<Subsequence>(); 
    856857                     
    857858                    for (Subsequence candidate : appData.getLastFoundSubsequences()) { 
    858                         if (candidate != subsequenceWithMinPos.getSubsequence()) { 
     859                        boolean found = false; 
     860                         
     861                        for (InterleavingSubsequence subsequenceWithMinPos : subsequencesWithMinPos) 
     862                        { 
     863                            if (candidate == subsequenceWithMinPos.getSubsequence()) { 
     864                                found = true; 
     865                            } 
     866                        } 
     867                         
     868                        if (!found) { 
    859869                            subsequencesToRemove.add(candidate); 
    860870                        } 
    861871                    } 
    862872                     
    863                     for (Subsequence candidate : subsequencesToRemove) { 
    864                         appData.getLastFoundSubsequences().remove(candidate); 
    865                     } 
     873                    if (subsequencesToRemove.size() > 0) { 
     874                        for (Subsequence candidate : subsequencesToRemove) { 
     875                            appData.getLastFoundSubsequences().remove(candidate); 
     876                        } 
    866877                     
    867                     continue; 
     878                        continue; 
     879                    } 
    868880                } 
    869881                 
Note: See TracChangeset for help on using the changeset viewer.