Changeset 15883 for branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs
- Timestamp:
- 04/04/18 16:23:55 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs
r15861 r15883 153 153 #endregion 154 154 155 OpenPhrases.Store(phrase0Hash, phrase0);155 OpenPhrases.Store(phrase0Hash, 0.0, phrase0); 156 156 while (OpenPhrases.Count > 0) { 157 157 if (cancellationToken.IsCancellationRequested) break; … … 185 185 OnSentenceGenerated(fetchedPhrase.Hash, fetchedPhrase.SymbolString, phraseHash, newPhrase, expandedSymbol, appliedProductions[i]); 186 186 187 // Is the best solution found? (only if RSquaredEvaluator is activated) 188 if (Results.ContainsKey(RSquaredEvaluator.BestTrainingQualityResultName) && ((DoubleValue)Results[RSquaredEvaluator.BestTrainingQualityResultName].Value).Value == 1.0) { 189 UpdateView(force: true); 190 return; 191 } 192 187 193 if (!DistinctSentencesComplexity.ContainsKey(phraseHash) || DistinctSentencesComplexity[phraseHash] > newPhraseComplexity) { 188 194 if (DistinctSentencesComplexity.ContainsKey(phraseHash)) OverwrittenSentencesCount++; // for analysis only … … 194 200 195 201 } else if (!OpenPhrases.Contains(phraseHash) && !ArchivedPhrases.Contains(phraseHash)) { 196 OpenPhrases.Store(phraseHash, newPhrase); 202 double phrasePriority = GetPriority(newPhrase); 203 OpenPhrases.Store(phraseHash, phrasePriority, newPhrase); 197 204 } 198 205 } … … 200 207 } 201 208 UpdateView(force: true); 209 } 210 211 protected double GetPriority(SymbolString phrase) { 212 return 1.0 - Grammar.EvaluatePhrase(phrase, Problem.ProblemData, OptimizeConstants); 202 213 } 203 214
Note: See TracChangeset
for help on using the changeset viewer.