Changeset 408 for trunk/EventBenchConsole
- Timestamp:
- 04/03/12 10:21:17 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateHybrid.java
r401 r408 111 111 sequence = finishSequence(seqTmp, model, length + 2, 112 112 validEnd); 113 if( sequence!= null && sequence.size()!=length+2 ) { 114 sequence = null; 115 } 113 116 } else { 114 117 sequence = finishSequence(seqTmp, model, length + 1, 115 118 validEnd); 119 if( sequence!= null && sequence.size()!=length+1 ) { 120 sequence = null; 121 } 116 122 } 117 sequences.add(sequence); 123 if( sequence!=null ) { 124 sequences.add(sequence); 125 } 118 126 } 119 127 } … … 130 138 boolean endFound = false; 131 139 List<Event<?>> sequenceCopy = new LinkedList<Event<?>>(sequence); 132 133 while (!endFound) { 140 final int maxIter = 30000; 141 int iter = 0; 142 while (!endFound && iter<maxIter) { 143 iter++; 134 144 sequenceCopy = new LinkedList<Event<?>>(sequence); 135 145 while (!endFound && sequenceCopy.size() <= maxLength) { … … 139 149 probSum += model.getProbability(sequenceCopy, symbol); 140 150 if (probSum >= randVal) { 141 if (!(Event.STARTEVENT.equals(symbol) || Event.ENDEVENT.equals(symbol))) {151 if (!(Event.STARTEVENT.equals(symbol) || (!validEnd && Event.ENDEVENT.equals(symbol)))) { 142 152 // only add the symbol the sequence if it is not 143 153 // START … … 152 162 } 153 163 } 164 if( iter==maxIter ) { 165 return null; 166 } 154 167 return sequenceCopy; 155 168 } … … 162 175 @Override 163 176 public void help() { 164 Console.println("Usage: generate FixedLengthSequences<modelname> <sequencesName> <lenght> <maxlengthAll> <numSequences> {<validEnd>}");177 Console.println("Usage: generateHybrid <modelname> <sequencesName> <lenght> <maxlengthAll> <numSequences> {<validEnd>}"); 165 178 } 166 179
Note: See TracChangeset
for help on using the changeset viewer.