Changeset 3048 for trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGA.cs
- Timestamp:
- 03/15/10 23:49:54 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGA.cs
r3023 r3048 51 51 52 52 #region Parameter Properties 53 private ValueParameter<Int Data> SeedParameter {54 get { return (ValueParameter<Int Data>)Parameters["Seed"]; }55 } 56 private ValueParameter<Bool Data> SetSeedRandomlyParameter {57 get { return (ValueParameter<Bool Data>)Parameters["SetSeedRandomly"]; }58 } 59 private ValueParameter<Int Data> PopulationSizeParameter {60 get { return (ValueParameter<Int Data>)Parameters["PopulationSize"]; }53 private ValueParameter<IntValue> SeedParameter { 54 get { return (ValueParameter<IntValue>)Parameters["Seed"]; } 55 } 56 private ValueParameter<BoolValue> SetSeedRandomlyParameter { 57 get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; } 58 } 59 private ValueParameter<IntValue> PopulationSizeParameter { 60 get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; } 61 61 } 62 62 private ConstrainedValueParameter<ISelector> SelectorParameter { … … 66 66 get { return (ConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; } 67 67 } 68 private ValueParameter<Double Data> MutationProbabilityParameter {69 get { return (ValueParameter<Double Data>)Parameters["MutationProbability"]; }68 private ValueParameter<DoubleValue> MutationProbabilityParameter { 69 get { return (ValueParameter<DoubleValue>)Parameters["MutationProbability"]; } 70 70 } 71 71 private OptionalConstrainedValueParameter<IManipulator> MutatorParameter { 72 72 get { return (OptionalConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; } 73 73 } 74 private ValueParameter<Int Data> ElitesParameter {75 get { return (ValueParameter<Int Data>)Parameters["Elites"]; }76 } 77 private ValueParameter<Int Data> MaximumGenerationsParameter {78 get { return (ValueParameter<Int Data>)Parameters["MaximumGenerations"]; }74 private ValueParameter<IntValue> ElitesParameter { 75 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 76 } 77 private ValueParameter<IntValue> MaximumGenerationsParameter { 78 get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; } 79 79 } 80 80 #endregion 81 81 82 82 #region Properties 83 public Int DataSeed {83 public IntValue Seed { 84 84 get { return SeedParameter.Value; } 85 85 set { SeedParameter.Value = value; } 86 86 } 87 public Bool DataSetSeedRandomly {87 public BoolValue SetSeedRandomly { 88 88 get { return SetSeedRandomlyParameter.Value; } 89 89 set { SetSeedRandomlyParameter.Value = value; } 90 90 } 91 public Int DataPopulationSize {91 public IntValue PopulationSize { 92 92 get { return PopulationSizeParameter.Value; } 93 93 set { PopulationSizeParameter.Value = value; } … … 101 101 set { CrossoverParameter.Value = value; } 102 102 } 103 public Double DataMutationProbability {103 public DoubleValue MutationProbability { 104 104 get { return MutationProbabilityParameter.Value; } 105 105 set { MutationProbabilityParameter.Value = value; } … … 109 109 set { MutatorParameter.Value = value; } 110 110 } 111 public Int DataElites {111 public IntValue Elites { 112 112 get { return ElitesParameter.Value; } 113 113 set { ElitesParameter.Value = value; } 114 114 } 115 public Int DataMaximumGenerations {115 public IntValue MaximumGenerations { 116 116 get { return MaximumGenerationsParameter.Value; } 117 117 set { MaximumGenerationsParameter.Value = value; } … … 134 134 public SGA() 135 135 : base() { 136 Parameters.Add(new ValueParameter<Int Data>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0)));137 Parameters.Add(new ValueParameter<Bool Data>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true)));138 Parameters.Add(new ValueParameter<Int Data>("PopulationSize", "The size of the population of solutions.", new IntData(100)));136 Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); 137 Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); 138 Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100))); 139 139 Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction.")); 140 140 Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions.")); 141 Parameters.Add(new ValueParameter<Double Data>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleData(0.05)));141 Parameters.Add(new ValueParameter<DoubleValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleValue(0.05))); 142 142 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 143 Parameters.Add(new ValueParameter<Int Data>("Elites", "The numer of elite solutions which are kept in each generation.", new IntData(1)));144 Parameters.Add(new ValueParameter<Int Data>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntData(1000)));143 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 144 Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000))); 145 145 146 146 RandomCreator randomCreator = new RandomCreator(); … … 266 266 private void ParameterizeSelectors() { 267 267 foreach (ISelector selector in Selectors) { 268 selector.CopySelected = new Bool Data(true);269 selector.NumberOfSelectedSubScopesParameter.Value = new Int Data(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));268 selector.CopySelected = new BoolValue(true); 269 selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value)); 270 270 ParameterizeStochasticOperator(selector); 271 271 }
Note: See TracChangeset
for help on using the changeset viewer.