Changeset 11568 for branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
- Timestamp:
- 11/24/14 13:31:03 (10 years ago)
- Location:
- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs
r11567 r11568 21 21 22 22 using System; 23 using HeuristicLab.Analysis; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 26 using HeuristicLab.Data; 27 using HeuristicLab.Operators; 25 28 using HeuristicLab.Optimization; 29 using HeuristicLab.Parameters; 26 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 31 … … 44 48 45 49 #region Parameter Properties 50 private IValueParameter<IntValue> SeedParameter { 51 get { return (IValueParameter<IntValue>)Parameters["Seed"]; } 52 } 53 private IValueParameter<BoolValue> SetSeedRandomlyParameter { 54 get { return (IValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; } 55 } 56 private IValueParameter<MultiAnalyzer> AnalyzerParameter { 57 get { return (IValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } 58 } 59 private IValueParameter<MultiAnalyzer> LayerAnalyzerParameter { 60 get { return (IValueParameter<MultiAnalyzer>)Parameters["LayerAnalyzer"]; } 61 } 62 private IValueParameter<IntValue> NumberOfLayersParameter { 63 get { return (IValueParameter<IntValue>)Parameters["NumberOfLayers"]; } 64 } 65 private IValueParameter<IntValue> PopulationSizeParameter { 66 get { return (IValueParameter<IntValue>)Parameters["PopulationSize"]; } 67 } 68 private IValueParameter<IntValue> MaximumGenerationsParameter { 69 get { return (IValueParameter<IntValue>)Parameters["MaximumGenerations"]; } 70 } 71 private IValueParameter<AgingScheme> AgingSchemeParameter { 72 get { return (IValueParameter<AgingScheme>)Parameters["AgingScheme"]; } 73 } 74 private IValueParameter<IntValue> AgeGapParameter { 75 get { return (IValueParameter<IntValue>)Parameters["AgeGap"]; } 76 } 77 private IValueParameter<IntArray> AgeLimitsParameter { 78 get { return (IValueParameter<IntArray>)Parameters["AgeLimits"]; } 79 } 80 private IValueParameter<ReductionOperation> AgeInheritanceParameter { 81 get { return (IValueParameter<ReductionOperation>)Parameters["AgeInheritance"]; } 82 } 83 public IConstrainedValueParameter<ISelector> SelectorParameter { 84 get { return (IConstrainedValueParameter<ISelector>)Parameters["Selector"]; } 85 } 86 public IConstrainedValueParameter<ICrossover> CrossoverParameter { 87 get { return (IConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; } 88 } 89 private IValueParameter<PercentValue> MutationProbabilityParameter { 90 get { return (IValueParameter<PercentValue>)Parameters["MutationProbability"]; } 91 } 92 public IConstrainedValueParameter<IManipulator> MutatorParameter { 93 get { return (IConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; } 94 } 95 private IValueParameter<IntValue> ElitesParameter { 96 get { return (IValueParameter<IntValue>)Parameters["Elites"]; } 97 } 98 private IFixedValueParameter<BoolValue> ReevaluateElitesParameter { 99 get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; } 100 } 46 101 #endregion 47 102 48 103 #region Properties 104 public IntValue Seed { 105 get { return SeedParameter.Value; } 106 set { SeedParameter.Value = value; } 107 } 108 public BoolValue SetSeedRandomly { 109 get { return SetSeedRandomlyParameter.Value; } 110 set { SetSeedRandomlyParameter.Value = value; } 111 } 112 public MultiAnalyzer Analyzer { 113 get { return AnalyzerParameter.Value; } 114 set { AnalyzerParameter.Value = value; } 115 } 116 public MultiAnalyzer LayerAnalyzer { 117 get { return LayerAnalyzerParameter.Value; } 118 set { LayerAnalyzerParameter.Value = value; } 119 } 120 public IntValue NumberOfLayers { 121 get { return NumberOfLayersParameter.Value; } 122 set { NumberOfLayersParameter.Value = value; } 123 } 124 125 public IntValue PopulationSize { 126 get { return PopulationSizeParameter.Value; } 127 set { PopulationSizeParameter.Value = value; } 128 } 129 public IntValue MaximumGenerations { 130 get { return MaximumGenerationsParameter.Value; } 131 set { MaximumGenerationsParameter.Value = value; } 132 } 133 public AgingScheme AgingScheme { 134 get { return AgingSchemeParameter.Value; } 135 set { AgingSchemeParameter.Value = value; } 136 } 137 public IntValue AgeGap { 138 get { return AgeGapParameter.Value; } 139 set { AgeGapParameter.Value = value; } 140 } 141 public IntArray AgeLimits { 142 get { return AgeLimitsParameter.Value; } 143 set { AgeLimitsParameter.Value = value; } 144 } 145 public ReductionOperation AgeInheritance { 146 get { return AgeInheritanceParameter.Value; } 147 set { AgeInheritanceParameter.Value = value; } 148 } 149 public ISelector Selector { 150 get { return SelectorParameter.Value; } 151 set { SelectorParameter.Value = value; } 152 } 153 public ICrossover Crossover { 154 get { return CrossoverParameter.Value; } 155 set { CrossoverParameter.Value = value; } 156 } 157 public PercentValue MutationProbability { 158 get { return MutationProbabilityParameter.Value; } 159 set { MutationProbabilityParameter.Value = value; } 160 } 161 public IManipulator Mutator { 162 get { return MutatorParameter.Value; } 163 set { MutatorParameter.Value = value; } 164 } 165 public IntValue Elites { 166 get { return ElitesParameter.Value; } 167 set { ElitesParameter.Value = value; } 168 } 169 public bool ReevaluteElites { 170 get { return ReevaluateElitesParameter.Value.Value; } 171 set { ReevaluateElitesParameter.Value.Value = value; } 172 } 49 173 #endregion 50 174 … … 52 176 private AlpsGeneticAlgorithm(bool deserializing) 53 177 : base(deserializing) { } 54 55 178 private AlpsGeneticAlgorithm(AlpsGeneticAlgorithm original, Cloner cloner) 56 179 : base(original, cloner) { … … 60 183 return new AlpsGeneticAlgorithm(this, cloner); 61 184 } 62 63 185 public AlpsGeneticAlgorithm() 64 186 : base() { 65 // TODO 187 Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); 188 Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); 189 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer())); 190 Parameters.Add(new ValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer())); 191 Parameters.Add(new ValueParameter<IntValue>("NumberOfLayers", "The number of layers.", new IntValue(5))); 192 Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions each layer.", new IntValue(20))); 193 Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed.", new IntValue(1000))); 194 Parameters.Add(new ValueParameter<AgingScheme>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new AgingScheme(AgingSchemes.Polynomial))); 195 Parameters.Add(new ValueParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers", new IntValue(5))); 196 Parameters.Add(new ValueParameter<IntArray>("AgeLimits", new IntArray(new[] { 1, 20, 45, 80, 125 })) { Hidden = true }); 197 Parameters.Add(new ValueParameter<ReductionOperation>("AgeInheritance", "The operator for determining the age of an offspring based the parents age.", new ReductionOperation(ReductionOperations.Max)) { Hidden = true }); 198 Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction.")); 199 Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions.")); 200 Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05))); 201 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 202 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 203 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true }); 66 204 } 67 205 } -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj
r11567 r11568 75 75 <Reference Include="System" /> 76 76 <Reference Include="System.Core" /> 77 <Reference Include="System.Drawing" /> 77 78 </ItemGroup> 78 79 <ItemGroup> 80 <Compile Include="AgingScheme.cs" /> 79 81 <Compile Include="AlpsGeneticAlgorithm.cs" /> 80 82 <Compile Include="Plugin.cs" /> … … 97 99 <Private>False</Private> 98 100 </ProjectReference> 101 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 102 <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project> 103 <Name>HeuristicLab.Common.Resources-3.3</Name> 104 </ProjectReference> 99 105 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 100 106 <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project> … … 105 111 <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project> 106 112 <Name>HeuristicLab.Core-3.3</Name> 107 <Private>False</Private>108 113 </ProjectReference> 109 114 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
Note: See TracChangeset
for help on using the changeset viewer.