- Timestamp:
- 05/17/10 16:08:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs
r3742 r3825 90 90 // try a different size MAX_TRIES times 91 91 } 92 throw new ArgumentException("Couldn't create a valid tree with the specified constraints.");92 throw new ArgumentException("Couldn't create a random valid tree."); 93 93 } 94 94 … … 234 234 var symbolList = symbols.ToList(); 235 235 var ticketsSum = symbolList.Select(x => x.InitialFrequency).Sum(); 236 if (ticketsSum == 0.0) throw new ArgumentException("The initial frequency of all allowed symbols is zero."); 236 237 var r = random.NextDouble() * ticketsSum; 237 238 double aggregatedTickets = 0; 238 239 for (int i = 0; i < symbolList.Count; i++) { 239 240 aggregatedTickets += symbolList[i].InitialFrequency; 240 if (aggregatedTickets > =r) {241 if (aggregatedTickets > r) { 241 242 return symbolList[i]; 242 243 } 243 244 } 244 245 // this should never happen 245 throw new ArgumentException( );246 throw new ArgumentException("There is a problem with the initial frequency setting of allowed symbols."); 246 247 } 247 248
Note: See TracChangeset
for help on using the changeset viewer.