Changeset 11590
- Timestamp:
- 11/26/14 17:22:19 (10 years ago)
- Location:
- branches/ALPS
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs
r11586 r11590 183 183 get { return OperatorGraph.Iterate().OfType<SolutionsCreator>().First(); } 184 184 } 185 186 185 private AlpsGeneticAlgorithmMainLoop MainLoop { 187 186 get { return OperatorGraph.Iterate().OfType<AlpsGeneticAlgorithmMainLoop>().First(); } … … 255 254 256 255 layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Layer", new IntValue(0))); 256 layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection())); 257 257 layerVariableCreator.Successor = layerSolutionsCreator; 258 258 … … 266 266 initializeAge.Successor = null; 267 267 268 initializeLocalEvaluatedSolutions.ValueParameter.ActualName = " EvaluatedSolutions";268 initializeLocalEvaluatedSolutions.ValueParameter.ActualName = "LayerEvaluatedSolutions"; 269 269 initializeLocalEvaluatedSolutions.Successor = null; 270 270 271 271 initializeGlobalEvaluatedSolutions.ReductionOperation.Value.Value = ReductionOperations.Sum; 272 272 initializeGlobalEvaluatedSolutions.TargetOperation.Value.Value = ReductionOperations.Assign; 273 initializeGlobalEvaluatedSolutions.ParameterToReduce.ActualName = " EvaluatedSolutions";273 initializeGlobalEvaluatedSolutions.ParameterToReduce.ActualName = "LayerEvaluatedSolutions"; 274 274 initializeGlobalEvaluatedSolutions.TargetParameter.ActualName = "EvaluatedSolutions"; 275 275 initializeGlobalEvaluatedSolutions.Successor = resultsCollector; … … 373 373 SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 374 374 SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; 375 MainLoop. EldersEmigrator.SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;376 MainLoop. EldersEmigrator.SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;375 MainLoop.LayerUpdator.SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 376 MainLoop.LayerUpdator.SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; 377 377 378 378 } -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs
r11586 r11590 55 55 get { return OperatorGraph.Iterate().OfType<EldersEmigrator>().First(); } 56 56 } 57 public LayerUpdator LayerUpdator { 58 get { return OperatorGraph.Iterate().OfType<LayerUpdator>().First(); } 59 } 57 60 58 61 [StorableConstructor] … … 74 77 var initAnalyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" }; 75 78 var initLayerAnalyzerProcessor = new SubScopesProcessor(); 79 var layerVariableCreator = new VariableCreator() { Name = "Initialize Layer" }; 76 80 var initLayerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" }; 77 81 var matingPoolCreator = new MatingPoolCreator() { Name = "Create Mating Pools" }; 78 82 var matingPoolProcessor = new UniformSubScopesProcessor(); 83 var initializeLayer = new Assigner() { Name = "Reset LayerEvaluatedSolutions" }; 79 84 var mainOperator = CreatePreparedGeneticAlgorithmMainLoop(); 80 85 var layerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" }; … … 101 106 initAnalyzerPlaceholder.Successor = initLayerAnalyzerProcessor; 102 107 103 initLayerAnalyzerProcessor.Operators.Add( initLayerAnalyzerPlaceholder);108 initLayerAnalyzerProcessor.Operators.Add(layerVariableCreator); 104 109 initLayerAnalyzerProcessor.Successor = matingPoolCreator; 110 111 layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("LayerEvaluatedSolutions")); 112 layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results")); 113 layerVariableCreator.Successor = initLayerAnalyzerPlaceholder; 105 114 106 115 initLayerAnalyzerPlaceholder.OperatorParameter.ActualName = LayerAnalyzerParameter.Name; … … 110 119 111 120 matingPoolProcessor.Parallel.Value = true; 112 matingPoolProcessor.Operator = mainOperator;121 matingPoolProcessor.Operator = initializeLayer; 113 122 matingPoolProcessor.Successor = generationsIcrementor; 123 124 initializeLayer.LeftSideParameter.ActualName = "LayerEvaluatedSolutions"; 125 initializeLayer.RightSideParameter.Value = new IntValue(0); 126 initializeLayer.Successor = mainOperator; 114 127 115 128 generationsIcrementor.ValueParameter.ActualName = "Generations"; … … 149 162 var selector = mainLoop.OperatorGraph.Iterate().OfType<Placeholder>().First(o => o.OperatorParameter.ActualName == "Selector"); 150 163 var crossover = mainLoop.OperatorGraph.Iterate().OfType<Placeholder>().First(o => o.OperatorParameter.ActualName == "Crossover"); 164 var subScopesCounter = mainLoop.OperatorGraph.Iterate().OfType<SubScopesCounter>().First(); 151 165 var elitesMerger = mainLoop.OperatorGraph.Iterate().OfType<MergingReducer>().First(); 152 166 … … 164 178 ageCalculator.Successor = crossoverSuccessor; 165 179 180 // When counting the evaluated solutions, write in LayerEvaluatedSolutions 181 subScopesCounter.ValueParameter.ActualName = "LayerEvaluatedSolutions"; 182 subScopesCounter.AccumulateParameter.Value = new BoolValue(false); 183 166 184 // Instead of generational loop after merging of elites, increment ages of all individuals 167 185 var processor = new UniformSubScopesProcessor(); -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersEmigrator.cs
r11586 r11590 20 20 #endregion 21 21 22 using System.Linq;23 22 using HeuristicLab.Common; 24 23 using HeuristicLab.Core; 25 24 using HeuristicLab.Data; 26 25 using HeuristicLab.Operators; 27 using HeuristicLab.Optimization.Operators;28 26 using HeuristicLab.Parameters; 29 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 40 38 public IScopeTreeLookupParameter<DoubleValue> QualityParameter { 41 39 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 42 }43 44 public SolutionsCreator SolutionsCreator {45 get { return OperatorGraph.Iterate().OfType<SolutionsCreator>().First(); }46 40 } 47 41 … … 77 71 selectorProsessor.Successor = shiftToRightMigrator; 78 72 73 eldersSelector.CopySelected = new BoolValue(false); 79 74 eldersSelector.Successor = null; 80 75 … … 99 94 bestSelector.QualityParameter.ActualName = QualityParameter.Name; 100 95 bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name; 96 bestSelector.CopySelected = new BoolValue(false); 101 97 bestSelector.Successor = rightReducer; 102 98 -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj
r11586 r11590 83 83 <Compile Include="EldersEmigrator.cs" /> 84 84 <Compile Include="EldersSelector.cs" /> 85 <Compile Include="LastSubScopeCloner.cs" /> 85 86 <Compile Include="LayerUpdator.cs" /> 86 87 <Compile Include="MatingPoolCreator.cs" /> -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs
r11586 r11590 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; 25 26 using HeuristicLab.Operators; 27 using HeuristicLab.Optimization; 26 28 using HeuristicLab.Optimization.Operators; 27 29 using HeuristicLab.Parameters; … … 32 34 [StorableClass] 33 35 public class LayerUpdator : AlgorithmOperator { 36 37 public SolutionsCreator SolutionsCreator { 38 get { return OperatorGraph.Iterate().OfType<SolutionsCreator>().First(); } 39 } 34 40 35 41 [StorableConstructor] … … 50 56 var openNewLayerCalculator = new OpenNewLayerCalculator(); 51 57 var openNewLayerBranch = new ConditionalBranch() { Name = "OpenNewLayer?" }; 58 var layerCloner = new LastSubScopeCloner() { Name = "Copy Lower Layer" }; 52 59 var incrOpenLayers = new IntCounter() { Name = "Incr. OpenLayers" }; 53 var layerScopeCreator = new SubScopesCreator();54 60 var newLayerProsessor = new LastSubScopeProcessor(); 55 var localRandomCreator = new LocalRandomCreator(); 56 var layerVariableCreator = new Assigner() { Name = "Init Layer" }; 57 var copyPrevSubScope = new CombinedOperator() { Name = "Copy lower layer" }; 58 //var mainOperator = new CombinedOperator() { Name = "Create Offsprings" }; 61 var layerInitializer = new Assigner() { Name = "Init Layer" }; 62 var incrEvaluatedSolutionsForNewLayer = new SubScopesCounter() { Name = "Update EvaluatedSolutions" }; 63 var newResultCollectionAssigner = new Assigner() { Name = "Empty Results" }; 59 64 var regenerateLayerZeroProsessor = new FirstSubScopeProcessor(); 60 65 var subScopesRemover = new SubScopesRemover(); … … 62 67 var initializeAgeProsessor = new UniformSubScopesProcessor(); 63 68 var initializeAge = new VariableCreator() { Name = "Initialize Age" }; 64 var incrEvaluatedSolutions = new SubScopesCounter() { Name = "Update EvaluatedSolutions" };69 var incrEvaluatedSolutionsAfterReseeding = new SubScopesCounter() { Name = "Update EvaluatedSolutions" }; 65 70 var resetGenSlr = new Assigner() { Name = "Reset GenerationsSinceLastRefresh" }; 66 71 … … 77 82 genSlrEqAgeGap.Successor = updateLayersBranch; 78 83 79 updateLayersBranch.ConditionParameter.ActualName = "Update layers";84 updateLayersBranch.ConditionParameter.ActualName = "UpdateLayers"; 80 85 updateLayersBranch.TrueBranch = openNewLayerCalculator; 81 86 … … 89 94 90 95 openNewLayerBranch.ConditionParameter.ActualName = "OpenNewLayer"; 91 openNewLayerBranch.TrueBranch = incrOpenLayers;96 openNewLayerBranch.TrueBranch = layerCloner; 92 97 openNewLayerBranch.Successor = regenerateLayerZeroProsessor; 98 99 layerCloner.Successor = newLayerProsessor; 100 101 newLayerProsessor.Operator = layerInitializer; 102 newLayerProsessor.Successor = incrOpenLayers; 103 104 layerInitializer.LeftSideParameter.ActualName = "Layer"; 105 layerInitializer.RightSideParameter.ActualName = "OpenLayers"; 106 layerInitializer.Successor = incrEvaluatedSolutionsForNewLayer; 107 108 incrEvaluatedSolutionsForNewLayer.ValueParameter.ActualName = "EvaluatedSolutions"; 109 incrEvaluatedSolutionsForNewLayer.AccumulateParameter.Value = new BoolValue(true); 110 incrEvaluatedSolutionsForNewLayer.Successor = newResultCollectionAssigner; 111 112 newResultCollectionAssigner.LeftSideParameter.ActualName = "Results"; 113 newResultCollectionAssigner.RightSideParameter.Value = new ResultCollection(); 114 newResultCollectionAssigner.Successor = mainOperator; 115 // TODO mainOperator increment age 93 116 94 117 incrOpenLayers.ValueParameter.ActualName = "OpenLayers"; 95 118 incrOpenLayers.Increment = new IntValue(1); 96 incrOpenLayers.Successor = layerScopeCreator; 97 98 layerScopeCreator.NumberOfSubScopesParameter.Value = new IntValue(1); 99 layerScopeCreator.Successor = newLayerProsessor; 100 101 newLayerProsessor.Operator = localRandomCreator; 102 103 localRandomCreator.Successor = layerVariableCreator; 104 105 layerVariableCreator.LeftSideParameter.ActualName = "Layer"; 106 layerVariableCreator.RightSideParameter.ActualName = "Layer"; 107 layerVariableCreator.Successor = copyPrevSubScope; 108 109 copyPrevSubScope.Successor = mainOperator; 119 incrOpenLayers.Successor = null; 110 120 111 121 regenerateLayerZeroProsessor.Operator = subScopesRemover; … … 117 127 118 128 initializeAgeProsessor.Operator = initializeAge; 119 initializeAgeProsessor.Successor = incrEvaluatedSolutions ;129 initializeAgeProsessor.Successor = incrEvaluatedSolutionsAfterReseeding; 120 130 121 131 initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("Age", new IntValue(0))); 122 132 initializeAge.Successor = null; 123 133 124 incrEvaluatedSolutions.ValueParameter.ActualName = "EvaluatedSolutions"; 125 incrEvaluatedSolutions.Successor = null; 134 incrEvaluatedSolutionsAfterReseeding.ValueParameter.ActualName = "EvaluatedSolutions"; 135 incrEvaluatedSolutionsAfterReseeding.AccumulateParameter.Value = new BoolValue(true); 136 incrEvaluatedSolutionsAfterReseeding.Successor = null; 126 137 127 138 resetGenSlr.LeftSideParameter.ActualName = "GenerationsSinceLastRefresh"; -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/OpenNewLayerCalculator.cs
r11586 r11590 45 45 get { return (ILookupParameter<IntValue>)Parameters["OpenLayers"]; } 46 46 } 47 private I ValueParameter<BoolValue> OpenNewLayerParameter {48 get { return (I ValueParameter<BoolValue>)Parameters["OpenNewLayer"]; }47 private ILookupParameter<BoolValue> OpenNewLayerParameter { 48 get { return (ILookupParameter<BoolValue>)Parameters["OpenNewLayer"]; } 49 49 } 50 50 … … 63 63 Parameters.Add(new LookupParameter<IntValue>("NumberOfLayers")); 64 64 Parameters.Add(new LookupParameter<IntValue>("OpenLayers")); 65 Parameters.Add(new ValueParameter<BoolValue>("OpenNewLayer"));65 Parameters.Add(new LookupParameter<BoolValue>("OpenNewLayer")); 66 66 } 67 67 … … 73 73 var openNewLayer = OpenNewLayerParameter; 74 74 75 openNewLayer. Value = new BoolValue(openLayers < numberOfLayers && generations >= ageLimits[openLayers - 1]);75 openNewLayer.ActualValue = new BoolValue(openLayers < numberOfLayers && generations >= ageLimits[openLayers - 1]); 76 76 77 77 return base.Apply(); -
branches/ALPS/HeuristicLab.Operators/3.3/FirstSubScopeProcessor.cs
r11586 r11590 29 29 namespace HeuristicLab.Operators { 30 30 [Item("FirstSubScopeProsessor", "An operator which applies a specified operator on the first sub-scope.")] 31 public class FirstSubScopeProcessor : SingleSuccessorOperator { 31 [StorableClass] 32 public sealed class FirstSubScopeProcessor : SingleSuccessorOperator { 32 33 private OperatorParameter OperatorParameter { 33 34 get { return (OperatorParameter)Parameters["Operator"]; } -
branches/ALPS/HeuristicLab.Operators/3.3/LastSubScopeProcessor.cs
r11586 r11590 29 29 namespace HeuristicLab.Operators { 30 30 [Item("LastSubScopeProsessor", "An operator which applies a specified operator on the last sub-scope.")] 31 public class LastSubScopeProcessor : SingleSuccessorOperator { 31 [StorableClass] 32 public sealed class LastSubScopeProcessor : SingleSuccessorOperator { 32 33 private OperatorParameter OperatorParameter { 33 34 get { return (OperatorParameter)Parameters["Operator"]; } -
branches/ALPS/HeuristicLab.Optimization.Operators/3.3/ExpressionCalculator.cs
r11586 r11590 78 78 predicates: 79 79 ==, <, >, isnull, not 80 array index:81 []82 80 stack manipulation: 83 81 drop swap dup
Note: See TracChangeset
for help on using the changeset viewer.