Changeset 17854
- Timestamp:
- 03/01/21 18:09:17 (4 years ago)
- Location:
- branches/3107_LearningALPS
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3107_LearningALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs
r17198 r17854 121 121 get { return (IValueParameter<MultiTerminator>)Parameters["Terminator"]; } 122 122 } 123 124 private IConstrainedValueParameter<IReinitializationStrategyController> ReinitializationStrategyParameter { 125 get { return (IConstrainedValueParameter<IReinitializationStrategyController>)Parameters["ReinitializationStrategy"]; } 126 } 123 127 #endregion 124 128 … … 207 211 get { return generationsTerminator.Threshold.Value; } 208 212 set { generationsTerminator.Threshold.Value = value; } 213 } 214 215 public IReinitializationStrategyController ReinitializationStrategy { 216 get { return ReinitializationStrategyParameter.Value; } 217 set { ReinitializationStrategyParameter.Value = value; } 209 218 } 210 219 #endregion … … 312 321 313 322 Parameters.Add(new ValueParameter<MultiTerminator>("Terminator", "The termination criteria that defines if the algorithm should continue or stop.", new MultiTerminator())); 323 324 Parameters.Add(new OptionalConstrainedValueParameter<IReinitializationStrategyController>("ReinitializationStrategy", "An optional strategy adaption when reseeding the lowest layer.")); 314 325 #endregion 315 326 … … 406 417 #endregion 407 418 419 #region Set strategy adaption 420 foreach (var adaptor in ApplicationManager.Manager.GetInstances<IReinitializationStrategyController>().OrderBy(o => o.Name)) 421 ReinitializationStrategyParameter.ValidValues.Add(adaptor); 422 #endregion 423 408 424 #region Create analyzers 409 425 qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); -
branches/3107_LearningALPS/HeuristicLab.Algorithms.ALPS/3.3/ReseedingController.cs
r17180 r17854 20 20 #endregion 21 21 22 using System; 23 using System.Linq; 22 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Core; … … 34 36 get { return (ILookupParameter<IntValue>)Parameters["Generations"]; } 35 37 } 38 36 39 public ILookupParameter<IntValue> AgeGapParameter { 37 40 get { return (ILookupParameter<IntValue>)Parameters["AgeGap"]; } 38 41 } 42 39 43 public OperatorParameter FirstLayerOperatorParameter { 40 44 get { return (OperatorParameter)Parameters["FirstLayerOperator"]; } 45 } 46 47 public OperatorParameter StrategyAdaptionOperatorParameter { 48 get { return (OperatorParameter)Parameters["ReinitializationStrategyOperator"]; } 41 49 } 42 50 … … 46 54 } 47 55 56 public IOperator ReinitializationStrategyOperator { 57 get { return StrategyAdaptionOperatorParameter.Value; } 58 set { StrategyAdaptionOperatorParameter.Value = value; } 59 } 60 48 61 [StorableConstructor] 49 62 private ReseedingController(StorableConstructorFlag _) : base(_) { } 50 63 64 [StorableHook(HookType.AfterDeserialization)] 65 private void AfterDeserialization() { 66 if (!Parameters.ContainsKey("ReinitializationStrategyOperator")) { 67 Parameters.Add(new OperatorParameter("ReinitializationStrategyOperator", "The optional operator to control the strategy parameter.")); 68 } 69 } 70 51 71 private ReseedingController(ReseedingController original, Cloner cloner) 52 : base(original, cloner) { 53 } 72 : base(original, cloner) { } 73 54 74 public override IDeepCloneable Clone(Cloner cloner) { 55 75 return new ReseedingController(this, cloner); … … 61 81 Parameters.Add(new ValueLookupParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers.")); 62 82 Parameters.Add(new OperatorParameter("FirstLayerOperator", "The operator that is performed on the first layer if reseeding is required.")); 83 Parameters.Add(new OperatorParameter("ReinitializationStrategyOperator", "The optional operator to control the strategy parameter.")); 63 84 } 64 85 … … 69 90 var next = new OperationCollection(base.Apply()); 70 91 if (generations % ageGap == 0) { 71 var layerZeroScope = ExecutionContext.Scope.SubScopes[0];72 if (FirstLayerOperator != null)92 if (FirstLayerOperator != null) { 93 var layerZeroScope = ExecutionContext.Scope.SubScopes.First(); 73 94 next.Insert(0, ExecutionContext.CreateChildOperation(FirstLayerOperator, layerZeroScope)); 95 } 96 97 // insert at index 0 => strategy adaption is scheduled before reinitialization 98 if (ReinitializationStrategyOperator != null) { 99 var lastLayerScope = ExecutionContext.Scope.SubScopes.Last(); 100 next.Insert(0, ExecutionContext.CreateChildOperation(ReinitializationStrategyOperator, lastLayerScope)); 101 } 74 102 } 75 103 return next; -
branches/3107_LearningALPS/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r16658 r17854 156 156 <Compile Include="Interfaces\ILocalImprovementAlgorithmOperator.cs" /> 157 157 <Compile Include="Interfaces\IMultiObjectiveOperator.cs" /> 158 <Compile Include="Interfaces\IReinitializationStrategyController.cs" /> 158 159 <Compile Include="MultiObjective\DominationCalculator.cs" /> 159 160 <Compile Include="Results\IResultParameter.cs" /> -
branches/3107_LearningALPS/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r17413 r17854 150 150 <Compile Include="Converters\DerivativeCalculator.cs" /> 151 151 <Compile Include="Converters\TreeToAutoDiffTermConverter.cs" /> 152 <Compile Include="Creators\SymbolFrequencyReinitializationStrategyController.cs" /> 152 153 <Compile Include="Creators\SymbolicDataAnalysisExpressionBalancedTreeCreator.cs" /> 153 154 <Compile Include="Crossovers\SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs" />
Note: See TracChangeset
for help on using the changeset viewer.