Changeset 13096 for branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainOperator.cs
- Timestamp:
- 11/02/15 15:59:48 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainOperator.cs
r13095 r13096 40 40 41 41 // Operator starts with calculating number of selected scopes base on plus/comma-selection replacement scheme 42 var numberOfSubScopesBranch = new ConditionalBranch() { Name = "PlusSelection?" }; 43 var numberOfSelectedSubScopesPlusCalculator = new ExpressionCalculator() { Name = "NumberOfSelectedSubScopes = PopulationSize * 2" }; 44 var numberOfSelectedSubScopesCalculator = new ExpressionCalculator() { Name = "NumberOfSelectedSubScopes = (PopulationSize - Elites) * 2" }; 42 var numberOfSelectedSubScopesCalculator = new ExpressionCalculator() { Name = "NumberOfSelectedSubScopes = 2 * (PopulationSize - if PlusSelection then 0 else Elites)" }; 45 43 var replacementBranch = new ConditionalBranch() { Name = "PlusSelection?" }; 46 44 47 45 // Set new initial operator 48 mainLoop.OperatorGraph.InitialOperator = numberOfSubScopesBranch; 49 50 numberOfSubScopesBranch.ConditionParameter.ActualName = "PlusSelection"; 51 numberOfSubScopesBranch.TrueBranch = numberOfSelectedSubScopesPlusCalculator; 52 numberOfSubScopesBranch.FalseBranch = numberOfSelectedSubScopesCalculator; 53 numberOfSubScopesBranch.Successor = selector; 54 55 numberOfSelectedSubScopesPlusCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize")); 56 numberOfSelectedSubScopesPlusCalculator.ExpressionResultParameter.ActualName = "NumberOfSelectedSubScopes"; 57 numberOfSelectedSubScopesPlusCalculator.ExpressionParameter.Value = new StringValue("PopulationSize 2 * toint"); 46 mainLoop.OperatorGraph.InitialOperator = numberOfSelectedSubScopesCalculator; 58 47 59 48 numberOfSelectedSubScopesCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize")); 60 49 numberOfSelectedSubScopesCalculator.CollectedValues.Add(new LookupParameter<IntValue>("Elites")); 50 numberOfSelectedSubScopesCalculator.CollectedValues.Add(new LookupParameter<BoolValue>("PlusSelection")); 61 51 numberOfSelectedSubScopesCalculator.ExpressionResultParameter.ActualName = "NumberOfSelectedSubScopes"; 62 numberOfSelectedSubScopesCalculator.ExpressionParameter.Value = new StringValue("PopulationSize Elites - 2 * toint"); 52 numberOfSelectedSubScopesCalculator.ExpressionParameter.Value = new StringValue("PopulationSize 0 Elites PlusSelection if - 2 * toint"); 53 numberOfSelectedSubScopesCalculator.Successor = selector; 63 54 64 55 // Use Elitism or Plus-Selection as replacement strategy
Note: See TracChangeset
for help on using the changeset viewer.