Changeset 8711
- Timestamp:
- 10/01/12 22:53:20 (12 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/AfterCrossoverCombinedOperator.cs
r8709 r8711 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Operators;25 24 using HeuristicLab.Optimization; 26 25 using HeuristicLab.Optimization.Operators; … … 31 30 [Item("AfterCrossoverCombinedOperator", "An operator that contains all operators that need to be executed after crossover.")] 32 31 [StorableClass] 33 public class AfterCrossoverCombinedOperator : MultiOperator<IOperator> { 34 35 private CrossoverPerformanceAnalyzer cxAnalyzer; 36 37 private ScopeParameter CurrentScopeParameter { 38 get { return (ScopeParameter)Parameters["CurrentScope"]; } 39 } 40 public IScope CurrentScope { 41 get { return CurrentScopeParameter.ActualValue; } 42 } 32 public class AfterCrossoverCombinedOperator : CombinedOperator { 43 33 public ILookupParameter<IEvaluator> EvaluatorParameter { 44 34 get { return ((LookupParameter<IEvaluator>)Parameters["Evaluator"]); } … … 49 39 50 40 [StorableConstructor] 51 pr ivateAfterCrossoverCombinedOperator(bool deserializing) : base(deserializing) { }52 pr ivateAfterCrossoverCombinedOperator(AfterCrossoverCombinedOperator original, Cloner cloner)41 protected AfterCrossoverCombinedOperator(bool deserializing) : base(deserializing) { } 42 protected AfterCrossoverCombinedOperator(AfterCrossoverCombinedOperator original, Cloner cloner) 53 43 : base(original, cloner) { 54 44 } … … 56 46 public AfterCrossoverCombinedOperator() 57 47 : base() { 58 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope whose variables and sub-scopes should be removed."));59 48 Parameters.Add(new LookupParameter<IEvaluator>("Evaluator", "The operator which is used to evaluate new solutions.")); 60 49 Parameters.Add(new ValueParameter<SingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator")); 61 50 62 51 SimilarityCalculatorParameter.ValueChanged += new System.EventHandler(SimilarityCalculatorParameter_ValueChanged); 63 64 cxAnalyzer = new CrossoverPerformanceAnalyzer();65 var varDuplicator = new VariableDuplicator();66 67 Operators.Add(cxAnalyzer);68 Operators.Add(varDuplicator);69 52 } 70 53 … … 72 55 SimilarityCalculatorParameter.Value.QualityVariableName = "TSPTourLength"; 73 56 SimilarityCalculatorParameter.Value.SolutionVariableName = "TSPTour"; 74 cxAnalyzer.SimilarityCalculatorParameter.Value = SimilarityCalculatorParameter.Value;75 57 } 76 58 … … 79 61 } 80 62 81 public override IOperation Apply() {82 if (!Operators.Contains(EvaluatorParameter.ActualValue)) {83 Operators.Insert(0, EvaluatorParameter.ActualValue);84 }63 public override void InitializeOperators() { 64 var cxAnalyzer = new CrossoverPerformanceAnalyzer(); 65 cxAnalyzer.SimilarityCalculatorParameter.Value = SimilarityCalculatorParameter.Value; 66 var varDuplicator = new VariableDuplicator(); 85 67 86 OperationCollection next = new OperationCollection(base.Apply()); 87 OperationCollection inner = new OperationCollection(); 88 inner.Parallel = false; 89 90 for (int i = 0; i < Operators.Count; i++) { 91 inner.Add(ExecutionContext.CreateOperation(Operators[i], CurrentScope)); 92 } 93 next.Insert(0, inner); 94 return next; 68 Operators.Add(EvaluatorParameter.ActualValue); 69 Operators.Add(cxAnalyzer); 70 Operators.Add(varDuplicator); 95 71 } 96 72 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj
r8709 r8711 116 116 </ItemGroup> 117 117 <ItemGroup> 118 <Compile Include="CombinedOperator.cs" /> 119 <Compile Include="AlgorithmBehaviorHelpers.cs" /> 118 120 <Compile Include="AfterCrossoverCombinedOperator.cs" /> 119 <Compile Include="A lgorithmBehaviorHelpers.cs" />121 <Compile Include="AfterMutationCombinedOperator.cs" /> 120 122 <Compile Include="PathRelinkerPerformanceAnalyzer.cs" /> 121 123 <Compile Include="VariableRemover.cs" /> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/VariableRemover.cs
r8661 r8711 52 52 Parameters.Add(new ValueParameter<StringValue>("VariableName", "The name of the variable to remove from the current scope.")); 53 53 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope whose variables and sub-scopes should be removed.")); 54 VariableNameParameter.Value.Value = "TSPTourClone"; 54 55 } 55 56
Note: See TracChangeset
for help on using the changeset viewer.