Changeset 5080 for trunk/sources/HeuristicLab.Optimization
- Timestamp:
- 12/10/10 17:38:49 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization/3.3
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r4564 r5080 112 112 <Compile Include="Algorithm.cs" /> 113 113 <Compile Include="BatchRun.cs" /> 114 <Compile Include="Interfaces\IMultiAnalyzer.cs" /> 114 115 <Compile Include="Interfaces\IIterationBasedOperator.cs" /> 115 116 <Compile Include="Interfaces\IRealVectorDecoder.cs" /> -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IMultiAnalyzer.cs
r5078 r5080 20 20 #endregion 21 21 22 22 23 using HeuristicLab.Core; 23 24 24 namespace HeuristicLab.Optimization { 25 25 /// <summary> 26 /// An interface which represents an analysis operator.26 /// An interface which represents an multi analysis operator. 27 27 /// </summary> 28 public interface I Analyzer : IOperator { }28 public interface IMultiAnalyzer : IMultiOperator<IAnalyzer>, IAnalyzer { } 29 29 } -
trunk/sources/HeuristicLab.Optimization/3.3/UserDefinedAlgorithm.cs
r4722 r5080 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 50 51 } 51 52 53 private IValueParameter AnalyzerParameter { 54 get { return (IValueParameter)Parameters["Analyzer"]; } 55 } 56 private IMultiAnalyzer Analyzer { 57 get { 58 if (AnalyzerParameter != null) 59 return AnalyzerParameter.Value as IMultiAnalyzer; 60 return null; 61 } 62 } 63 52 64 public UserDefinedAlgorithm() : base() { } 53 65 public UserDefinedAlgorithm(string name) : base(name) { } … … 64 76 return new UserDefinedAlgorithm(this, cloner); 65 77 } 78 79 #region update of problem specific analyzers 80 protected override void OnProblemChanged() { 81 AddProblemAnalyzer(); 82 base.OnProblemChanged(); 83 } 84 protected override void Problem_OperatorsChanged(object sender, System.EventArgs e) { 85 RemoveProblemAnalyzers(); 86 AddProblemAnalyzer(); 87 base.Problem_OperatorsChanged(sender, e); 88 } 89 90 protected override void DeregisterProblemEvents() { 91 RemoveProblemAnalyzers(); 92 base.DeregisterProblemEvents(); 93 } 94 95 private void RemoveProblemAnalyzers() { 96 if (Analyzer != null) { 97 foreach (var analyzer in Problem.Operators.OfType<IAnalyzer>()) 98 Analyzer.Operators.Remove(analyzer); 99 } 100 } 101 private void AddProblemAnalyzer() { 102 if (Analyzer != null && Problem != null) { 103 foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>()) { 104 Analyzer.Operators.Add(analyzer); 105 } 106 } 107 } 108 #endregion 66 109 } 67 110 }
Note: See TracChangeset
for help on using the changeset viewer.