Changeset 11981 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization/Problems/SantaFeAntProblem.cs
- Timestamp:
- 02/11/15 20:11:35 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization/Problems/SantaFeAntProblem.cs
r11980 r11981 140 140 var isTerminal = grammar.IsTerminal(phrase); 141 141 142 143 142 yield return new Feature(isTerminal + ToString(), 1.0); 144 //if (phrase.Length > 0) { 145 // var ant = new Ant(recordTrail: true); 146 // int pos = 0; 147 // Run(ant, phrase, ref pos, true); 148 // //yield return new Feature("food", ant.FoodEaten); 149 // yield return new Feature(ant.Trail, 1.0); 150 //} 151 //yield return new Feature(isTerminal + "const", 0.0); 152 //yield return new Feature(isTerminal.ToString() + phrase.Length, 1.0); 153 //int ntIdx; 154 //for (ntIdx = 0; ntIdx < phrase.Length; ntIdx++) if (grammar.IsNonTerminal(phrase[ntIdx])) break; 155 //for (int l = ntIdx-2; l >= 0; l--) { 156 // yield return new Feature(phrase.Substring(l, ntIdx-l-1), 1.0); 157 //} 158 // 143 159 144 yield return new Feature("$" + (phrase.Length > 0 ? phrase[0] : ' '), 1.0); 160 145 if (!isTerminal) { … … 166 151 } 167 152 } 168 // var d = 0; 169 // var ls = 0; 170 // var rs = 0; 171 // var qs = 0; 172 // foreach (var ch in phrase) if (ch == 'l') { d--; ls++; } else if (ch == 'r') { d++; rs++; } else if (ch == '?') qs++; 173 // yield return new Feature(isTerminal + "D" + Math.Abs(d), 1.0); 174 // yield return new Feature(isTerminal + "R" + rs, 1.0); 175 // yield return new Feature(isTerminal + "L" + ls, 1.0); 176 // yield return new Feature(isTerminal + "?" + qs, 1.0); 177 153 178 154 yield return new Feature(phrase, 1.0); 179 //for (int i = 0; i < phrase.Length; i++)180 // yield return new Feature(i.ToString() + phrase[i].ToString(), 1.0);181 // yield return new Feature("Length", phrase.Length); //182 // foreach (var pair in phrase.Zip(phrase.Skip(1), Tuple.Create)) {183 // yield return new Feature(pair.Item1.ToString() + pair.Item2, 1.0);184 // }185 // number of occurances for each symbol186 155 } 187 156
Note: See TracChangeset
for help on using the changeset viewer.