Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5110


Ignore:
Timestamp:
12/15/10 15:43:43 (14 years ago)
Author:
cneumuel
Message:

#1215

  • optional parameter values now can be null
  • problem type can now be set specifically
  • values are constrained to the encoding of the Problem
  • moved repetitions parameter to MetaOptimizationProblem
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  
    116116      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Data.Views-3.3.dll</HintPath>
    117117    </Reference>
    118     <Reference Include="HeuristicLab.DebugEngine-3.3">
    119       <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.DebugEngine-3.3.dll</HintPath>
    120     </Reference>
    121118    <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3">
    122119      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
     
    320317      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\WeifenLuo.WinFormsUI.Docking-2.3.1.dll</HintPath>
    321318    </Reference>
    322     <Reference Include="ZedGraph">
    323       <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\ZedGraph.dll</HintPath>
    324     </Reference>
    325319  </ItemGroup>
    326320  <ItemGroup>
     321    <Compile Include="PluginLoader.cs" />
    327322    <Compile Include="Program.cs" />
    328323    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/Program.cs

    r5087 r5110  
    1818using HeuristicLab.Selection;
    1919using HeuristicLab.Algorithms.EvolutionStrategy;
     20using HeuristicLab.PluginInfrastructure.Manager;
    2021
    2122namespace HeuristicLab.MetaOptimization.Test {
    2223  class Program {
    23     private static int metaAlgorithmPopulationSize = 50;
     24    private static int metaAlgorithmPopulationSize = 3;
    2425    private static int metaAlgorithmMaxGenerations = 30;
    2526    private static int metaProblemRepetitions = 3;
    2627
    27     private static int baseAlgorithmMaxGenerations = 250;
     28    private static int baseAlgorithmMaxGenerations = 3;
    2829
    2930    static void Main(string[] args) {
     
    3233      //TestIntSampling();
    3334      //TestDoubleSampling();
    34 
     35      //TestTypeDiscovery();
     36     
    3537      GeneticAlgorithm baseLevelAlgorithm = new GeneticAlgorithm();
    3638
    3739      MetaOptimizationProblem metaOptimizationProblem = new MetaOptimizationProblem();
    38       ((MetaOptimizationEvaluator)metaOptimizationProblem.Evaluator).Repetitions.Value = metaProblemRepetitions;
     40      metaOptimizationProblem.Repetitions = new IntValue(metaProblemRepetitions);
    3941      GeneticAlgorithm metaLevelAlgorithm = GetMetaGA(metaOptimizationProblem);
    4042      //EvolutionStrategy metaLevelAlgorithm = GetMetaES(metaOptimizationProblem);
     
    5355
    5456      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      }
    5567    }
    5668
     
    200212
    201213      // 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();
    203215      if (multiMutator != null) {
    204216        mutationOperator.ValueConfigurations.SetItemCheckedState(multiMutator, false);
     
    272284      string outputPath = Path.Combine(path, string.Format("{0} - Console.txt", id));
    273285
    274 
    275286      using (var sw = new StreamWriter(outputPath)) {
    276287        sw.AutoFlush = true;
     
    301312                var orderedRuns = rc.OrderBy(x => x.Results["RunsAverageQuality"]);
    302313
    303                 sb.AppendLine("Qual.  PoSi MutRa Eli GrSi MutOp");
     314                sb.AppendLine("Qual.  PoSi MutRa Eli SelOp MutOp");
    304315                foreach (IRun run in orderedRuns) {
    305316                  string selector;
     
    316327                    ((IntValue)run.Parameters["Elites"]).Value.ToString().PadLeft(3, ' '),
    317328                    Shorten(selector, 20).PadRight(20, ' '),
    318                     run.Parameters["Mutator"].ToString()));
     329                    run.Parameters.ContainsKey("Mutator") ? run.Parameters["Mutator"].ToString() : "null"));
    319330                }
    320331              }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.sln

    r5023 r5110  
    1515    TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
    1616  EndProjectSection
    17 EndProject
    18 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.MetaOptimization.Tests", "HeuristicLab.MetaOptimization.Tests\HeuristicLab.MetaOptimization.Tests.csproj", "{7978A3C0-5166-4392-B00F-58AA3C31E107}"
    1917EndProject
    2018Global
     
    3533    {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
    3634    {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
    3837    {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Release|Any CPU.ActiveCfg = Release|Any CPU
    3938    {ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}.Release|Any CPU.Build.0 = Release|Any CPU
     
    4544    {59567338-A551-4386-8405-A8C0DF3E376D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
    4645    {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
    4848    {59567338-A551-4386-8405-A8C0DF3E376D}.Release|Any CPU.ActiveCfg = Release|Any CPU
    4949    {59567338-A551-4386-8405-A8C0DF3E376D}.Release|Any CPU.Build.0 = Release|Any CPU
     
    6262    {0E232F46-FD0B-4FEA-8C22-AF18DE0D151E}.Release|x86.ActiveCfg = Release|x86
    6363    {0E232F46-FD0B-4FEA-8C22-AF18DE0D151E}.Release|x86.Build.0 = Release|x86
    64     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    65     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|Any CPU.Build.0 = Debug|Any CPU
    66     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
    67     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
    68     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Debug|x86.ActiveCfg = Debug|Any CPU
    69     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|Any CPU.ActiveCfg = Release|Any CPU
    70     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|Any CPU.Build.0 = Release|Any CPU
    71     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
    72     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|Mixed Platforms.Build.0 = Release|Any CPU
    73     {7978A3C0-5166-4392-B00F-58AA3C31E107}.Release|x86.ActiveCfg = Release|Any CPU
    7464  EndGlobalSection
    7565  GlobalSection(SolutionProperties) = preSolution
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/HeuristicLab.Problems.MetaOptimization.Views-3.3.csproj

    r5023 r5110  
    3838    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
    3939  </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>
    4073  <ItemGroup>
    4174    <Reference Include="HeuristicLab.Collections-3.3">
     
    86119  <ItemGroup>
    87120    <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>
    88127    <Compile Include="OptimizableView.cs">
    89128      <SubType>UserControl</SubType>
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ObjectSelectorDialog.Designer.cs

    r4516 r5110  
    4646      this.itemsListView.MultiSelect = false;
    4747      this.itemsListView.Name = "itemsListView";
    48       this.itemsListView.Size = new System.Drawing.Size(765, 452);
     48      this.itemsListView.Size = new System.Drawing.Size(387, 501);
    4949      this.itemsListView.TabIndex = 2;
    5050      this.itemsListView.UseCompatibleStateImageBehavior = false;
     
    7272      this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    7373      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);
    7575      this.cancelButton.Name = "cancelButton";
    7676      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    8484      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    8585      this.okButton.Enabled = false;
    86       this.okButton.Location = new System.Drawing.Point(621, 470);
     86      this.okButton.Location = new System.Drawing.Point(243, 519);
    8787      this.okButton.Name = "okButton";
    8888      this.okButton.Size = new System.Drawing.Size(75, 23);
     
    9898      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    9999      this.CancelButton = this.cancelButton;
    100       this.ClientSize = new System.Drawing.Size(789, 505);
     100      this.ClientSize = new System.Drawing.Size(411, 554);
    101101      this.Controls.Add(this.cancelButton);
    102102      this.Controls.Add(this.okButton);
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ObjectSelectorDialog.cs

    r4830 r5110  
    11using System;
    22using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Data;
    5 using System.Drawing;
    63using System.Linq;
    7 using System.Text;
    84using System.Windows.Forms;
    95using HeuristicLab.Core;
    106
    117namespace HeuristicLab.Problems.MetaOptimization.Views {
    12   public partial class ObjectSelectorDialog<T> : Form where T : INamedItem {
     8  public partial class ObjectSelectorDialog<T> : Form where T : IItem {
    139    private bool initialized;
    1410    private List<IItem> items;
    15     private IEnumerable<IGrouping<Type, T>> selectableItems;
     11    private IEnumerable<IGrouping<string, T>> selectableItems;
    1612
    1713    private T item;
     
    2016    }
    2117
    22     public ObjectSelectorDialog(IEnumerable<IGrouping<Type, T>> selectableItems) {
     18    public ObjectSelectorDialog(IEnumerable<IGrouping<string, T>> selectableItems) {
    2319      this.initialized = false;
    2420      this.items = new List<IItem>();
     
    3127      if (!initialized) {
    3228        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);
    3632          itemsListView.Groups.Add(group);
    3733          foreach (T i in item) {
    3834            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);
    4043            itemsListView.SmallImageList.Images.Add(i.ItemImage);
    4144            value.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueConfigurationCheckedItemList.cs

    r5087 r5110  
    7070
    7171    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) {
    8074        try {
    81           IItem value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
     75          IItem value = objectSelectorDialog.Item;
    8276          return new ValueConfiguration(value, value.GetType());
    8377        }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueView.cs

    r4981 r5110  
    3434        valueViewHost.Content = null;
    3535      }
     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      }
    3645    }
    3746
    3847    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) {
    4451        try {
    45           Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
     52          Content.Value = objectSelectorDialog.Item;
    4653          valueViewHost.Content = Content.Value;
    4754        }
     
    5057        }
    5158      }
     59      SetEnabledStateOfControls();
    5260    }
    5361
     
    5563      Content.Value = null;
    5664      valueViewHost.Content = null;
     65      SetEnabledStateOfControls();
    5766    }
    5867  }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ParameterConfigurations/ParameterConfiguration.cs

    r5087 r5110  
    11using System;
     2using System.Collections;
    23using System.Collections.Generic;
    34using System.Linq;
    45using HeuristicLab.Common;
    56using HeuristicLab.Core;
     7using HeuristicLab.Data;
     8using HeuristicLab.Parameters;
    69using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    710using HeuristicLab.PluginInfrastructure;
    8 using HeuristicLab.Parameters;
    9 using HeuristicLab.Data;
    10 using System.Collections;
    1111
    1212namespace HeuristicLab.Problems.MetaOptimization {
     
    9494    public ConstrainedValue ActualValue {
    9595      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    }
    102115
    103116    #region Constructors and Cloning
     
    105118      this.ParameterName = parameterName;
    106119      this.parameterDataType = valueParameter.GetType();
    107       //this.parameter = valueParameter;
    108120      this.valueDataType = valueParameter.DataType;
    109121      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);
    112128      if (Optimize) {
    113129        PopulateValueConfigurations();
     
    121137      this.parameterName = original.ParameterName;
    122138      this.parameterDataType = original.parameterDataType;
    123       //this.parameter = cloner.Clone(original.parameter);
    124139      this.valueDataType = original.ValueDataType;
    125140      this.validValues = cloner.Clone(original.ValidValues);
     
    128143      this.optimize = original.optimize;
    129144      this.actualValueConfigurationIndex = original.actualValueConfigurationIndex;
     145      this.isNullable = original.isNullable;
    130146      if (this.valueConfigurations != null) RegisterValueConfigurationEvents();
    131147    }
     
    151167    }
    152168
     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
    153176    private void PopulateValueConfigurations() {
    154177      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());
    158180        } 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        }
    162189      }
    163190    }
     
    223250
    224251    #region Events
     252    void ActualValue_ToStringChanged(object sender, EventArgs e) {
     253      OnToStringChanged();
     254    }
     255    #endregion
     256
     257    #region Event Handler
    225258    public virtual event EventHandler NameChanged;
    226259    protected virtual void OnNameChanged(object sender, EventArgs e) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/RangeConstraints/ConstrainedValue.cs

    r5009 r5110  
    3232    }
    3333
     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
    3456    private void RegisterEvents() {
    3557      this.value.ToStringChanged += new EventHandler(value_ToStringChanged);
     
    4365    [StorableConstructor]
    4466    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) {
    4668      this.Value = value;
    4769      this.ValueDataType = valueDataType;
     70      this.ValidValues = validValues;
     71      this.isNullable = isNullable;
    4872    }
    4973    protected ConstrainedValue(ConstrainedValue original, Cloner cloner) : base(original, cloner) {
    5074      this.valueDataType = original.valueDataType;
    5175      this.Value = cloner.Clone(original.value);
     76      this.ValidValues = cloner.Clone(original.ValidValues);
     77      this.isNullable = original.isNullable;
    5278    }
    5379    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ValueConfigurations/CheckedValueConfigurationCollection.cs

    r5009 r5110  
    1919
    2020    [Storable]
    21     protected Type valueDataType;
    22     public Type ValueDataType {
    23       get { return valueDataType; }
     21    protected IItemSet<IItem> validValues;
     22    public IItemSet<IItem> ValidValues {
     23      get { return validValues; }
    2424    }
    2525
    26     public CheckedValueConfigurationCollection(Type valueDataType) {
    27       this.valueDataType = valueDataType;
     26    public CheckedValueConfigurationCollection(IItemSet<IItem> validValues) {
     27      this.validValues = validValues;
    2828      RegisterEvents();
    2929    }
     
    3737    protected CheckedValueConfigurationCollection(CheckedValueConfigurationCollection original, Cloner cloner) : base(original, cloner) {
    3838      this.minItemCount = original.MinItemCount;
    39       this.valueDataType = original.valueDataType;
     39      this.validValues = original.validValues;
    4040      RegisterEvents();
    4141    }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ValueConfigurations/ValueConfiguration.cs

    r5087 r5110  
    88using HeuristicLab.Encodings.RealVectorEncoding;
    99using HeuristicLab.Encodings.IntegerVectorEncoding;
     10using HeuristicLab.PluginInfrastructure;
    1011
    1112namespace HeuristicLab.Problems.MetaOptimization {
     
    5758      set {
    5859        if (this.actualValue != value) {
     60          RegisterActualValueEvents();
    5961          ClearParameterConfigurations();
    6062          this.actualValue = value;
     
    6264          OnValueChanged();
    6365          OnToStringChanged();
     66          DeregisterActualValueEvents();
    6467        }
    6568      }
     
    7073    public IRange RangeConstraint {
    7174      get { return rangeConstraint; }
     75      private set {
     76        if (rangeConstraint != value) {
     77          DeregisterRangeConstraintEvents();
     78          rangeConstraint = value;
     79          RegisterActualValueEvents();
     80        }
     81      }
    7282    }
    7383
     
    7585    public ValueConfiguration(IItem value, Type valueDataType) {
    7686      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);
    7889      this.IsOptimizable = true;
    7990      if (actualValue.ValueDataType == typeof(IntValue)) {
     
    8899        rangeConstraint = null;
    89100      }
    90       RegisterEvents();
     101      RegisterRangeConstraintEvents();
    91102    }
    92103
     
    101112      this.isOptimizable = original.isOptimizable;
    102113      this.optimize = original.optimize;
    103       RegisterEvents();
     114      RegisterActualValueEvents();
     115      RegisterRangeConstraintEvents();
    104116    }
    105117    public override IDeepCloneable Clone(Cloner cloner) {
     
    108120    [StorableHook(HookType.AfterDeserialization)]
    109121    private void AfterDeserialization() {
    110       RegisterEvents();
     122      RegisterRangeConstraintEvents();
    111123    }
    112124    #endregion
     
    122134    }
    123135
    124     private void RegisterEvents() {
     136    private void RegisterRangeConstraintEvents() {
    125137      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) {
    134151      OnToStringChanged();
    135152    }
     
    137154      OnToStringChanged();
    138155    }
    139 
     156    #endregion
     157   
    140158    #region IItem Members
    141159    public override string ItemDescription {
     
    151169    }
    152170    #endregion
    153 
     171   
    154172    #region Event Handlers
    155173    public virtual event EventHandler ValueChanged;
     
    239257            //this.actualValue.Value = new DoubleValue((((DoubleValue)this.actualValue.Value).Value + ((DoubleValue)other.ActualValue.Value).Value) / 2);
    240258            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 });
    243261
    244262            if (random.NextDouble() < 0.5) {
     
    248266            }
    249267            //this.actualValue.Value = new DoubleValue(AverageCrossover.Apply(random, new ItemArray<RealVector>(parents)).First());
    250            
     268
    251269          } else if (this.actualValue.ValueDataType == typeof(PercentValue)) {
    252270            //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  
    1818  [StorableClass]
    1919  public class MetaOptimizationEvaluator : SingleSuccessorOperator, IMetaOptimizationEvaluator {
    20     private const string RepetitionsParameterName = "Repetitions";
    21 
    2220    private bool algorithmStopped;
    2321
     
    2624    }
    2725    public ILookupParameter<EngineAlgorithm> AlgorithmParameter {
    28       get { return (ILookupParameter<EngineAlgorithm>)Parameters["Algorithm"]; }
     26      get { return (ILookupParameter<EngineAlgorithm>)Parameters[MetaOptimizationProblem.AlgorithmTypeParameterName]; }
    2927    }
    3028    public ILookupParameter<IItemList<ISingleObjectiveProblem>> ProblemsParameter {
    31       get { return (ILookupParameter<IItemList<ISingleObjectiveProblem>>)Parameters["Problems"]; }
     29      get { return (ILookupParameter<IItemList<ISingleObjectiveProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; }
    3230    }
    3331    public ILookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter {
    3432      get { return (ILookupParameter<ParameterConfigurationTree>)Parameters["ParameterConfigurationTree"]; }
    3533    }
    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]; }
    3836    }
    3937
    4038    public IntValue Repetitions {
    41       get { return RepetitionsParameter.Value; }
    42       set { RepetitionsParameter.Value = value; }
     39      get { return RepetitionsParameter.ActualValue; }
    4340    }
    4441
     
    4643      : base() {
    4744      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."));
    5047      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."));
    5249    }
    5350
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj

    r5087 r5110  
    3838    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
    3939  </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>
    4073  <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>
    4177    <Reference Include="HeuristicLab.Collections-3.3">
    4278      <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
     
    78114      <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    79115    </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>
    80119    <Reference Include="HeuristicLab.SequentialEngine-3.3">
    81120      <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.SequentialEngine-3.3.dll</HintPath>
     
    94133    <None Include="Properties\AssemblyInfo.cs.frame" />
    95134    <None Include="HeuristicLabProblemsMetaOptimizationPlugin.cs.frame" />
     135    <Compile Include="ConstrainedItemList.cs" />
     136    <Compile Include="Encodings\NullValue.cs" />
     137    <Compile Include="Encodings\ValueConfigurations\NullValueConfiguration.cs" />
    96138    <Compile Include="Encodings\RangeConstraints\ConstrainedValue.cs">
    97139      <SubType>Code</SubType>
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/ICheckedValueConfigurationCollection.cs

    r4982 r5110  
    88  public interface ICheckedValueConfigurationCollection : ICheckedItemCollection<IValueConfiguration> {
    99    int MinItemCount { get; }
    10     Type ValueDataType { get; }
     10    IItemSet<IItem> ValidValues { get; }
    1111  }
    1212}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/MetaOptimizationProblem.cs

    r5087 r5110  
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3030using HeuristicLab.PluginInfrastructure;
     31using HeuristicLab.Algorithms.GeneticAlgorithm;
     32using HeuristicLab.Problems.TestFunctions;
    3133
    3234namespace HeuristicLab.Problems.MetaOptimization {
     
    3537  [StorableClass]
    3638  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";
    4144
    4245    #region Parameter Properties
    43     public IValueParameter<EngineAlgorithm> AlgorithmParameter {
    44       get { return (ValueParameter<EngineAlgorithm>)Parameters[AlgorithmParameterName]; }
     46    public IValueParameter<EngineAlgorithm> AlgorithmTypeParameter {
     47      get { return (ValueParameter<EngineAlgorithm>)Parameters[AlgorithmTypeParameterName]; }
    4548    }
    46     public IValueParameter<IItemList<ISingleObjectiveProblem>> ProblemsParameter {
    47       get { return (ValueParameter<IItemList<ISingleObjectiveProblem>>)Parameters[ProblemsParameterName]; }
     49    public IValueParameter<ISingleObjectiveProblem> ProblemTypeParameter {
     50      get { return (ValueParameter<ISingleObjectiveProblem>)Parameters[ProblemTypeParameterName]; }
    4851    }
    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]; }
    5154    }
    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    }
    5561    #endregion
    5662
    5763    #region Properties
    5864    public EngineAlgorithm Algorithm {
    59       get { return AlgorithmParameter.Value; }
    60       set { AlgorithmParameter.Value = value; }
     65      get { return AlgorithmTypeParameter.Value; }
     66      set { AlgorithmTypeParameter.Value = value; }
    6167    }
    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 {
    6373      get { return ProblemsParameter.Value; }
    6474      set { ProblemsParameter.Value = value; }
    6575    }
    6676    public ParameterConfigurationTree AlgorithmParameterConfiguration {
    67       get { return AlgorithmParameterConfigurationParameter.Value; }
    68       set { AlgorithmParameterConfigurationParameter.Value = value; }
     77      get { return ParameterConfigurationParameter.Value; }
     78      set { ParameterConfigurationParameter.Value = value; }
    6979    }
    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    }
    7484    #endregion
    7585
    7686    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
    8293      Maximization = new BoolValue(false);
    8394      SolutionCreator = new RandomParameterConfigurationCreator();
     
    89100      ParameterizeEvaluator();
    90101      ParameterizeOperators();
     102
     103      Problems.Type = Problem.GetType();
     104      Algorithm.Problem = Problem;
     105      ParameterConfigurationParameter.ActualValue = new ParameterConfigurationTree(Algorithm);
    91106    }
    92107
     
    110125      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
    111126      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);
    113129    }
     130   
    114131    private void InitializeOperators() {
    115132      Operators.AddRange(ApplicationManager.Manager.GetInstances<IParameterConfigurationOperator>().Cast<IOperator>());
     
    117134    }
    118135    private void ParameterizeSolutionCreator() {
    119       //SolutionCreator.ParametersToOptimize = this.ParametersToOptimize;
    120      
    121136    }
    122137    private void ParameterizeEvaluator() {
     
    124139    }
    125140    private void ParameterizeAnalyzer() {
    126       //BestQualityAnalyzer.ResultsParameter.ActualName = "Results";
    127141    }
    128142    private void ParameterizeOperators() {
     
    150164      ParameterizeAnalyzer();
    151165    }
    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);
    157169    }
    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);
    163174    }
    164175    #endregion
Note: See TracChangeset for help on using the changeset viewer.