Changeset 5110
- Timestamp:
- 12/15/10 15:43:43 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization
- Files:
-
- 7 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/HeuristicLab.MetaOptimization.Test.csproj
r5023 r5110 116 116 <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Data.Views-3.3.dll</HintPath> 117 117 </Reference> 118 <Reference Include="HeuristicLab.DebugEngine-3.3">119 <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.DebugEngine-3.3.dll</HintPath>120 </Reference>121 118 <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3"> 122 119 <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath> … … 320 317 <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\WeifenLuo.WinFormsUI.Docking-2.3.1.dll</HintPath> 321 318 </Reference> 322 <Reference Include="ZedGraph">323 <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\ZedGraph.dll</HintPath>324 </Reference>325 319 </ItemGroup> 326 320 <ItemGroup> 321 <Compile Include="PluginLoader.cs" /> 327 322 <Compile Include="Program.cs" /> 328 323 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/Program.cs
r5087 r5110 18 18 using HeuristicLab.Selection; 19 19 using HeuristicLab.Algorithms.EvolutionStrategy; 20 using HeuristicLab.PluginInfrastructure.Manager; 20 21 21 22 namespace HeuristicLab.MetaOptimization.Test { 22 23 class Program { 23 private static int metaAlgorithmPopulationSize = 50;24 private static int metaAlgorithmPopulationSize = 3; 24 25 private static int metaAlgorithmMaxGenerations = 30; 25 26 private static int metaProblemRepetitions = 3; 26 27 27 private static int baseAlgorithmMaxGenerations = 250;28 private static int baseAlgorithmMaxGenerations = 3; 28 29 29 30 static void Main(string[] args) { … … 32 33 //TestIntSampling(); 33 34 //TestDoubleSampling(); 34 35 //TestTypeDiscovery(); 36 35 37 GeneticAlgorithm baseLevelAlgorithm = new GeneticAlgorithm(); 36 38 37 39 MetaOptimizationProblem metaOptimizationProblem = new MetaOptimizationProblem(); 38 ((MetaOptimizationEvaluator)metaOptimizationProblem.Evaluator).Repetitions.Value = metaProblemRepetitions;40 metaOptimizationProblem.Repetitions = new IntValue(metaProblemRepetitions); 39 41 GeneticAlgorithm metaLevelAlgorithm = GetMetaGA(metaOptimizationProblem); 40 42 //EvolutionStrategy metaLevelAlgorithm = GetMetaES(metaOptimizationProblem); … … 53 55 54 56 Console.ReadLine(); 57 } 58 59 private static void TestTypeDiscovery() { 60 PluginLoader.pluginAssemblies.Any(); 61 62 var items = ApplicationManager.Manager.GetInstances(typeof(DoubleArray)).ToArray(); 63 64 foreach (var item in items) { 65 Console.WriteLine(item.ToString()); 66 } 55 67 } 56 68 … … 200 212 201 213 // uncheck multiMutator to avoid Michalewicz issue 202 var multiMutator = mutationOperator.ValueConfigurations.Where(x => x.ActualValue.Value .ItemName.StartsWith("Multi")).SingleOrDefault();214 var multiMutator = mutationOperator.ValueConfigurations.Where(x => x.ActualValue.Value != null && x.ActualValue.Value.ItemName.StartsWith("Multi")).SingleOrDefault(); 203 215 if (multiMutator != null) { 204 216 mutationOperator.ValueConfigurations.SetItemCheckedState(multiMutator, false); … … 272 284 string outputPath = Path.Combine(path, string.Format("{0} - Console.txt", id)); 273 285 274 275 286 using (var sw = new StreamWriter(outputPath)) { 276 287 sw.AutoFlush = true; … … 301 312 var orderedRuns = rc.OrderBy(x => x.Results["RunsAverageQuality"]); 302 313 303 sb.AppendLine("Qual. PoSi MutRa Eli GrSiMutOp");314 sb.AppendLine("Qual. PoSi MutRa Eli SelOp MutOp"); 304 315 foreach (IRun run in orderedRuns) { 305 316 string selector; … … 316 327 ((IntValue)run.Parameters["Elites"]).Value.ToString().PadLeft(3, ' '), 317 328 Shorten(selector, 20).PadRight(20, ' '), 318 run.Parameters ["Mutator"].ToString()));329 run.Parameters.ContainsKey("Mutator") ? run.Parameters["Mutator"].ToString() : "null")); 319 330 } 320 331 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.sln
r5023 r5110 15 15 TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings 16 16 EndProjectSection 17 EndProject18 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.MetaOptimization.Tests", "HeuristicLab.MetaOptimization.Tests\HeuristicLab.MetaOptimization.Tests.csproj", "{7978A3C0-5166-4392-B00F-58AA3C31E107}"19 17 EndProject 20 18 Global … … 35 33 {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 36 34 {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 37 {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Debug|x86.ActiveCfg = Debug|Any CPU 35 {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Debug|x86.ActiveCfg = Debug|x86 36 {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Debug|x86.Build.0 = Debug|x86 38 37 {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 38 {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Release|Any CPU.Build.0 = Release|Any CPU … … 45 44 {59567338-A551-4386-8405-A8C0DF3E376D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 46 45 {59567338-A551-4386-8405-A8C0DF3E376D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 47 {59567338-A551-4386-8405-A8C0DF3E376D}.Debug|x86.ActiveCfg = Debug|Any CPU 46 {59567338-A551-4386-8405-A8C0DF3E376D}.Debug|x86.ActiveCfg = Debug|x86 47 {59567338-A551-4386-8405-A8C0DF3E376D}.Debug|x86.Build.0 = Debug|x86 48 48 {59567338-A551-4386-8405-A8C0DF3E376D}.Release|Any CPU.ActiveCfg = Release|Any CPU 49 49 {59567338-A551-4386-8405-A8C0DF3E376D}.Release|Any CPU.Build.0 = Release|Any CPU … … 62 62 {0E232F46-FD0B-4FEA-8C22-AF18DE0D151E}.Release|x86.ActiveCfg = Release|x86 63 63 {0E232F46-FD0B-4FEA-8C22-AF18DE0D151E}.Release|x86.Build.0 = Release|x86 64 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU65 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|Any CPU.Build.0 = Debug|Any CPU66 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU67 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU68 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|x86.ActiveCfg = Debug|Any CPU69 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|Any CPU.ActiveCfg = Release|Any CPU70 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|Any CPU.Build.0 = Release|Any CPU71 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU72 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|Mixed Platforms.Build.0 = Release|Any CPU73 {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|x86.ActiveCfg = Release|Any CPU74 64 EndGlobalSection 75 65 GlobalSection(SolutionProperties) = preSolution -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/HeuristicLab.Problems.MetaOptimization.Views-3.3.csproj
r5023 r5110 38 38 <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile> 39 39 </PropertyGroup> 40 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> 41 <DebugSymbols>true</DebugSymbols> 42 <OutputPath>bin\x86\Debug\</OutputPath> 43 <DefineConstants>DEBUG;TRACE</DefineConstants> 44 <DebugType>full</DebugType> 45 <PlatformTarget>x86</PlatformTarget> 46 <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Problems.MetaOptimization.Views-3.3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> 47 <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> 48 <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> 49 <ErrorReport>prompt</ErrorReport> 50 <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 51 <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories> 52 <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets> 53 <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories> 54 <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules> 55 </PropertyGroup> 56 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> 57 <OutputPath>bin\x86\Release\</OutputPath> 58 <DefineConstants>TRACE</DefineConstants> 59 <Optimize>true</Optimize> 60 <DebugType>pdbonly</DebugType> 61 <PlatformTarget>x86</PlatformTarget> 62 <CodeAnalysisLogFile>bin\Release\HeuristicLab.Problems.MetaOptimization.Views-3.3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> 63 <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> 64 <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> 65 <ErrorReport>prompt</ErrorReport> 66 <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 67 <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories> 68 <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> 69 <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories> 70 <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> 71 <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules> 72 </PropertyGroup> 40 73 <ItemGroup> 41 74 <Reference Include="HeuristicLab.Collections-3.3"> … … 86 119 <ItemGroup> 87 120 <None Include="HeuristicLabProblemsMetaOptimizationViewsPlugin.cs.frame" /> 121 <Compile Include="ConstrainedItemListView.cs"> 122 <SubType>UserControl</SubType> 123 </Compile> 124 <Compile Include="ConstrainedItemListView.Designer.cs"> 125 <DependentUpon>ConstrainedItemListView.cs</DependentUpon> 126 </Compile> 88 127 <Compile Include="OptimizableView.cs"> 89 128 <SubType>UserControl</SubType> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ObjectSelectorDialog.Designer.cs
r4516 r5110 46 46 this.itemsListView.MultiSelect = false; 47 47 this.itemsListView.Name = "itemsListView"; 48 this.itemsListView.Size = new System.Drawing.Size( 765, 452);48 this.itemsListView.Size = new System.Drawing.Size(387, 501); 49 49 this.itemsListView.TabIndex = 2; 50 50 this.itemsListView.UseCompatibleStateImageBehavior = false; … … 72 72 this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 73 73 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 74 this.cancelButton.Location = new System.Drawing.Point( 702, 470);74 this.cancelButton.Location = new System.Drawing.Point(324, 519); 75 75 this.cancelButton.Name = "cancelButton"; 76 76 this.cancelButton.Size = new System.Drawing.Size(75, 23); … … 84 84 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; 85 85 this.okButton.Enabled = false; 86 this.okButton.Location = new System.Drawing.Point( 621, 470);86 this.okButton.Location = new System.Drawing.Point(243, 519); 87 87 this.okButton.Name = "okButton"; 88 88 this.okButton.Size = new System.Drawing.Size(75, 23); … … 98 98 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 99 99 this.CancelButton = this.cancelButton; 100 this.ClientSize = new System.Drawing.Size( 789, 505);100 this.ClientSize = new System.Drawing.Size(411, 554); 101 101 this.Controls.Add(this.cancelButton); 102 102 this.Controls.Add(this.okButton); -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ObjectSelectorDialog.cs
r4830 r5110 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.ComponentModel;4 using System.Data;5 using System.Drawing;6 3 using System.Linq; 7 using System.Text;8 4 using System.Windows.Forms; 9 5 using HeuristicLab.Core; 10 6 11 7 namespace HeuristicLab.Problems.MetaOptimization.Views { 12 public partial class ObjectSelectorDialog<T> : Form where T : I NamedItem {8 public partial class ObjectSelectorDialog<T> : Form where T : IItem { 13 9 private bool initialized; 14 10 private List<IItem> items; 15 private IEnumerable<IGrouping< Type, T>> selectableItems;11 private IEnumerable<IGrouping<string, T>> selectableItems; 16 12 17 13 private T item; … … 20 16 } 21 17 22 public ObjectSelectorDialog(IEnumerable<IGrouping< Type, T>> selectableItems) {18 public ObjectSelectorDialog(IEnumerable<IGrouping<string, T>> selectableItems) { 23 19 this.initialized = false; 24 20 this.items = new List<IItem>(); … … 31 27 if (!initialized) { 32 28 itemsListView.SmallImageList = new ImageList(); 33 34 foreach (IGrouping< Type, T> item in selectableItems) {35 ListViewGroup group = new ListViewGroup(item.Key .Name);29 30 foreach (IGrouping<string, T> item in selectableItems) { 31 ListViewGroup group = new ListViewGroup(item.Key); 36 32 itemsListView.Groups.Add(group); 37 33 foreach (T i in item) { 38 34 items.Add(i); 39 ListViewItem value = new ListViewItem(new string[] { i.Name, i.Description, i.ItemName }, group); 35 string[] columns; 36 if(i is INamedItem) { 37 INamedItem ni = i as INamedItem; 38 columns = new string[] { ni.Name, ni.Description, ni.GetType().Name }; 39 } else { 40 columns = new string[] { i.ItemName, i.ItemDescription, i.GetType().Name }; 41 } 42 ListViewItem value = new ListViewItem(columns, group); 40 43 itemsListView.SmallImageList.Images.Add(i.ItemImage); 41 44 value.ImageIndex = itemsListView.SmallImageList.Images.Count - 1; -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueConfigurationCheckedItemList.cs
r5087 r5110 70 70 71 71 protected override IValueConfiguration CreateItem() { 72 if (typeSelectorDialog == null) { 73 typeSelectorDialog = new TypeSelectorDialog(); 74 typeSelectorDialog.Caption = "Select Item"; 75 typeSelectorDialog.TypeSelector.Caption = "Available Items"; 76 typeSelectorDialog.TypeSelector.Configure(Content.ValueDataType, false, true); 77 } 78 79 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 72 var objectSelectorDialog = new ObjectSelectorDialog<IItem>(Content.ValidValues.GroupBy(x => ApplicationManager.Manager.GetDeclaringPlugin(x.GetType()).Name)); 73 if (objectSelectorDialog.ShowDialog(this) == DialogResult.OK) { 80 74 try { 81 IItem value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();75 IItem value = objectSelectorDialog.Item; 82 76 return new ValueConfiguration(value, value.GetType()); 83 77 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueView.cs
r4981 r5110 34 34 valueViewHost.Content = null; 35 35 } 36 SetEnabledStateOfControls(); 37 } 38 39 protected override void SetEnabledStateOfControls() { 40 base.SetEnabledStateOfControls(); 41 if (Content != null) { 42 clearValueButton.Enabled = Content.Value != null && Content.IsNullable; // IsNullable ist in diesem fall nicht richtig gesetzt 43 setValueButton.Enabled = Content.ValueDataType != null; 44 } 36 45 } 37 46 38 47 private void setValueButton_Click(object sender, EventArgs e) { 39 var typeSelectorDialog = new TypeSelectorDialog(); 40 typeSelectorDialog.Caption = "Select Value"; 41 typeSelectorDialog.TypeSelector.Configure(Content.ValueDataType, false, true); 42 43 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 48 var withoutNullValue = Content.ValidValues.Where(x => !(x is NullValue)); 49 var objectSelectorDialog = new ObjectSelectorDialog<IItem>(withoutNullValue.GroupBy(x => ApplicationManager.Manager.GetDeclaringPlugin(x.GetType()).Name)); 50 if (objectSelectorDialog.ShowDialog(this) == DialogResult.OK) { 44 51 try { 45 Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();52 Content.Value = objectSelectorDialog.Item; 46 53 valueViewHost.Content = Content.Value; 47 54 } … … 50 57 } 51 58 } 59 SetEnabledStateOfControls(); 52 60 } 53 61 … … 55 63 Content.Value = null; 56 64 valueViewHost.Content = null; 65 SetEnabledStateOfControls(); 57 66 } 58 67 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ParameterConfigurations/ParameterConfiguration.cs
r5087 r5110 1 1 using System; 2 using System.Collections; 2 3 using System.Collections.Generic; 3 4 using System.Linq; 4 5 using HeuristicLab.Common; 5 6 using HeuristicLab.Core; 7 using HeuristicLab.Data; 8 using HeuristicLab.Parameters; 6 9 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 7 10 using HeuristicLab.PluginInfrastructure; 8 using HeuristicLab.Parameters;9 using HeuristicLab.Data;10 using System.Collections;11 11 12 12 namespace HeuristicLab.Problems.MetaOptimization { … … 94 94 public ConstrainedValue ActualValue { 95 95 get { return actualValue; } 96 set { actualValue = value; } 97 } 98 99 // store parameter reference only for name/description/image/... 100 //[Storable] 101 //private IValueParameter parameter; 96 set { 97 if (actualValue != value) { 98 DeregisterActualValueEvents(); 99 actualValue = value; 100 RegisterActualValueEvents(); 101 } 102 } 103 } 104 105 [Storable] 106 protected bool isNullable; 107 public bool IsNullable { 108 get { return isNullable; } 109 protected set { 110 if (this.isNullable != value) { 111 this.isNullable = value; 112 } 113 } 114 } 102 115 103 116 #region Constructors and Cloning … … 105 118 this.ParameterName = parameterName; 106 119 this.parameterDataType = valueParameter.GetType(); 107 //this.parameter = valueParameter;108 120 this.valueDataType = valueParameter.DataType; 109 121 this.validValues = GetValidValues(valueParameter); 110 this.ValueConfigurations = new CheckedValueConfigurationCollection(this.valueDataType); 111 this.ActualValue = new ConstrainedValue(valueParameter.Value, valueParameter.DataType); 122 this.IsNullable = valueParameter.ItemName.StartsWith("Optional"); 123 if (IsNullable) { 124 validValues.Add(new NullValue()); 125 } 126 this.ValueConfigurations = new CheckedValueConfigurationCollection(this.validValues); 127 this.ActualValue = new ConstrainedValue(valueParameter.Value, valueParameter.DataType, this.ValidValues, this.IsNullable); 112 128 if (Optimize) { 113 129 PopulateValueConfigurations(); … … 121 137 this.parameterName = original.ParameterName; 122 138 this.parameterDataType = original.parameterDataType; 123 //this.parameter = cloner.Clone(original.parameter);124 139 this.valueDataType = original.ValueDataType; 125 140 this.validValues = cloner.Clone(original.ValidValues); … … 128 143 this.optimize = original.optimize; 129 144 this.actualValueConfigurationIndex = original.actualValueConfigurationIndex; 145 this.isNullable = original.isNullable; 130 146 if (this.valueConfigurations != null) RegisterValueConfigurationEvents(); 131 147 } … … 151 167 } 152 168 169 private void RegisterActualValueEvents() { 170 if (this.ActualValue != null) this.ActualValue.ToStringChanged += new EventHandler(ActualValue_ToStringChanged); 171 } 172 private void DeregisterActualValueEvents() { 173 if (this.ActualValue != null) this.ActualValue.ToStringChanged -= new EventHandler(ActualValue_ToStringChanged); 174 } 175 153 176 private void PopulateValueConfigurations() { 154 177 foreach (IItem validValue in this.validValues) { 155 IItem val; 156 if (ActualValue.Value != null && ActualValue.ValueDataType == validValue.GetType()) { 157 val = ActualValue.Value; // use existing value for that type (if available) 178 if (validValue is NullValue) { 179 this.ValueConfigurations.Add(new NullValueConfiguration()); 158 180 } else { 159 val = validValue; 160 } 161 this.ValueConfigurations.Add(new ValueConfiguration(val, val.GetType()), true); 181 IItem val; 182 if (ActualValue.Value != null && ActualValue.ValueDataType == validValue.GetType()) { 183 val = ActualValue.Value; // use existing value for that type (if available) 184 } else { 185 val = validValue; 186 } 187 this.ValueConfigurations.Add(new ValueConfiguration(val, val.GetType()), true); 188 } 162 189 } 163 190 } … … 223 250 224 251 #region Events 252 void ActualValue_ToStringChanged(object sender, EventArgs e) { 253 OnToStringChanged(); 254 } 255 #endregion 256 257 #region Event Handler 225 258 public virtual event EventHandler NameChanged; 226 259 protected virtual void OnNameChanged(object sender, EventArgs e) { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/RangeConstraints/ConstrainedValue.cs
r5009 r5110 32 32 } 33 33 34 [Storable] 35 protected IItemSet<IItem> validValues; 36 public IItemSet<IItem> ValidValues { 37 get { return validValues; } 38 protected set { 39 if (this.validValues != value) { 40 this.validValues = value; 41 } 42 } 43 } 44 45 [Storable] 46 protected bool isNullable; 47 public bool IsNullable { 48 get { return isNullable; } 49 protected set { 50 if (this.isNullable != value) { 51 this.isNullable = value; 52 } 53 } 54 } 55 34 56 private void RegisterEvents() { 35 57 this.value.ToStringChanged += new EventHandler(value_ToStringChanged); … … 43 65 [StorableConstructor] 44 66 protected ConstrainedValue(bool deserializing) : base(deserializing) { } 45 public ConstrainedValue(IItem value, Type valueDataType ) {67 public ConstrainedValue(IItem value, Type valueDataType, IItemSet<IItem> validValues, bool isNullable) { 46 68 this.Value = value; 47 69 this.ValueDataType = valueDataType; 70 this.ValidValues = validValues; 71 this.isNullable = isNullable; 48 72 } 49 73 protected ConstrainedValue(ConstrainedValue original, Cloner cloner) : base(original, cloner) { 50 74 this.valueDataType = original.valueDataType; 51 75 this.Value = cloner.Clone(original.value); 76 this.ValidValues = cloner.Clone(original.ValidValues); 77 this.isNullable = original.isNullable; 52 78 } 53 79 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ValueConfigurations/CheckedValueConfigurationCollection.cs
r5009 r5110 19 19 20 20 [Storable] 21 protected Type valueDataType;22 public Type ValueDataType{23 get { return val ueDataType; }21 protected IItemSet<IItem> validValues; 22 public IItemSet<IItem> ValidValues { 23 get { return validValues; } 24 24 } 25 25 26 public CheckedValueConfigurationCollection( Type valueDataType) {27 this.val ueDataType = valueDataType;26 public CheckedValueConfigurationCollection(IItemSet<IItem> validValues) { 27 this.validValues = validValues; 28 28 RegisterEvents(); 29 29 } … … 37 37 protected CheckedValueConfigurationCollection(CheckedValueConfigurationCollection original, Cloner cloner) : base(original, cloner) { 38 38 this.minItemCount = original.MinItemCount; 39 this.val ueDataType = original.valueDataType;39 this.validValues = original.validValues; 40 40 RegisterEvents(); 41 41 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ValueConfigurations/ValueConfiguration.cs
r5087 r5110 8 8 using HeuristicLab.Encodings.RealVectorEncoding; 9 9 using HeuristicLab.Encodings.IntegerVectorEncoding; 10 using HeuristicLab.PluginInfrastructure; 10 11 11 12 namespace HeuristicLab.Problems.MetaOptimization { … … 57 58 set { 58 59 if (this.actualValue != value) { 60 RegisterActualValueEvents(); 59 61 ClearParameterConfigurations(); 60 62 this.actualValue = value; … … 62 64 OnValueChanged(); 63 65 OnToStringChanged(); 66 DeregisterActualValueEvents(); 64 67 } 65 68 } … … 70 73 public IRange RangeConstraint { 71 74 get { return rangeConstraint; } 75 private set { 76 if (rangeConstraint != value) { 77 DeregisterRangeConstraintEvents(); 78 rangeConstraint = value; 79 RegisterActualValueEvents(); 80 } 81 } 72 82 } 73 83 … … 75 85 public ValueConfiguration(IItem value, Type valueDataType) { 76 86 this.ParameterConfigurations = new ItemList<IParameterConfiguration>(); 77 this.ActualValue = new ConstrainedValue(value, valueDataType); 87 var validValues = new ItemSet<IItem>(ApplicationManager.Manager.GetInstances(valueDataType).Select(x => (IItem)x).OrderBy(x => x.ItemName)); 88 this.ActualValue = new ConstrainedValue(value, valueDataType, validValues, false); 78 89 this.IsOptimizable = true; 79 90 if (actualValue.ValueDataType == typeof(IntValue)) { … … 88 99 rangeConstraint = null; 89 100 } 90 Register Events();101 RegisterRangeConstraintEvents(); 91 102 } 92 103 … … 101 112 this.isOptimizable = original.isOptimizable; 102 113 this.optimize = original.optimize; 103 RegisterEvents(); 114 RegisterActualValueEvents(); 115 RegisterRangeConstraintEvents(); 104 116 } 105 117 public override IDeepCloneable Clone(Cloner cloner) { … … 108 120 [StorableHook(HookType.AfterDeserialization)] 109 121 private void AfterDeserialization() { 110 Register Events();122 RegisterRangeConstraintEvents(); 111 123 } 112 124 #endregion … … 122 134 } 123 135 124 private void Register Events() {136 private void RegisterRangeConstraintEvents() { 125 137 if (this.RangeConstraint != null) this.RangeConstraint.ToStringChanged += new EventHandler(RangeConstraint_ToStringChanged); 126 if (this.ActualValue != null) this.ActualValue.ToStringChanged += new EventHandler(ConstrainedValue_ToStringChanged); 127 } 128 private void DeregisterEvents() { 129 if (this.RangeConstraint != null) this.RangeConstraint.ToStringChanged += new EventHandler(RangeConstraint_ToStringChanged); 130 if (this.ActualValue != null) this.ActualValue.ToStringChanged += new EventHandler(ConstrainedValue_ToStringChanged); 131 } 132 133 void ConstrainedValue_ToStringChanged(object sender, EventArgs e) { 138 } 139 private void DeregisterRangeConstraintEvents() { 140 if (this.RangeConstraint != null) this.RangeConstraint.ToStringChanged -= new EventHandler(RangeConstraint_ToStringChanged); 141 } 142 private void RegisterActualValueEvents() { 143 if (this.actualValue != null) this.actualValue.ToStringChanged += new EventHandler(actualValue_ToStringChanged); 144 } 145 private void DeregisterActualValueEvents() { 146 if (this.actualValue != null) this.actualValue.ToStringChanged -= new EventHandler(actualValue_ToStringChanged); 147 } 148 149 #region Events 150 void actualValue_ToStringChanged(object sender, EventArgs e) { 134 151 OnToStringChanged(); 135 152 } … … 137 154 OnToStringChanged(); 138 155 } 139 156 #endregion 157 140 158 #region IItem Members 141 159 public override string ItemDescription { … … 151 169 } 152 170 #endregion 153 171 154 172 #region Event Handlers 155 173 public virtual event EventHandler ValueChanged; … … 239 257 //this.actualValue.Value = new DoubleValue((((DoubleValue)this.actualValue.Value).Value + ((DoubleValue)other.ActualValue.Value).Value) / 2); 240 258 RealVector[] parents = new RealVector[2]; 241 parents[0] = new RealVector( new double[] {((DoubleValue)this.actualValue.Value).Value});242 parents[1] = new RealVector( new double[] {((DoubleValue)other.ActualValue.Value).Value});259 parents[0] = new RealVector(new double[] { ((DoubleValue)this.actualValue.Value).Value }); 260 parents[1] = new RealVector(new double[] { ((DoubleValue)other.ActualValue.Value).Value }); 243 261 244 262 if (random.NextDouble() < 0.5) { … … 248 266 } 249 267 //this.actualValue.Value = new DoubleValue(AverageCrossover.Apply(random, new ItemArray<RealVector>(parents)).First()); 250 268 251 269 } else if (this.actualValue.ValueDataType == typeof(PercentValue)) { 252 270 //this.actualValue.Value = new PercentValue((((PercentValue)this.actualValue.Value).Value + ((PercentValue)other.ActualValue.Value).Value) / 2); -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/MetaOptimizationEvaluator.cs
r5087 r5110 18 18 [StorableClass] 19 19 public class MetaOptimizationEvaluator : SingleSuccessorOperator, IMetaOptimizationEvaluator { 20 private const string RepetitionsParameterName = "Repetitions";21 22 20 private bool algorithmStopped; 23 21 … … 26 24 } 27 25 public ILookupParameter<EngineAlgorithm> AlgorithmParameter { 28 get { return (ILookupParameter<EngineAlgorithm>)Parameters[ "Algorithm"]; }26 get { return (ILookupParameter<EngineAlgorithm>)Parameters[MetaOptimizationProblem.AlgorithmTypeParameterName]; } 29 27 } 30 28 public ILookupParameter<IItemList<ISingleObjectiveProblem>> ProblemsParameter { 31 get { return (ILookupParameter<IItemList<ISingleObjectiveProblem>>)Parameters[ "Problems"]; }29 get { return (ILookupParameter<IItemList<ISingleObjectiveProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; } 32 30 } 33 31 public ILookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter { 34 32 get { return (ILookupParameter<ParameterConfigurationTree>)Parameters["ParameterConfigurationTree"]; } 35 33 } 36 public ValueParameter<IntValue> RepetitionsParameter {37 get { return ( ValueParameter<IntValue>)Parameters[RepetitionsParameterName]; }34 public LookupParameter<IntValue> RepetitionsParameter { 35 get { return (LookupParameter<IntValue>)Parameters[MetaOptimizationProblem.RepetitionsParameterName]; } 38 36 } 39 37 40 38 public IntValue Repetitions { 41 get { return RepetitionsParameter.Value; } 42 set { RepetitionsParameter.Value = value; } 39 get { return RepetitionsParameter.ActualValue; } 43 40 } 44 41 … … 46 43 : base() { 47 44 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The evaluated quality of the ParameterVector.")); 48 Parameters.Add(new LookupParameter<EngineAlgorithm>( "Algorithm", "Missing description."));49 Parameters.Add(new LookupParameter<IItemList<ISingleObjectiveProblem>>( "Problems", "Missing description."));45 Parameters.Add(new LookupParameter<EngineAlgorithm>(MetaOptimizationProblem.AlgorithmTypeParameterName, "Missing description.")); 46 Parameters.Add(new LookupParameter<IItemList<ISingleObjectiveProblem>>(MetaOptimizationProblem.ProblemsParameterName, "Missing description.")); 50 47 Parameters.Add(new LookupParameter<ParameterConfigurationTree>("ParameterConfigurationTree", "Missing description.")); 51 Parameters.Add(new ValueParameter<IntValue>(RepetitionsParameterName, "Number of evaluations for one individual.", new IntValue(3)));48 Parameters.Add(new LookupParameter<IntValue>(MetaOptimizationProblem.RepetitionsParameterName, "Number of evaluations on one problem.")); 52 49 } 53 50 -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj
r5087 r5110 38 38 <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile> 39 39 </PropertyGroup> 40 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> 41 <DebugSymbols>true</DebugSymbols> 42 <OutputPath>bin\x86\Debug\</OutputPath> 43 <DefineConstants>DEBUG;TRACE</DefineConstants> 44 <DebugType>full</DebugType> 45 <PlatformTarget>x86</PlatformTarget> 46 <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Problems.MetaOptimization-3.3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> 47 <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> 48 <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> 49 <ErrorReport>prompt</ErrorReport> 50 <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 51 <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories> 52 <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> 53 <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories> 54 <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> 55 </PropertyGroup> 56 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> 57 <OutputPath>bin\x86\Release\</OutputPath> 58 <DefineConstants>TRACE</DefineConstants> 59 <Optimize>true</Optimize> 60 <DebugType>pdbonly</DebugType> 61 <PlatformTarget>x86</PlatformTarget> 62 <CodeAnalysisLogFile>bin\Release\HeuristicLab.Problems.MetaOptimization-3.3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> 63 <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> 64 <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> 65 <ErrorReport>prompt</ErrorReport> 66 <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 67 <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories> 68 <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> 69 <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories> 70 <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> 71 <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules> 72 </PropertyGroup> 40 73 <ItemGroup> 74 <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3"> 75 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath> 76 </Reference> 41 77 <Reference Include="HeuristicLab.Collections-3.3"> 42 78 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath> … … 78 114 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 79 115 </Reference> 116 <Reference Include="HeuristicLab.Problems.TestFunctions-3.3"> 117 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TestFunctions-3.3.dll</HintPath> 118 </Reference> 80 119 <Reference Include="HeuristicLab.SequentialEngine-3.3"> 81 120 <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.SequentialEngine-3.3.dll</HintPath> … … 94 133 <None Include="Properties\AssemblyInfo.cs.frame" /> 95 134 <None Include="HeuristicLabProblemsMetaOptimizationPlugin.cs.frame" /> 135 <Compile Include="ConstrainedItemList.cs" /> 136 <Compile Include="Encodings\NullValue.cs" /> 137 <Compile Include="Encodings\ValueConfigurations\NullValueConfiguration.cs" /> 96 138 <Compile Include="Encodings\RangeConstraints\ConstrainedValue.cs"> 97 139 <SubType>Code</SubType> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/ICheckedValueConfigurationCollection.cs
r4982 r5110 8 8 public interface ICheckedValueConfigurationCollection : ICheckedItemCollection<IValueConfiguration> { 9 9 int MinItemCount { get; } 10 Type ValueDataType{ get; }10 IItemSet<IItem> ValidValues { get; } 11 11 } 12 12 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs
r5087 r5110 29 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 30 using HeuristicLab.PluginInfrastructure; 31 using HeuristicLab.Algorithms.GeneticAlgorithm; 32 using HeuristicLab.Problems.TestFunctions; 31 33 32 34 namespace HeuristicLab.Problems.MetaOptimization { … … 35 37 [StorableClass] 36 38 public sealed class MetaOptimizationProblem : SingleObjectiveProblem<IMetaOptimizationEvaluator, IParameterConfigurationCreator> { 37 private const string AlgorithmParameterName = "Algorithm"; 38 private const string ProblemsParameterName = "Problems"; 39 private const string AlgorithmParameterConfigurationParameterName = "InitialParameterConfigurationTree"; 40 //private const string ProblemParametersConfigurationParameterName = "ProblemParametersConfiguration"; 39 public const string AlgorithmTypeParameterName = "AlgorithmType"; 40 public const string ProblemTypeParameterName = "ProblemType"; 41 public const string ProblemsParameterName = "Problems"; 42 public const string ParameterConfigurationParameterName = "InitialParameterConfigurationTree"; 43 public const string RepetitionsParameterName = "Repetitions"; 41 44 42 45 #region Parameter Properties 43 public IValueParameter<EngineAlgorithm> Algorithm Parameter {44 get { return (ValueParameter<EngineAlgorithm>)Parameters[Algorithm ParameterName]; }46 public IValueParameter<EngineAlgorithm> AlgorithmTypeParameter { 47 get { return (ValueParameter<EngineAlgorithm>)Parameters[AlgorithmTypeParameterName]; } 45 48 } 46 public IValueParameter<I ItemList<ISingleObjectiveProblem>> ProblemsParameter {47 get { return (ValueParameter<I ItemList<ISingleObjectiveProblem>>)Parameters[ProblemsParameterName]; }49 public IValueParameter<ISingleObjectiveProblem> ProblemTypeParameter { 50 get { return (ValueParameter<ISingleObjectiveProblem>)Parameters[ProblemTypeParameterName]; } 48 51 } 49 public IValueParameter< ParameterConfigurationTree> AlgorithmParameterConfigurationParameter {50 get { return (ValueParameter< ParameterConfigurationTree>)Parameters[AlgorithmParameterConfigurationParameterName]; }52 public IValueParameter<ConstrainedItemList<ISingleObjectiveProblem>> ProblemsParameter { 53 get { return (ValueParameter<ConstrainedItemList<ISingleObjectiveProblem>>)Parameters[ProblemsParameterName]; } 51 54 } 52 //public ValueParameter<IItemList<IParameterConfiguration>> ProblemParametersConfigurationParameter { 53 // get { return (ValueParameter<IItemList<IParameterConfiguration>>)Parameters[ProblemParametersConfigurationParameterName]; } 54 //} 55 public IValueParameter<ParameterConfigurationTree> ParameterConfigurationParameter { 56 get { return (ValueParameter<ParameterConfigurationTree>)Parameters[ParameterConfigurationParameterName]; } 57 } 58 public IValueParameter<IntValue> RepetitionsParameter { 59 get { return (ValueParameter<IntValue>)Parameters[RepetitionsParameterName]; } 60 } 55 61 #endregion 56 62 57 63 #region Properties 58 64 public EngineAlgorithm Algorithm { 59 get { return Algorithm Parameter.Value; }60 set { Algorithm Parameter.Value = value; }65 get { return AlgorithmTypeParameter.Value; } 66 set { AlgorithmTypeParameter.Value = value; } 61 67 } 62 public IItemList<ISingleObjectiveProblem> Problems { 68 public ISingleObjectiveProblem Problem { 69 get { return ProblemTypeParameter.Value; } 70 set { ProblemTypeParameter.Value = value; } 71 } 72 public ConstrainedItemList<ISingleObjectiveProblem> Problems { 63 73 get { return ProblemsParameter.Value; } 64 74 set { ProblemsParameter.Value = value; } 65 75 } 66 76 public ParameterConfigurationTree AlgorithmParameterConfiguration { 67 get { return AlgorithmParameterConfigurationParameter.Value; }68 set { AlgorithmParameterConfigurationParameter.Value = value; }77 get { return ParameterConfigurationParameter.Value; } 78 set { ParameterConfigurationParameter.Value = value; } 69 79 } 70 //public IItemList<IParameterConfiguration> ProblemParametersConfiguration{71 // get { return ProblemParametersConfigurationParameter.Value; }72 // set { ProblemParametersConfigurationParameter.Value = value; }73 //}80 public IntValue Repetitions { 81 get { return RepetitionsParameter.Value; } 82 set { RepetitionsParameter.Value = value; } 83 } 74 84 #endregion 75 85 76 86 public MetaOptimizationProblem() : base() { 77 Parameters.Add(new ValueParameter<EngineAlgorithm>(AlgorithmParameterName, "The algorithm which's parameters should be optimized.")); 78 Parameters.Add(new ValueParameter<IItemList<ISingleObjectiveProblem>>(ProblemsParameterName, "The problems that should be evaluated.", new ItemList<ISingleObjectiveProblem>())); 79 Parameters.Add(new ValueParameter<ParameterConfigurationTree>(AlgorithmParameterConfigurationParameterName, "List of algorithm parameters that should be optimized.")); 80 //Parameters.Add(new ValueParameter<IItemList<IParameterConfiguration>>(ProblemParametersConfigurationParameterName, "List of problem parameters that should be optimized.", new ItemList<IParameterConfiguration>())); 81 87 Parameters.Add(new ValueParameter<EngineAlgorithm>(AlgorithmTypeParameterName, "The algorithm which's parameters should be optimized.", new GeneticAlgorithm())); 88 Parameters.Add(new ValueParameter<ISingleObjectiveProblem>(ProblemTypeParameterName, "The problem type.", new SingleObjectiveTestFunctionProblem())); 89 Parameters.Add(new ValueParameter<ConstrainedItemList<ISingleObjectiveProblem>>(ProblemsParameterName, "The problems that should be evaluated.", new ConstrainedItemList<ISingleObjectiveProblem>())); 90 Parameters.Add(new ValueParameter<ParameterConfigurationTree>(ParameterConfigurationParameterName, "List of algorithm parameters that should be optimized.")); 91 Parameters.Add(new ValueParameter<IntValue>(RepetitionsParameterName, "The number of evaluations for each problem.", new IntValue(3))); 92 82 93 Maximization = new BoolValue(false); 83 94 SolutionCreator = new RandomParameterConfigurationCreator(); … … 89 100 ParameterizeEvaluator(); 90 101 ParameterizeOperators(); 102 103 Problems.Type = Problem.GetType(); 104 Algorithm.Problem = Problem; 105 ParameterConfigurationParameter.ActualValue = new ParameterConfigurationTree(Algorithm); 91 106 } 92 107 … … 110 125 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 111 126 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 112 AlgorithmParameter.ValueChanged += new EventHandler(BaseLevelAlgorithmParameter_ValueChanged); 127 AlgorithmTypeParameter.ValueChanged += new EventHandler(AlgorithmTypeParameter_ValueChanged); 128 ProblemTypeParameter.ValueChanged += new EventHandler(ProblemTypeParameter_ValueChanged); 113 129 } 130 114 131 private void InitializeOperators() { 115 132 Operators.AddRange(ApplicationManager.Manager.GetInstances<IParameterConfigurationOperator>().Cast<IOperator>()); … … 117 134 } 118 135 private void ParameterizeSolutionCreator() { 119 //SolutionCreator.ParametersToOptimize = this.ParametersToOptimize;120 121 136 } 122 137 private void ParameterizeEvaluator() { … … 124 139 } 125 140 private void ParameterizeAnalyzer() { 126 //BestQualityAnalyzer.ResultsParameter.ActualName = "Results";127 141 } 128 142 private void ParameterizeOperators() { … … 150 164 ParameterizeAnalyzer(); 151 165 } 152 void BaseLevelAlgorithmParameter_ValueChanged(object sender, EventArgs e) { 153 AlgorithmParameterConfiguration = new ParameterConfigurationTree(Algorithm); 154 155 //Algorithm.ProblemChanged += new EventHandler(BaseLevelAlgorithm_ProblemChanged); // when to deregister? 156 //BaseLevelAlgorithm_ProblemChanged(sender, e); 166 void AlgorithmTypeParameter_ValueChanged(object sender, EventArgs e) { 167 Algorithm.Problem = Problem; 168 ParameterConfigurationParameter.ActualValue = new ParameterConfigurationTree(Algorithm); 157 169 } 158 159 void BaseLevelAlgorithm_ProblemChanged(object sender, EventArgs e) { 160 //if (Algorithm != null && Algorithm.Problem != null) { 161 // AlgorithmParameterConfiguration = new ParameterConfigurationTree(Algorithm); 162 //} 170 void ProblemTypeParameter_ValueChanged(object sender, EventArgs e) { 171 Problems.Type = Problem.GetType(); 172 Algorithm.Problem = Problem; 173 ParameterConfigurationParameter.ActualValue = new ParameterConfigurationTree(Algorithm); 163 174 } 164 175 #endregion
Note: See TracChangeset
for help on using the changeset viewer.