- Timestamp:
- 02/25/15 15:05:56 (10 years ago)
- Location:
- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs
r12048 r12071 24 24 using System.Linq; 25 25 using HeuristicLab.Analysis; 26 using HeuristicLab.Collections; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; … … 60 61 get { return (IValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; } 61 62 } 62 private I ValueParameter<MultiAnalyzer> AnalyzerParameter {63 get { return (I ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }64 } 65 private I ValueParameter<MultiAnalyzer> LayerAnalyzerParameter {66 get { return (I ValueParameter<MultiAnalyzer>)Parameters["LayerAnalyzer"]; }63 private IFixedValueParameter<MultiAnalyzer> AnalyzerParameter { 64 get { return (IFixedValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } 65 } 66 private IFixedValueParameter<MultiAnalyzer> LayerAnalyzerParameter { 67 get { return (IFixedValueParameter<MultiAnalyzer>)Parameters["LayerAnalyzer"]; } 67 68 } 68 69 private IValueParameter<IntValue> NumberOfLayersParameter { … … 124 125 public MultiAnalyzer Analyzer { 125 126 get { return AnalyzerParameter.Value; } 126 set { AnalyzerParameter.Value = value; }127 127 } 128 128 public MultiAnalyzer LayerAnalyzer { 129 129 get { return LayerAnalyzerParameter.Value; } 130 set { LayerAnalyzerParameter.Value = value; }131 130 } 132 131 public IntValue NumberOfLayers { … … 227 226 Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); 228 227 Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); 229 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));230 Parameters.Add(new ValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer()));228 Parameters.Add(new FixedValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer())); 229 Parameters.Add(new FixedValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer())); 231 230 Parameters.Add(new ValueParameter<IntValue>("NumberOfLayers", "The number of layers.", new IntValue(10))); 232 231 Parameters.Add(new ValueParameter<IntArray>("PopulationSize", "The size of the population of solutions each layer.", new IntArray(new[] { 100 }))); … … 407 406 RecalculateAgeLimits(); 408 407 } 408 private void AnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) { 409 foreach (var analyzer in e.Items) { 410 foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) { 411 parameter.Depth = 2; 412 } 413 } 414 } 415 private void LayerAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) { 416 foreach (var analyzer in e.Items) { 417 IParameter resultParameter; 418 if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) { 419 var lookupParameter = resultParameter as ILookupParameter<ResultCollection>; 420 if (lookupParameter != null) 421 lookupParameter.ActualName = "LayerResults"; 422 } 423 foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) { 424 parameter.Depth = 1; 425 } 426 } 427 } 409 428 #endregion 410 429 … … 423 442 NumberOfLayersParameter.ValueChanged += NumberOfLayersParameter_ValueChanged; 424 443 NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged; 444 Analyzer.Operators.ItemsAdded += AnalyzerOperators_ItemsAdded; 445 LayerAnalyzer.Operators.ItemsAdded += LayerAnalyzerOperators_ItemsAdded; 425 446 } 426 447 private void ParameterizeSolutionsCreator() { … … 546 567 if (Problem != null) { 547 568 foreach (var analyzer in Problem.Operators.OfType<IAnalyzer>()) { 548 foreach (var parameter in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())549 parameter.Depth = 2;550 569 Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault); 551 570 } -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs
r12045 r12071 113 113 114 114 layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("LayerEvaluatedSolutions")); 115 layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>(" Results"));115 layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("LayerResults")); 116 116 layerVariableCreator.Successor = initLayerAnalyzerPlaceholder; 117 117 … … 123 123 124 124 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 125 resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", " Results"));125 resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "LayerResults")); 126 126 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("OpenLayers")); 127 127 resultsCollector.CopyValue = new BoolValue(false); -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs
r12036 r12071 138 138 incrEvaluatedSolutionsForNewLayer.Successor = mainOperator; 139 139 140 newResultCollectionAssigner.LeftSideParameter.ActualName = " Results";140 newResultCollectionAssigner.LeftSideParameter.ActualName = "LayerResults"; 141 141 newResultCollectionAssigner.RightSideParameter.Value = new ResultCollection(); 142 142 newResultCollectionAssigner.Successor = mainOperator; … … 147 147 incrOpenLayers.Successor = newLayerResultsCollector; 148 148 149 newLayerResultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", " Results"));149 newLayerResultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "LayerResults")); 150 150 newLayerResultsCollector.CopyValue = new BoolValue(false); 151 151 newLayerResultsCollector.Successor = null;
Note: See TracChangeset
for help on using the changeset viewer.