Changeset 4563
- Timestamp:
- 10/06/10 21:38:31 (14 years ago)
- Location:
- branches/HeuristicLab.Classification
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Classification/HeuristicLab.Algorithms.DataAnalysis.Views/3.3/CrossValidationView.cs
r4561 r4563 192 192 193 193 private void workersNumericUpDown_Validated(object sender, EventArgs e) { 194 if ( foldsNumericUpDown.Text == string.Empty)194 if (workersNumericUpDown.Text == string.Empty) 195 195 workersNumericUpDown.Text = workersNumericUpDown.Value.ToString(); 196 196 } … … 261 261 problemTypeSelectorDialog.Caption = "Select Problem"; 262 262 problemTypeSelectorDialog.TypeSelector.Caption = "Available Problems"; 263 problemTypeSelectorDialog.TypeSelector.Configure( typeof(IDataAnalysisProblem), false, true);263 problemTypeSelectorDialog.TypeSelector.Configure(Content.ProblemType, false, true); 264 264 } 265 265 if (problemTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 266 266 try { 267 Content.Problem = (I DataAnalysisProblem)problemTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();267 Content.Problem = (ISingleObjectiveDataAnalysisProblem)problemTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 268 268 } 269 269 catch (Exception ex) { … … 282 282 try { 283 283 if (error != null) throw error; 284 I DataAnalysisProblem problem = content as IDataAnalysisProblem;284 ISingleObjectiveDataAnalysisProblem problem = content as ISingleObjectiveDataAnalysisProblem; 285 285 if (problem == null && (Content.Algorithm.ProblemType.IsAssignableFrom(content.GetType()))) 286 286 Invoke(new Action(() => … … 339 339 private void algorithmProblemTabPage_DragDrop(object sender, DragEventArgs e) { 340 340 if (e.Effect != DragDropEffects.None) { 341 I DataAnalysisProblem problem = e.Data.GetData("Value") as IDataAnalysisProblem;342 if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) problem = (I DataAnalysisProblem)problem.Clone();341 ISingleObjectiveDataAnalysisProblem problem = e.Data.GetData("Value") as ISingleObjectiveDataAnalysisProblem; 342 if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) problem = (ISingleObjectiveDataAnalysisProblem)problem.Clone(); 343 343 Content.Problem = problem; 344 344 } -
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 } -
branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/ProblemBase/Problem.cs
r4323 r4563 51 51 Parameters.Add(new ValueParameter<T>(EvaluatorParameterName, "The operator used to evaluate a solution.")); 52 52 Parameters.Add(new ValueParameter<U>(SolutionCreateParameterName, "The operator to create a solution.")); 53 Register ParameterEventHandlers();53 RegisterEventHandlers(); 54 54 } 55 55 56 56 [StorableHook(HookType.AfterDeserialization)] 57 57 private void AfterDeserialization() { 58 Register ParameterEventHandlers();58 RegisterEventHandlers(); 59 59 } 60 60 … … 62 62 Problem<T, U> clone = (Problem<T, U>)base.Clone(cloner); 63 63 clone.operators = new ItemCollection<IOperator>(operators.Select(x => (IOperator)cloner.Clone(x))); 64 clone.Register ParameterEventHandlers();64 clone.RegisterEventHandlers(); 65 65 return clone; 66 66 } 67 67 68 private void Register ParameterEventHandlers() {68 private void RegisterEventHandlers() { 69 69 Operators.ItemsAdded += new CollectionItemsChangedEventHandler<IOperator>(Operators_Changed); 70 70 Operators.ItemsRemoved += new CollectionItemsChangedEventHandler<IOperator>(Operators_Changed); … … 77 77 #region properties 78 78 private ItemCollection<IOperator> operators; 79 [Storable ]79 [Storable(Name = "Operators")] 80 80 private IEnumerable<IOperator> StorableOperators { 81 81 get { return operators; } -
branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/SingleObjectiveClassificationProblem.cs
r4536 r4563 30 30 [Item("Classification Problem", "Represents a classfication problem.")] 31 31 [StorableClass] 32 public abstract class SingleObjectiveClassificationProblem<T, U> : SingleObjectiveProblem<T, U>, I DataAnalysisProblem32 public abstract class SingleObjectiveClassificationProblem<T, U> : SingleObjectiveProblem<T, U>, ISingleObjectiveDataAnalysisProblem 33 33 where T : class, ISingleObjectiveEvaluator 34 34 where U : class, ISolutionCreator {
Note: See TracChangeset
for help on using the changeset viewer.