Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4981


Ignore:
Timestamp:
11/28/10 21:42:49 (13 years ago)
Author:
cneumuel
Message:

#1215 worked on metaoptimization

Location:
branches/HeuristicLab.MetaOptimization
Files:
9 added
11 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.sln

    r4839 r4981  
    22Microsoft Visual Studio Solution File, Format Version 11.00
    33# Visual Studio 2010
    4 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9E843318-7235-4B2B-81A7-160FDDADD9E1}"
    5 EndProject
    64Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.MetaOptimization-3.3", "HeuristicLab.Problems.MetaOptimization\3.3\HeuristicLab.Problems.MetaOptimization-3.3.csproj", "{ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}"
    75EndProject
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/HeuristicLab.Problems.MetaOptimization.Views-3.3.csproj

    r4839 r4981  
    8585  </ItemGroup>
    8686  <ItemGroup>
     87    <Compile Include="OptimizableView.cs">
     88      <SubType>UserControl</SubType>
     89    </Compile>
     90    <Compile Include="OptimizableView.Designer.cs">
     91      <DependentUpon>OptimizableView.cs</DependentUpon>
     92    </Compile>
    8793    <Compile Include="ValueConfigurationViews\ValueConfigurationCheckedItemList.cs">
    8894      <SubType>UserControl</SubType>
     
    103109      <DependentUpon>ObjectSelectorDialog.cs</DependentUpon>
    104110    </Compile>
    105     <Compile Include="ParameterConfigurationViews\ParameterConfigurationListView.cs">
    106       <SubType>UserControl</SubType>
    107     </Compile>
    108     <Compile Include="ParameterConfigurationViews\ParameterConfigurationListView.Designer.cs">
    109       <DependentUpon>ParameterConfigurationListView.cs</DependentUpon>
    110     </Compile>
    111111    <Compile Include="HeuristicLabProblemsMetaOptimizationViewsPlugin.cs" />
    112     <Compile Include="ParameterConfigurationViews\ParameterConfigurationView.cs">
    113       <SubType>UserControl</SubType>
    114     </Compile>
    115     <Compile Include="ParameterConfigurationViews\ParameterConfigurationView.Designer.cs">
    116       <DependentUpon>ParameterConfigurationView.cs</DependentUpon>
    117     </Compile>
    118112    <Compile Include="Properties\AssemblyInfo.cs" />
    119     <Compile Include="ValueConfigurationViews\ValueConfigurationView.cs">
    120       <SubType>UserControl</SubType>
    121     </Compile>
    122     <Compile Include="ValueConfigurationViews\ValueConfigurationView.Designer.cs">
    123       <DependentUpon>ValueConfigurationView.cs</DependentUpon>
    124     </Compile>
    125113    <Compile Include="ValueConfigurationViews\ValueView.cs">
    126114      <SubType>UserControl</SubType>
     
    135123  </ItemGroup>
    136124  <ItemGroup>
    137     <ProjectReference Include="..\..\HeuristicLab.Problems.MetaOptimization\3.3\HeuristicLab.Problems.MetaOptimization-3.3.csproj">
    138       <Project>{ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}</Project>
    139       <Name>HeuristicLab.Problems.MetaOptimization-3.3</Name>
    140     </ProjectReference>
    141   </ItemGroup>
    142   <ItemGroup>
     125    <EmbeddedResource Include="OptimizableView.resx">
     126      <DependentUpon>OptimizableView.cs</DependentUpon>
     127    </EmbeddedResource>
    143128    <EmbeddedResource Include="ValueConfigurationViews\NumericRangeView.resx">
    144129      <DependentUpon>NumericRangeView.cs</DependentUpon>
     
    147132      <DependentUpon>ObjectSelectorDialog.cs</DependentUpon>
    148133    </EmbeddedResource>
    149     <EmbeddedResource Include="ParameterConfigurationViews\ParameterConfigurationListView.resx">
    150       <DependentUpon>ParameterConfigurationListView.cs</DependentUpon>
    151     </EmbeddedResource>
    152     <EmbeddedResource Include="ParameterConfigurationViews\ParameterConfigurationView.resx">
    153       <DependentUpon>ParameterConfigurationView.cs</DependentUpon>
    154     </EmbeddedResource>
    155     <EmbeddedResource Include="ValueConfigurationViews\ValueConfigurationView.resx">
    156       <DependentUpon>ValueConfigurationView.cs</DependentUpon>
    157     </EmbeddedResource>
    158134    <EmbeddedResource Include="ValueConfigurationViews\ValueView.resx">
    159135      <DependentUpon>ValueView.cs</DependentUpon>
    160136    </EmbeddedResource>
     137  </ItemGroup>
     138  <ItemGroup>
     139    <Folder Include="ParameterConfigurationViews\" />
     140  </ItemGroup>
     141  <ItemGroup>
     142    <ProjectReference Include="..\..\HeuristicLab.Problems.MetaOptimization\3.3\HeuristicLab.Problems.MetaOptimization-3.3.csproj">
     143      <Project>{ABBC1DF6-FCC6-4F86-AB75-B6B3A72E7D17}</Project>
     144      <Name>HeuristicLab.Problems.MetaOptimization-3.3</Name>
     145    </ProjectReference>
    161146  </ItemGroup>
    162147  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/NumericRangeView.cs

    r4839 r4981  
    1616  /// The visual representation of a <see cref="IIntegerRange"/>.
    1717  /// </summary>
    18   [View("NumericRange View")]
    19   [Content(typeof(IRange<IntValue>), true)]
     18  [View("IntValueRange View")]
     19  [Content(typeof(IRange<IntValue>), false)]
    2020  public partial class IntValueRangeView : ItemView {
    2121    /// <summary>
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueConfigurationCheckedItemList.Designer.cs

    r4839 r4981  
    11namespace HeuristicLab.Problems.MetaOptimization.Views {
    2   partial class ValueConfigurationCheckedItemList {
     2  partial class ValueConfigurationCheckedItemCollectionView {
    33    /// <summary>
    44    /// Required designer variable.
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueConfigurationCheckedItemList.cs

    r4839 r4981  
    99using HeuristicLab.MainForm;
    1010using HeuristicLab.Core;
     11using System.Windows.Forms;
     12using HeuristicLab.PluginInfrastructure;
    1113
    1214namespace HeuristicLab.Problems.MetaOptimization.Views {
    1315  [View("ValueConfigurationList View")]
    14   [Content(typeof(CheckedItemList<IValueConfiguration>), true)]
    15   [Content(typeof(ICheckedItemList<IValueConfiguration>), true)]
    16   public partial class ValueConfigurationCheckedItemList : CheckedItemListView<IValueConfiguration> {
    17     public ValueConfigurationCheckedItemList() {
     16  [Content(typeof(ICheckedValueConfigurationCollection), IsDefaultView = true)]
     17  public sealed partial class ValueConfigurationCheckedItemCollectionView : CheckedItemCollectionView<IValueConfiguration> {
     18    public new ICheckedValueConfigurationCollection Content {
     19      get { return (ICheckedValueConfigurationCollection)base.Content; }
     20      set { base.Content = value; }
     21    }
     22
     23    public ValueConfigurationCheckedItemCollectionView() {
    1824      InitializeComponent();
     25    }
     26
     27    protected override void DeregisterContentEvents() {
     28      // TODO: Deregister your event handlers here
     29      base.DeregisterContentEvents();
     30    }
     31
     32    protected override void RegisterContentEvents() {
     33      base.RegisterContentEvents();
     34      // TODO: Register your event handlers here
     35    }
     36
     37    #region Event Handlers (Content)
     38    // TODO: Put event handlers of the content here
     39    #endregion
     40
     41    protected override void OnContentChanged() {
     42      base.OnContentChanged();
     43      if (Content == null) {
     44        // TODO: Add code when content has been changed and is null
     45      } else {
     46        // TODO: Add code when content has been changed and is not null
     47      }
     48    }
     49
     50
     51    protected override void SetEnabledStateOfControls() {
     52      base.SetEnabledStateOfControls();
     53      // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
     54    }
     55
     56    #region Event Handlers (child controls)
     57    // TODO: Put event handlers of child controls here.
     58    #endregion
     59
     60    protected override IValueConfiguration CreateItem() {
     61      if (typeSelectorDialog == null) {
     62        typeSelectorDialog = new TypeSelectorDialog();
     63        typeSelectorDialog.Caption = "Select Item";
     64        typeSelectorDialog.TypeSelector.Caption = "Available Items";
     65        typeSelectorDialog.TypeSelector.Configure(Content.ValueDataType, false, true);
     66      }
     67
     68      if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
     69        try {
     70          IItem value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
     71          return new ValueConfiguration(value, value.GetType());
     72        }
     73        catch (Exception ex) {
     74          ErrorHandling.ShowErrorDialog(this, ex);
     75        }
     76      }
     77      return null;
    1978    }
    2079  }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueView.cs

    r4839 r4981  
    1515namespace HeuristicLab.Problems.MetaOptimization.Views {
    1616  [View("Value View")]
    17   [Content(typeof(IValueConfiguration), false)]
     17  [Content(typeof(ConstrainedValue), true)]
    1818  public partial class ValueView : ItemView {
    1919
    20     public new IValueConfiguration Content {
    21       get { return (IValueConfiguration)base.Content; }
     20    public new ConstrainedValue Content {
     21      get { return (ConstrainedValue)base.Content; }
    2222      set { base.Content = value; }
    2323    }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ParameterConfigurations/ParameterConfiguration.cs

    r4839 r4981  
    1414
    1515    [Storable]
    16     protected bool optimizationEnabled;
    17     public bool OptimizationEnabled {
    18       get { return optimizationEnabled; }
     16    protected bool optimize;
     17    public bool Optimize {
     18      get { return optimize; }
    1919      set {
    20         if (optimizationEnabled != value) {
    21           optimizationEnabled = value;
    22           if (optimizationEnabled) {
     20        if (optimize != value) {
     21          optimize = value;
     22          if (optimize) {
    2323            PopulateValueConfigurations();
    2424          } else {
    2525            this.ValueConfigurations.Clear();
    2626          }
    27           OnOptimizationEnabledChanged();
     27          OnOptimizeChanged();
    2828        }
    2929      }
     
    6262    }
    6363
    64     protected ICheckedItemList<IValueConfiguration> valueConfigurations;
    65     public ICheckedItemList<IValueConfiguration> ValueConfigurations {
     64    protected ICheckedValueConfigurationCollection valueConfigurations;
     65    public ICheckedValueConfigurationCollection ValueConfigurations {
    6666      get { return this.valueConfigurations; }
    6767      protected set { this.valueConfigurations = value; }
     
    7575    }
    7676
     77    public ConstrainedValue ConstrainedValue {
     78      get { return actualValueConfiguration.ConstrainedValue; }
     79      set { actualValueConfiguration.ConstrainedValue = value; }
     80    }
     81   
    7782    // store parameter reference only for name/description/image/...
    7883    private IValueParameter parameter;
    7984
     85    #region Constructors and Cloning
    8086    public ParameterConfiguration(string parameterName, IValueParameter valueParameter) {
    8187      this.ParameterName = parameterName;
     
    8490      this.valueDataType = valueParameter.DataType;
    8591      this.validValues = GetValidValues();
    86       this.ValueConfigurations = new CheckedItemList<IValueConfiguration>();
     92      this.ValueConfigurations = new CheckedValueConfigurationCollection(this.valueDataType);
    8793      this.ActualValueConfiguration = new ValueConfiguration(valueParameter.Value, valueParameter.DataType);
    88       if (OptimizationEnabled) {
     94      if (Optimize) {
    8995        PopulateValueConfigurations();
    9096      }
     
    94100    [StorableConstructor]
    95101    protected ParameterConfiguration(bool deserializing) { }
    96     protected ParameterConfiguration(ParameterConfiguration original, Cloner cloner) : base(original, cloner) {
     102    protected ParameterConfiguration(ParameterConfiguration original, Cloner cloner)
     103      : base(original, cloner) {
    97104      this.ParameterName = original.ParameterName;
    98105      this.parameterDataType = original.parameterDataType;
     
    102109      this.ValueConfigurations = cloner.Clone(original.ValueConfigurations);
    103110      this.ActualValueConfiguration = cloner.Clone(original.ActualValueConfiguration);
    104       this.OptimizationEnabled = original.optimizationEnabled;
     111      this.Optimize = original.optimize;
    105112    }
    106113    public override IDeepCloneable Clone(Cloner cloner) {
    107114      return new ParameterConfiguration(this, cloner);
    108115    }
     116    #endregion
    109117
    110118    private void PopulateValueConfigurations() {
     
    118126    }
    119127
    120     void ValidValues_CheckedItemsChanged(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<IItem>> e) {
    121       var oldItems = e.OldItems.Select(x => x.Value);
    122       var newItems = e.Items.Select(x => x.Value);
    123       var intersection = oldItems.Intersect(newItems);
    124       var removedItems = oldItems.Where(x => !intersection.Contains(x));
    125       var addedItems = newItems.Where(x => !intersection.Contains(x));
    126 
    127       foreach (var item in removedItems) {
    128         RemoveValueConfiguration(item);
    129       }
    130       foreach (var item in addedItems) {
    131         this.ValueConfigurations.Add(new ValueConfiguration(item, item.GetType()));
    132       }
    133     }
    134 
    135     private void RemoveValueConfiguration(IItem item) {
    136       IValueConfiguration vc = this.ValueConfigurations.Single(x => x.ValueDataType == item.GetType());
    137       this.ValueConfigurations.Remove(vc);
    138     }
     128    //void ValidValues_CheckedItemsChanged(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<IItem>> e) {
     129    //  var oldItems = e.OldItems.Select(x => x.Value);
     130    //  var newItems = e.Items.Select(x => x.Value);
     131    //  var intersection = oldItems.Intersect(newItems);
     132    //  var removedItems = oldItems.Where(x => !intersection.Contains(x));
     133    //  var addedItems = newItems.Where(x => !intersection.Contains(x));
     134
     135    //  foreach (var item in removedItems) {
     136    //    RemoveValueConfiguration(item);
     137    //  }
     138    //  foreach (var item in addedItems) {
     139    //    this.ValueConfigurations.Add(new ValueConfiguration(item, item.GetType()));
     140    //  }
     141    //}
     142
     143    //private void RemoveValueConfiguration(IItem item) {
     144    //  IValueConfiguration vc = this.ValueConfigurations.Single(x => x.ValueDataType == item.GetType());
     145    //  this.ValueConfigurations.Remove(vc);
     146    //}
    139147
    140148    #region INamedItem Properties
     
    198206    }
    199207
    200     public virtual event EventHandler OptimizationEnabledChanged;
    201     protected virtual void OnOptimizationEnabledChanged() {
    202       var handler = OptimizationEnabledChanged;
     208    public virtual event EventHandler OptimizeChanged;
     209    protected virtual void OnOptimizeChanged() {
     210      var handler = OptimizeChanged;
    203211      if (handler != null) handler(this, EventArgs.Empty);
    204212    }
     
    206214
    207215    public override string ToString() {
    208       return string.Format("{0}", ParameterName);
     216      return string.Format("{0}: {1}", ParameterName, ConstrainedValue.Value);
    209217    }
    210218
     
    217225      return null;
    218226    }
    219 
    220227  }
    221228}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ValueConfigurations/ValueConfiguration.cs

    r4839 r4981  
    11using System;
     2using System.Linq;
    23using HeuristicLab.Common;
    34using HeuristicLab.Core;
    45using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     6using HeuristicLab.Data;
     7using System.Drawing;
    58
    69namespace HeuristicLab.Problems.MetaOptimization {
    7   [StorableClass]
    8   public class ValueConfiguration : DeepCloneable, IValueConfiguration {
    9     [Storable]
    10     protected IItemList<IParameterConfiguration> parameterConfigurations = new ItemList<IParameterConfiguration>();
    11     public IItemList<IParameterConfiguration> ParameterConfigurations {
     10  // TODO: ItemName/Descr, storability
     11  public class ValueConfiguration : Item, IValueConfiguration {
     12    protected bool optimize;
     13    public bool Optimize {
     14      get { return optimize; }
     15      set {
     16        if (optimize != value) {
     17          optimize = value;
     18          if (optimize) {
     19            ClearParameterConfigurations();
     20            PopulateParameterConfigurations();
     21          } else {
     22            ClearParameterConfigurations();
     23          }
     24          OnOptimizeChanged();
     25          OnToStringChanged();
     26        }
     27      }
     28    }
     29
     30    protected IItemCollection<IParameterConfiguration> parameterConfigurations = new ItemCollection<IParameterConfiguration>();
     31    public IItemCollection<IParameterConfiguration> ParameterConfigurations {
    1232      get { return this.parameterConfigurations; }
    1333      protected set { this.parameterConfigurations = value; }
    1434    }
    1535
    16     protected IItem value;
    17     public IItem Value {
    18       get { return value; }
     36    protected ConstrainedValue constrainedValue;
     37    public ConstrainedValue ConstrainedValue {
     38      get { return constrainedValue; }
    1939      set {
    20         if (this.value != value) {
    21           ClearChildParameterConfigurations();
    22           this.value = value;
    23           if (this.value is IParameterizedNamedItem) AddChildParameterConfigurations(this.value as IParameterizedNamedItem);
     40        if (this.constrainedValue != value) {
     41          ClearParameterConfigurations();
     42          this.constrainedValue = value;
     43          PopulateParameterConfigurations();
    2444          OnValueChanged();
     45          OnToStringChanged();
    2546        }
    2647      }
    2748    }
    2849
    29     protected Type valueDataType;
    30     public Type ValueDataType {
    31       get { return this.valueDataType; }
    32       protected set { this.valueDataType = value; }
     50    protected IRange rangeConstraint;
     51    public IRange RangeConstraint {
     52      get { return rangeConstraint; }
    3353    }
    34 
     54   
     55    #region Constructors and Cloning
    3556    public ValueConfiguration(IItem value, Type valueDataType) {
    36       this.Value = value;
    37       this.ValueDataType = valueDataType;
     57      this.parameterConfigurations = new ItemList<IParameterConfiguration>();
     58      this.ConstrainedValue = new ConstrainedValue(value, valueDataType);
     59      if (constrainedValue.ValueDataType == typeof(IntValue)) {
     60        rangeConstraint = new Range<IntValue>(new IntValue(0), (IntValue)value, new IntValue(1));
     61      } else if (constrainedValue.ValueDataType == typeof(DoubleValue)) {
     62        rangeConstraint = new Range<DoubleValue>(new DoubleValue(0), (DoubleValue)value, new DoubleValue(0.1));
     63      } else {
     64        rangeConstraint = null;
     65      }
     66      RegisterEvents();
    3867    }
    3968
     
    4372    protected ValueConfiguration(ValueConfiguration original, Cloner cloner) : base(original, cloner) {
    4473      this.ParameterConfigurations = cloner.Clone(original.ParameterConfigurations);
    45       this.Value = cloner.Clone(original.Value);
    46       this.ValueDataType = original.ValueDataType;
    47 
     74      this.ConstrainedValue = cloner.Clone(original.ConstrainedValue);
     75      this.rangeConstraint = cloner.Clone(original.RangeConstraint);
     76      RegisterEvents();
    4877    }
    4978    public override IDeepCloneable Clone(Cloner cloner) {
    5079      return new ValueConfiguration(this, cloner);
    5180    }
     81    #endregion
    5282
    53     protected virtual void AddChildParameterConfigurations(IParameterizedNamedItem parameterizedItem) {
    54       foreach (var childParameter in parameterizedItem.Parameters) {
    55         var pc = ParameterConfiguration.Create(parameterizedItem, childParameter);
    56         if (pc != null) this.ParameterConfigurations.Add(pc);
     83    protected virtual void PopulateParameterConfigurations() {
     84      if (this.constrainedValue.Value is IParameterizedNamedItem) {
     85        var parameterizedItem = this.constrainedValue.Value as IParameterizedNamedItem;
     86        foreach (var childParameter in parameterizedItem.Parameters) {
     87          var pc = ParameterConfiguration.Create(parameterizedItem, childParameter);
     88          if (pc != null) this.ParameterConfigurations.Add(pc);
     89        }
    5790      }
    5891    }
    59     protected virtual void ClearChildParameterConfigurations() {
     92    protected virtual void ClearParameterConfigurations() {
    6093      ParameterConfigurations.Clear();
    6194    }
    62    
    63     #region IItem Members
    64     public string ItemDescription {
    65       get { return value.ItemDescription; }
     95
     96    private void RegisterEvents() {
     97      if (this.RangeConstraint != null) this.RangeConstraint.ToStringChanged += new EventHandler(RangeConstraint_ToStringChanged);
     98      if (this.ConstrainedValue != null) this.ConstrainedValue.ToStringChanged += new EventHandler(ConstrainedValue_ToStringChanged);
     99    }
     100    private void DeregisterEvents() {
     101      if (this.RangeConstraint != null) this.RangeConstraint.ToStringChanged += new EventHandler(RangeConstraint_ToStringChanged);
     102      if (this.ConstrainedValue != null) this.ConstrainedValue.ToStringChanged += new EventHandler(ConstrainedValue_ToStringChanged);
    66103    }
    67104
    68     public System.Drawing.Image ItemImage {
    69       get { return value.ItemImage; }
     105    void ConstrainedValue_ToStringChanged(object sender, EventArgs e) {
     106      OnToStringChanged();
     107    }
     108    void RangeConstraint_ToStringChanged(object sender, EventArgs e) {
     109      OnToStringChanged();
    70110    }
    71111
    72     public string ItemName {
    73       get { return value.ItemDescription; }
     112    #region IItem Members
     113    public override string ItemDescription {
     114      get { return (constrainedValue != null && constrainedValue.Value != null) ? constrainedValue.Value.ItemDescription : base.ItemDescription; }
    74115    }
    75116
    76     public Version ItemVersion {
    77       get { return value.ItemVersion; }
     117    public override Image ItemImage {
     118      get { return (constrainedValue != null && constrainedValue.Value != null) ? constrainedValue.Value.ItemImage : base.ItemImage; }
     119    }
     120
     121    public override string ItemName {
     122      get { return (constrainedValue != null && constrainedValue.Value != null) ? constrainedValue.Value.ItemDescription : base.ItemName; }
    78123    }
    79124    #endregion
    80125
    81     #region Events
    82     public virtual event EventHandler ItemImageChanged;
    83     protected virtual void OnItemImageChanged(object sender, EventArgs e) {
    84       var handler = ItemImageChanged;
    85       if (handler != null) handler(sender, e);
    86     }
    87 
    88     public virtual event EventHandler ToStringChanged;
    89     protected virtual void OnStringChanged(object sender, EventArgs e) {
    90       var handler = ToStringChanged;
    91       if (handler != null) handler(this, e); // important to set 'this' as sender
    92     }
    93 
     126    #region Event Handlers
    94127    public virtual event EventHandler ValueChanged;
    95128    protected virtual void OnValueChanged() {
     
    97130      if (handler != null) handler(this, EventArgs.Empty);
    98131    }
     132
     133    public virtual event EventHandler OptimizeChanged;
     134    protected virtual void OnOptimizeChanged() {
     135      var handler = OptimizeChanged;
     136      if (handler != null) handler(this, EventArgs.Empty);
     137    }
    99138    #endregion
    100139
    101140    public override string ToString() {
    102       return value.ItemName;
     141      if (ConstrainedValue != null && ConstrainedValue.Value != null) {
     142        if(Optimize) {
     143          return string.Format("{0}: {1}", ConstrainedValue.Value.ItemName, RangeConstraint);
     144        } else {
     145          return string.Format("{0}: {1}", ConstrainedValue.Value.ItemName, ConstrainedValue.Value);
     146        }       
     147      } else {
     148        return base.ToString();
     149      }
     150
    103151    }
    104152  }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/HeuristicLab.Problems.MetaOptimization-3.3.csproj

    r4839 r4981  
    8888  <ItemGroup>
    8989    <Compile Include="Analyzers\BestParameterConfigurationAnalyzer.cs" />
     90    <Compile Include="Encodings\RangeConstraints\ConstrainedValue.cs">
     91      <SubType>Code</SubType>
     92    </Compile>
    9093    <Compile Include="Encodings\ValueConfigurations\ValueConfiguration.cs" />
     94    <Compile Include="Encodings\ValueConfigurations\CheckedValueConfigurationCollection.cs" />
     95    <Compile Include="Interfaces\ICheckedValueConfigurationCollection.cs" />
     96    <Compile Include="Interfaces\IOptimizable.cs" />
    9197    <Compile Include="Interfaces\IParameterConfigurationCreator.cs" />
    9298    <Compile Include="Creators\RandomParameterConfigurationCreator.cs" />
     
    99105    <Compile Include="Encodings\ParameterConfigurations\ParameterConfiguration.cs" />
    100106    <Compile Include="Interfaces\IValueConfiguration.cs" />
    101     <Compile Include="Range.cs" />
     107    <Compile Include="Encodings\RangeConstraints\Range.cs" />
    102108    <Compile Include="Properties\AssemblyInfo.cs" />
    103109    <Compile Include="MetaOptimizationProblem.cs" />
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IParameterConfiguration.cs

    r4839 r4981  
    22using HeuristicLab.Core;
    33using System.Collections.Generic;
     4using HeuristicLab.Data;
     5using HeuristicLab.Common;
    46
    57namespace HeuristicLab.Problems.MetaOptimization {
    6   public interface IParameterConfiguration : INamedItem {
    7     bool OptimizationEnabled { get; set; }
     8  public interface IParameterConfiguration : IOptimizable, INamedItem {
    89    string ParameterName { get; set; }
    910    Type ParameterDataType { get; }
    10     ICheckedItemList<IValueConfiguration> ValueConfigurations { get; }
     11    ICheckedValueConfigurationCollection ValueConfigurations { get; }
    1112    IValueConfiguration ActualValueConfiguration { get; set; }
    12     Type ValueDataType { get; }
    1313    IEnumerable<IItem> ValidValues { get; }
    14 
    15     event EventHandler OptimizationEnabledChanged;
    1614  }
    1715}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IRange.cs

    r4839 r4981  
    55
    66namespace HeuristicLab.Problems.MetaOptimization {
    7   public interface IRange<T> : IItem where T : class, IItem, IStringConvertibleValue, IDeepCloneable {
    8     T LowerBound { get; set; }
    9     T UpperBound { get; set; }
    10     T StepSize { get; set; }
     7  public interface IRange : IItem, IStringConvertibleValue {
     8    object LowerBound { get; set; }
     9    object UpperBound { get; set; }
     10    object StepSize { get; set; }
    1111
    1212    event EventHandler LowerBoundChanged;
     
    1414    event EventHandler StepSizeChanged;
    1515  }
     16
     17  public interface IRange<T> : IRange, IItem where T : class {
     18    new T LowerBound { get; set; }
     19    new T UpperBound { get; set; }
     20    new T StepSize { get; set; }
     21  }
    1622}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Interfaces/IValueConfiguration.cs

    r4839 r4981  
    11using System;
    22using HeuristicLab.Core;
     3using HeuristicLab.Data;
    34
    45namespace HeuristicLab.Problems.MetaOptimization {
    5   public interface IValueConfiguration : IItem {
    6     IItem Value { get; set; }
    7     Type ValueDataType { get; }
    8     IItemList<IParameterConfiguration> ParameterConfigurations { get; }
    9 
     6  public interface IValueConfiguration : IOptimizable, IItem {
     7    IItemCollection<IParameterConfiguration> ParameterConfigurations { get; }
     8    IRange RangeConstraint { get; }
    109    event EventHandler ValueChanged;
    1110  }
Note: See TracChangeset for help on using the changeset viewer.