00001 using System; 00002 using System.Collections.Generic; 00003 using System.Linq; 00004 using System.Text; 00005 using GEP.Core.Common; 00006 00007 namespace GEP.Core.Float 00008 { 00012 [Serializable] 00013 public class Alphabet : Common.Alphabet 00014 { 00020 public Alphabet(int size) 00021 : base(size) { } 00022 00030 public static Alphabet GetRandomConstantsSet(int size, float constantsLowerBound, 00031 float constantsUpperBound) 00032 { 00033 if (!(constantsLowerBound < constantsUpperBound)) 00034 throw new GepException("The upper bound is not greater than the lower bound."); 00035 Random random = new Random(); 00036 Alphabet constSet = new Alphabet(size); 00037 for (int i = constSet.Length - 1; 0 <= i; i--) 00038 { 00039 constSet[i] = new Constant(Common.Functions.IntervalMapping( 00040 (float)random.NextDouble(), 0F, 1F, constantsLowerBound, constantsUpperBound), "C" + i); 00041 } 00042 return constSet; 00043 } 00044 } 00045 }