Changeset 3446
- Timestamp:
- 04/20/10 17:01:31 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs
r3429 r3446 37 37 public sealed class OffspringSelectionGeneticAlgorithmMainLoop : AlgorithmOperator { 38 38 #region Parameter properties 39 public OptionalValueParameter<VariableCreator> VariableInitializerParameter {40 get { return (OptionalValueParameter<VariableCreator>)Parameters["VariableInitializer"]; }41 }42 39 public ValueLookupParameter<IRandom> RandomParameter { 43 40 get { return (ValueLookupParameter<IRandom>)Parameters["Random"]; } … … 104 101 } 105 102 #endregion 106 107 public VariableCreator VariableInitializer {108 get { return VariableInitializerParameter.Value; }109 set { VariableInitializerParameter.Value = value; }110 }111 103 112 104 [StorableConstructor] … … 119 111 private void Initialize() { 120 112 #region Create parameters 121 Parameters.Add(new OptionalValueParameter<VariableCreator>("VariableInitializer", "Operator to initialize some variables.", new VariableCreator()));122 113 Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator.")); 123 114 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false.")); … … 144 135 145 136 #region Create operators 146 Placeholder variableInitializer = new Placeholder();137 ConditionalBranch initializationBranch = new ConditionalBranch(); 147 138 VariableCreator variableCreator = new VariableCreator(); 148 139 Assigner variableAssigner = new Assigner(); … … 196 187 ConditionalBranch conditionalBranch2 = new ConditionalBranch(); 197 188 198 VariableInitializer.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); 199 VariableInitializer.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0))); 200 VariableInitializer.Successor = variableAssigner; 201 202 variableAssigner.LeftSideParameter.ActualName = "ComparisonFactor"; 203 variableAssigner.RightSideParameter.ActualName = ComparisonFactorLowerBoundParameter.Name; 204 205 variableInitializer.Name = "VariableInitializer (placeholder)"; 206 variableInitializer.OperatorParameter.ActualName = VariableInitializerParameter.Name; 207 189 initializationBranch.ConditionParameter.ActualName = "IsInitialized"; 190 191 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); 192 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0))); 208 193 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0))); 209 194 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("CurrentSuccessRatio", new DoubleValue(0))); 210 195 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutionsResult", new IntValue(0))); 196 variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("IsInitialized", new BoolValue(true))); 197 198 variableAssigner.LeftSideParameter.ActualName = "ComparisonFactor"; 199 variableAssigner.RightSideParameter.ActualName = ComparisonFactorLowerBoundParameter.Name; 211 200 212 201 bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; … … 397 386 398 387 #region Create operator graph 399 OperatorGraph.InitialOperator = variableInitializer; 400 variableInitializer.Successor = variableCreator; 401 variableCreator.Successor = bestQualityMemorizer1; 388 OperatorGraph.InitialOperator = initializationBranch; 389 initializationBranch.FalseBranch = variableCreator; 390 initializationBranch.Successor = selector; 391 variableCreator.Successor = variableAssigner; 392 variableAssigner.Successor = bestQualityMemorizer1; 402 393 bestQualityMemorizer1.Successor = bestQualityMemorizer2; 403 394 bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator1; … … 407 398 qualityDifferenceCalculator1.Successor = visualizer1; 408 399 visualizer1.Successor = resultsCollector; 409 resultsCollector.Successor = selector;400 resultsCollector.Successor = null; 410 401 selector.Successor = subScopesProcessor1; 411 402 subScopesProcessor1.Operators.Add(new EmptyOperator()); -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionIslandGeneticAlgorithmMainLoop.cs
r3429 r3446 192 192 193 193 islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("IslandResults", new ResultCollection())); 194 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); 195 islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0))); 196 197 islandVariableAssigner.LeftSideParameter.ActualName = "ComparisonFactor"; 198 islandVariableAssigner.RightSideParameter.ActualName = ComparisonFactorLowerBoundParameter.Name; 194 195 islandVariableAssigner.LeftSideParameter.ActualName = "MaximumGenerations"; 196 islandVariableAssigner.RightSideParameter.ActualName = "MigrationInterval"; 199 197 200 198 bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; … … 242 240 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; 243 241 244 mainLoop.VariableInitializer = null; // we do the variable initialization here245 242 mainLoop.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; 246 243 mainLoop.MaximizationParameter.ActualName = MaximizationParameter.Name;
Note: See TracChangeset
for help on using the changeset viewer.