- Timestamp:
- 03/10/11 12:05:03 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmEvaluator.cs
r5653 r5655 1 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 2 using System.Diagnostics; 3 using HeuristicLab.Common; 4 using HeuristicLab.Core; 5 using HeuristicLab.Data; 5 6 using HeuristicLab.Operators; 6 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;7 using HeuristicLab.Core;8 using HeuristicLab.Common;9 7 using HeuristicLab.Optimization; 10 8 using HeuristicLab.Parameters; 11 using HeuristicLab.Data; 12 using System.Diagnostics; 9 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 13 10 14 11 namespace HeuristicLab.Problems.MetaOptimization { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj
r5653 r5655 73 73 <ItemGroup> 74 74 <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3"> 75 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>75 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath> 76 76 </Reference> 77 77 <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 78 <HintPath> ..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis-3.3.dll</HintPath>78 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis-3.3.dll</HintPath> 79 79 </Reference> 80 80 <Reference Include="HeuristicLab.Collections-3.3"> 81 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>81 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath> 82 82 </Reference> 83 83 <Reference Include="HeuristicLab.Common-3.3"> 84 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>84 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath> 85 85 </Reference> 86 86 <Reference Include="HeuristicLab.Common.Resources-3.3"> 87 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Common.Resources-3.3.dll</HintPath>87 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common.Resources-3.3.dll</HintPath> 88 88 </Reference> 89 89 <Reference Include="HeuristicLab.Core-3.3"> 90 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath>90 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath> 91 91 </Reference> 92 92 <Reference Include="HeuristicLab.Data-3.3"> 93 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath>93 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath> 94 94 </Reference> 95 95 <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3"> 96 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>96 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath> 97 97 </Reference> 98 98 <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3"> 99 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath>99 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath> 100 100 </Reference> 101 101 <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3"> 102 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>102 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath> 103 103 </Reference> 104 104 <Reference Include="HeuristicLab.Operators-3.3"> 105 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Operators-3.3.dll</HintPath>105 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Operators-3.3.dll</HintPath> 106 106 </Reference> 107 107 <Reference Include="HeuristicLab.Optimization-3.3"> 108 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath>108 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath> 109 109 </Reference> 110 110 <Reference Include="HeuristicLab.Parameters-3.3"> 111 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Parameters-3.3.dll</HintPath>111 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Parameters-3.3.dll</HintPath> 112 112 </Reference> 113 113 <Reference Include="HeuristicLab.Persistence-3.3"> 114 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>114 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath> 115 115 </Reference> 116 116 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 117 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 117 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 118 </Reference> 119 <Reference Include="HeuristicLab.Problems.DataAnalysis-3.3"> 120 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.3.dll</HintPath> 118 121 </Reference> 119 122 <Reference Include="HeuristicLab.Problems.TestFunctions-3.3"> 120 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TestFunctions-3.3.dll</HintPath>123 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TestFunctions-3.3.dll</HintPath> 121 124 </Reference> 122 125 <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 123 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Random-3.3.dll</HintPath>126 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Random-3.3.dll</HintPath> 124 127 </Reference> 125 128 <Reference Include="HeuristicLab.Selection-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 126 <HintPath> ..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Selection-3.3.dll</HintPath>129 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Selection-3.3.dll</HintPath> 127 130 </Reference> 128 131 <Reference Include="HeuristicLab.SequentialEngine-3.3"> 129 <HintPath> ..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.SequentialEngine-3.3.dll</HintPath>132 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.SequentialEngine-3.3.dll</HintPath> 130 133 </Reference> 131 134 <Reference Include="System" /> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLabProblemsMetaOptimizationPlugin.cs.frame
r4982 r5655 28 28 [Plugin("HeuristicLab.Problems.MetaOptimization", "3.3.2.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.MetaOptimization-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Algorithms.GeneticAlgorithm", "3.3")] 31 [PluginDependency("HeuristicLab.Analysis", "3.3")] 30 32 [PluginDependency("HeuristicLab.Collections", "3.3")] 31 33 [PluginDependency("HeuristicLab.Common", "3.3")] … … 40 42 [PluginDependency("HeuristicLab.Parameters", "3.3")] 41 43 [PluginDependency("HeuristicLab.Persistence", "3.3")] 44 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.3")] 45 [PluginDependency("HeuristicLab.Problems.TestFunctions", "3.3")] 46 [PluginDependency("HeuristicLab.Random", "3.3")] 47 [PluginDependency("HeuristicLab.Selection", "3.3")] 48 [PluginDependency("HeuristicLab.SequentialEngine", "3.3")] 42 49 public class HeuristicLabProblemsMetaOptimizationPlugin : PluginBase { 43 50 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs
r5654 r5655 23 23 using System.Linq; 24 24 using HeuristicLab.Algorithms.GeneticAlgorithm; 25 using HeuristicLab.Collections; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; … … 30 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 32 using HeuristicLab.PluginInfrastructure; 33 using HeuristicLab.Problems.DataAnalysis; 32 34 using HeuristicLab.Problems.TestFunctions; 33 35 … … 78 80 #region Properties 79 81 public IAlgorithm Algorithm { 80 get { return CreateAlgorithm(AlgorithmType.Value, Problem Type.Value); }82 get { return CreateAlgorithm(AlgorithmType.Value, Problems.FirstOrDefault()); } 81 83 } 82 84 public ConstrainedTypeValue<IAlgorithm> AlgorithmType { … … 174 176 ProblemTypeParameter.ValueChanged += new EventHandler(ProblemTypeParameter_ValueChanged); 175 177 ProblemType.ValueChanged += new EventHandler(ProblemType_ValueChanged); 178 Problems.ItemsAdded += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<IProblem>>(Problems_ItemsAdded); 179 Problems.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<IProblem>>(Problems_ItemsRemoved); 176 180 } 177 181 … … 249 253 this.ProblemType.ValidTypes = ApplicationManager.Manager.GetTypes(instance.ProblemType, true).ToList(); 250 254 this.ProblemType.Value = this.ProblemType.ValidTypes.SingleOrDefault(t => t == typeof(SingleObjectiveTestFunctionProblem)) ?? this.ProblemType.ValidTypes.Where(t => t != typeof(MetaOptimizationProblem)).FirstOrDefault(); 251 if (ProblemType.Value != null) { 252 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, ProblemType.Value)); 253 Problems.Add((IProblem)Activator.CreateInstance(this.ProblemType.Value)); 254 } else { 255 ParameterConfigurationTreeParameter.ActualValue = null; 256 } 255 // ProblemType_ValueChanged will add one problem and create ParameterConfigurationTree 257 256 } 258 257 … … 264 263 Problems.Clear(); 265 264 Problems.Type = ProblemType.Value; 266 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, ProblemType.Value)); 265 Problems.Add((IProblem)Activator.CreateInstance(this.ProblemType.Value)); 266 } 267 268 private void Problems_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IndexedItem<IProblem>> e) { 269 // the first problem in the list is always the instance for the algorithm - this way some basic wiring between problem and algorithm can be sustained 270 if (e.Items.Single().Index == 0) { 271 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, e.Items.Single().Value)); 272 273 // special for DataAnalysisProblem: Because of wiring between algorithm and problem, ParameterConfigurationTree needs to be recreated on Reset event 274 var dap = e.Items.Single().Value as DataAnalysisProblem; 275 if (dap != null) { 276 dap.Reset += new EventHandler(DataAnalysisProblem_Reset); 277 } 278 } 279 } 280 281 private void Problems_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<IndexedItem<IProblem>> e) { 282 if (e.Items.Single().Index == 0) { 283 ParameterConfigurationTreeParameter.ActualValue = null; 284 285 var dap = e.Items.Single().Value as DataAnalysisProblem; 286 if (dap != null) { 287 dap.Reset -= new EventHandler(DataAnalysisProblem_Reset); 288 } 289 } 290 } 291 292 private void DataAnalysisProblem_Reset(object sender, EventArgs e) { 293 ParameterConfigurationTreeParameter.ActualValue = new ParameterConfigurationTree(CreateAlgorithm(AlgorithmType.Value, Problems.First())); 267 294 } 268 295 #endregion 269 296 270 private IAlgorithm CreateAlgorithm(Type algorithmType, Type problemType) {297 private IAlgorithm CreateAlgorithm(Type algorithmType, IProblem problem) { 271 298 IAlgorithm algorithm = (IAlgorithm)Activator.CreateInstance(algorithmType); 272 algorithm.Problem = (IProblem)Activator.CreateInstance(problemType);299 algorithm.Problem = problem; 273 300 return algorithm; 274 301 }
Note: See TracChangeset
for help on using the changeset viewer.