- Timestamp:
- 10/06/10 21:38:31 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Classification/HeuristicLab.Algorithms.DataAnalysis/3.3/CrossValidation.cs
r4561 r4563 73 73 public override IDeepCloneable Clone(Cloner cloner) { 74 74 CrossValidation clone = (CrossValidation)base.Clone(cloner); 75 clone.DeregisterEvents(); 75 clone.DeregisterEvents(); //not necessary 76 76 clone.executionState = executionState; 77 77 clone.executionTime = executionTime; … … 107 107 108 108 if (algorithm != null) { 109 algorithm.StoreAlgorithmInEachRun = StoreAlgorithmInEachRun;109 algorithm.StoreAlgorithmInEachRun = false; 110 110 RegisterAlgorithmEvents(); 111 111 algorithm.Prepare(true); … … 121 121 122 122 [Storable] 123 private I DataAnalysisProblem cachedProblem;124 public I DataAnalysisProblem Problem {123 private ISingleObjectiveDataAnalysisProblem problem; 124 public ISingleObjectiveDataAnalysisProblem Problem { 125 125 get { 126 126 if (algorithm == null) 127 127 return null; 128 return (I DataAnalysisProblem)algorithm.Problem;128 return (ISingleObjectiveDataAnalysisProblem)algorithm.Problem; 129 129 } 130 130 set { … … 133 133 if (algorithm == null) throw new ArgumentNullException("Could not set a problem before an algorithm was set."); 134 134 algorithm.Problem = value; 135 cachedProblem = value;135 problem = value; 136 136 } 137 137 } … … 142 142 if (value != null && !ProblemType.IsInstanceOfType(value)) 143 143 throw new ArgumentException("Only DataAnalysisProblems could be used for the cross validation."); 144 Problem = (I DataAnalysisProblem)value;144 Problem = (ISingleObjectiveDataAnalysisProblem)value; 145 145 } 146 146 } 147 147 public Type ProblemType { 148 get { return typeof(I DataAnalysisProblem); }148 get { return typeof(ISingleObjectiveDataAnalysisProblem); } 149 149 } 150 150 … … 245 245 246 246 public void Prepare() { 247 if ( (ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused) && (ExecutionState != ExecutionState.Stopped))247 if (ExecutionState == ExecutionState.Started) 248 248 throw new InvalidOperationException(string.Format("Prepare not allowed in execution state \"{0}\".", ExecutionState)); 249 249 clonedAlgorithms.Clear(); … … 442 442 } 443 443 private void Algorithm_ProblemChanged(object sender, EventArgs e) { 444 if (algorithm.Problem != null && !(algorithm.Problem is I DataAnalysisProblem)) {445 algorithm.Problem = cachedProblem;444 if (algorithm.Problem != null && !(algorithm.Problem is ISingleObjectiveDataAnalysisProblem)) { 445 algorithm.Problem = problem; 446 446 throw new ArgumentException("A cross validation algorithm can only contain DataAnalysisProblems."); 447 447 } 448 cachedProblem = (IDataAnalysisProblem)algorithm.Problem;448 problem = (ISingleObjectiveDataAnalysisProblem)algorithm.Problem; 449 449 OnProblemChanged(); 450 450 }
Note: See TracChangeset
for help on using the changeset viewer.