Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2891


Ignore:
Timestamp:
03/01/10 04:46:06 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on algorithms and parameters
Location:
trunk/sources
Files:
18 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab 3.3.sln

    r2888 r2891  
    7070    {DC3D7072-7999-4719-B65D-3997744D5DC1} = {DC3D7072-7999-4719-B65D-3997744D5DC1}
    7171    {F42F3576-7233-4B28-90F7-36AE15F30F92} = {F42F3576-7233-4B28-90F7-36AE15F30F92}
     72    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9} = {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}
    7273    {57F38579-409D-4DD8-AB19-3F2C4A665126} = {57F38579-409D-4DD8-AB19-3F2C4A665126}
    7374    {BF7D9494-A586-457B-8DF9-ED599F9E6A71} = {BF7D9494-A586-457B-8DF9-ED599F9E6A71}
    7475    {600287A3-8714-453E-B875-A05F3EB72315} = {600287A3-8714-453E-B875-A05F3EB72315}
     76    {887425B4-4348-49ED-A457-B7D2C26DDBF9} = {887425B4-4348-49ED-A457-B7D2C26DDBF9}
    7577    {F4539FB6-4708-40C9-BE64-0A1390AEA197} = {F4539FB6-4708-40C9-BE64-0A1390AEA197}
    7678    {958B43BC-CC5C-4FA2-8628-2B3B01D890B6} = {958B43BC-CC5C-4FA2-8628-2B3B01D890B6}
     
    165167EndProject
    166168Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.SGA.Views-3.3", "HeuristicLab.Algorithms.SGA.Views\3.3\HeuristicLab.Algorithms.SGA.Views-3.3.csproj", "{35A42EE0-A896-4D7A-A99F-8ED9E925F320}"
     169EndProject
     170Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Analysis-3.3", "HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj", "{887425B4-4348-49ED-A457-B7D2C26DDBF9}"
     171EndProject
     172Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Analysis.Views-3.3", "HeuristicLab.Analysis.Views\3.3\HeuristicLab.Analysis.Views-3.3.csproj", "{76945D76-CA61-4147-9DC2-0ACDCDDF87F9}"
    167173EndProject
    168174Global
     
    717723    {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Release|x64.ActiveCfg = Release|Any CPU
    718724    {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Release|x86.ActiveCfg = Release|Any CPU
     725    {887425B4-4348-49ED-A457-B7D2C26DDBF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     726    {887425B4-4348-49ED-A457-B7D2C26DDBF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
     727    {887425B4-4348-49ED-A457-B7D2C26DDBF9}.Debug|x64.ActiveCfg = Debug|Any CPU
     728    {887425B4-4348-49ED-A457-B7D2C26DDBF9}.Debug|x86.ActiveCfg = Debug|Any CPU
     729    {887425B4-4348-49ED-A457-B7D2C26DDBF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
     730    {887425B4-4348-49ED-A457-B7D2C26DDBF9}.Release|Any CPU.Build.0 = Release|Any CPU
     731    {887425B4-4348-49ED-A457-B7D2C26DDBF9}.Release|x64.ActiveCfg = Release|Any CPU
     732    {887425B4-4348-49ED-A457-B7D2C26DDBF9}.Release|x86.ActiveCfg = Release|Any CPU
     733    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     734    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
     735    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}.Debug|x64.ActiveCfg = Debug|Any CPU
     736    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}.Debug|x86.ActiveCfg = Debug|Any CPU
     737    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
     738    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}.Release|Any CPU.Build.0 = Release|Any CPU
     739    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}.Release|x64.ActiveCfg = Release|Any CPU
     740    {76945D76-CA61-4147-9DC2-0ACDCDDF87F9}.Release|x86.ActiveCfg = Release|Any CPU
    719741  EndGlobalSection
    720742  GlobalSection(SolutionProperties) = preSolution
  • trunk/sources/HeuristicLab 3.3/Files.txt

    r2888 r2891  
    66HeuristicLab.Algorithms.SGA\3.3:HeuristicLab.Algorithms.SGA-3.3.dll
    77HeuristicLab.Algorithms.SGA.Views\3.3:HeuristicLab.Algorithms.SGA.Views-3.3.dll
     8HeuristicLab.Analysis\3.3:HeuristicLab.Analysis-3.3.dll
     9HeuristicLab.Analysis.Views\3.3:HeuristicLab.Analysis.Views-3.3.dll
    810HeuristicLab.Charting\3.3:HeuristicLab.Charting-3.3.dll
    911HeuristicLab.Charting.Data\3.3:HeuristicLab.Charting.Data-3.3.dll
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/HeuristicLab.Algorithms.SGA-3.3.csproj

    r2884 r2891  
    8888  </ItemGroup>
    8989  <ItemGroup>
     90    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     91      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     92      <Name>HeuristicLab.Analysis-3.3</Name>
     93    </ProjectReference>
    9094    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    9195      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/HeuristicLabAlgorithmsSGAPlugin.cs.frame

    r2884 r2891  
    2828  [Plugin("HeuristicLab.Algorithms.SGA", "3.3.0.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Algorithms.SGA-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Analysis", "3.3")]
    3031  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3132  [PluginDependency("HeuristicLab.Core", "3.3")]
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGA.cs

    r2890 r2891  
    4343    private SGAOperator sgaOperator;
    4444
    45     private OptionalValueParameter<IntData> PopulationSizeParameter {
    46       get { return (OptionalValueParameter<IntData>)Parameters["PopulationSize"]; }
     45    private ValueParameter<IntData> PopulationSizeParameter {
     46      get { return (ValueParameter<IntData>)Parameters["PopulationSize"]; }
    4747    }
    4848    private ConstrainedValueParameter<ISelector> SelectorParameter {
     
    5555      get { return (ConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
    5656    }
    57     private OptionalValueParameter<IntData> ElitesParameter {
    58       get { return (OptionalValueParameter<IntData>)Parameters["Elites"]; }
     57    private ValueParameter<IntData> ElitesParameter {
     58      get { return (ValueParameter<IntData>)Parameters["Elites"]; }
    5959    }
    6060
     
    6969    public SGA()
    7070      : base() {
    71       Parameters.Add(new OptionalValueParameter<IntData>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0)));
    72       Parameters.Add(new OptionalValueParameter<BoolData>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true)));
    73       Parameters.Add(new OptionalValueParameter<IntData>("PopulationSize", "The size of the population of solutions.", new IntData(100)));
     71      Parameters.Add(new ValueParameter<IntData>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0)));
     72      Parameters.Add(new ValueParameter<BoolData>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true)));
     73      Parameters.Add(new ValueParameter<IntData>("PopulationSize", "The size of the population of solutions.", new IntData(100)));
    7474      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
    7575      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
    76       Parameters.Add(new OptionalValueParameter<DoubleData>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleData(0.05)));
     76      Parameters.Add(new ValueParameter<DoubleData>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleData(0.05)));
    7777      Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    78       Parameters.Add(new OptionalValueParameter<IntData>("Elites", "The numer of elite solutions which are kept in each generation.", new IntData(1)));
    79       Parameters.Add(new OptionalValueParameter<IntData>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntData(1000)));
     78      Parameters.Add(new ValueParameter<IntData>("Elites", "The numer of elite solutions which are kept in each generation.", new IntData(1)));
     79      Parameters.Add(new ValueParameter<IntData>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntData(1000)));
    8080
    8181      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGAOperator.cs

    r2890 r2891  
    2020#endregion
    2121
     22using HeuristicLab.Analysis;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    112113      IntCounter intCounter = new IntCounter();
    113114      Comparator comparator = new Comparator();
     115      BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator = new BestAverageWorstQualityCalculator();
    114116      ResultsCollector resultsCollector = new ResultsCollector();
    115117      ConditionalBranch conditionalBranch = new ConditionalBranch();
     
    179181      comparator.ResultParameter.ActualName = "Terminate";
    180182      comparator.RightSideParameter.ActualName = "MaximumGenerations";
    181       comparator.Successor = resultsCollector;
    182 
    183       SubScopesLookupParameter<DoubleData> quality = new SubScopesLookupParameter<DoubleData>("Qualities");
    184       quality.ActualName = "Quality";
    185       resultsCollector.CollectedValues.Add(quality);
     183      comparator.Successor = bestAverageWorstQualityCalculator;
     184
     185      bestAverageWorstQualityCalculator.AverageQualityParameter.ActualName = "AverageQuality";
     186      bestAverageWorstQualityCalculator.BestQualityParameter.ActualName = "BestQuality";
     187      bestAverageWorstQualityCalculator.MaximizationParameter.ActualName = "Maximization";
     188      bestAverageWorstQualityCalculator.QualityParameter.ActualName = "Quality";
     189      bestAverageWorstQualityCalculator.WorstQualityParameter.ActualName = "WorstQuality";
     190      bestAverageWorstQualityCalculator.Successor = resultsCollector;
     191
     192      LookupParameter<DoubleData> bestQuality = new LookupParameter<DoubleData>("BestQuality");
     193      bestQuality.ActualName = "BestQuality";
     194      resultsCollector.CollectedValues.Add(bestQuality);
     195      LookupParameter<DoubleData> averageQuality = new LookupParameter<DoubleData>("AverageQuality");
     196      averageQuality.ActualName = "AverageQuality";
     197      resultsCollector.CollectedValues.Add(averageQuality);
     198      LookupParameter<DoubleData> worstQuality = new LookupParameter<DoubleData>("WorstQuality");
     199      worstQuality.ActualName = "WorstQuality";
     200      resultsCollector.CollectedValues.Add(worstQuality);
    186201      resultsCollector.ResultsParameter.ActualName = "Results";
    187202      resultsCollector.Successor = conditionalBranch;
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests/HeuristicLab.Algorithms.SGA-3.3.Tests.csproj

    r2884 r2891  
    4646  </ItemGroup>
    4747  <ItemGroup>
     48    <ProjectReference Include="..\..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     49      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     50      <Name>HeuristicLab.Analysis-3.3</Name>
     51    </ProjectReference>
    4852    <ProjectReference Include="..\..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    4953      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/HeuristicLab.Operators.Views.GraphVisualization-3.3.csproj

    r2861 r2891  
    132132    <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.Netron\3.0.2672.12446\HeuristicLab.Netron-3.0.2672.12446\HeuristicLab.Netron-3.0.2672.12446.csproj">
    133133      <Project>{BB994448-2B21-4564-BB2E-38D8FFF8CF18}</Project>
    134       <Name>HeuristicLab.Netron-3.0.2672.12446</Name>
     134      <Name>HeuristicLab.Netron-3.0.2672.12446 %28HeuristicLab.ExtLibs\HeuristicLab.Netron\HeuristicLab.Netron-3.0.2672.12446\HeuristicLab.Netron-3.0.2672.12446%29</Name>
    135135    </ProjectReference>
    136136    <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.Netron\3.0.2672.12446\Netron.Diagramming.Core-3.0.2672.12446\Netron.Diagramming.Core-3.0.2672.12446.csproj">
  • trunk/sources/HeuristicLab.Operators/3.3/Comparator.cs

    r2890 r2891  
    4040      get { return (ValueLookupParameter<IItem>)Parameters["RightSide"]; }
    4141    }
    42     private OptionalValueParameter<ComparisonData> ComparisonParameter {
    43       get { return (OptionalValueParameter<ComparisonData>)Parameters["Comparison"]; }
     42    private ValueParameter<ComparisonData> ComparisonParameter {
     43      get { return (ValueParameter<ComparisonData>)Parameters["Comparison"]; }
    4444    }
    4545    public LookupParameter<BoolData> ResultParameter {
     
    5555      Parameters.Add(new LookupParameter<IItem>("LeftSide", "The left side of the comparison."));
    5656      Parameters.Add(new ValueLookupParameter<IItem>("RightSide", "The right side of the comparison."));
    57       Parameters.Add(new OptionalValueParameter<ComparisonData>("Comparison", "The type of comparison.", new ComparisonData()));
     57      Parameters.Add(new ValueParameter<ComparisonData>("Comparison", "The type of comparison.", new ComparisonData(Data.Comparison.Equal)));
    5858      Parameters.Add(new LookupParameter<BoolData>("Result", "The result of the comparison."));
    5959    }
  • trunk/sources/HeuristicLab.Operators/3.3/SubScopesRemover.cs

    r2890 r2891  
    3333  [Creatable("Test")]
    3434  public sealed class SubScopesRemover : SingleSuccessorOperator {
    35     private OptionalValueParameter<BoolData> RemoveAllSubScopesParameter {
    36       get { return (OptionalValueParameter<BoolData>)Parameters["RemoveAllSubScopes"]; }
     35    private ValueParameter<BoolData> RemoveAllSubScopesParameter {
     36      get { return (ValueParameter<BoolData>)Parameters["RemoveAllSubScopes"]; }
    3737    }
    3838    public ValueLookupParameter<IntData> SubScopeIndexParameter {
     
    5353    public SubScopesRemover()
    5454      : base() {
    55       Parameters.Add(new OptionalValueParameter<BoolData>("RemoveAllSubScopes", "True if all sub-scopes of the current scope should be removed, otherwise false.", new BoolData(true)));
     55      Parameters.Add(new ValueParameter<BoolData>("RemoveAllSubScopes", "True if all sub-scopes of the current scope should be removed, otherwise false.", new BoolData(true)));
    5656      Parameters.Add(new ValueLookupParameter<IntData>("SubScopeIndex", "The index of the sub-scope which should be removed. This parameter is ignored, if RemoveAllSubScopes is true."));
    5757      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which one or all sub-scopes should be removed."));
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/HeuristicLab.Parameters.Views-3.3.csproj

    r2852 r2891  
    7474    <Compile Include="ConstrainedValueParameterView.Designer.cs">
    7575      <DependentUpon>ConstrainedValueParameterView.cs</DependentUpon>
     76    </Compile>
     77    <Compile Include="OptionalValueParameterView.cs">
     78      <SubType>UserControl</SubType>
     79    </Compile>
     80    <Compile Include="OptionalValueParameterView.Designer.cs">
     81      <DependentUpon>OptionalValueParameterView.cs</DependentUpon>
    7682    </Compile>
    7783    <Compile Include="ValueLookupParameterView.cs">
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.Designer.cs

    r2796 r2891  
    3333    protected override void Dispose(bool disposing) {
    3434      if (disposing) {
    35         if (typeSelectorDialog != null) typeSelectorDialog.Dispose();
    3635        if (components != null) components.Dispose();
    3736      }
     
    4645    /// </summary>
    4746    private void InitializeComponent() {
    48       this.components = new System.ComponentModel.Container();
    4947      this.valueGroupBox = new System.Windows.Forms.GroupBox();
    5048      this.valuePanel = new System.Windows.Forms.Panel();
    5149      this.viewHost = new HeuristicLab.Core.Views.ViewHost();
    52       this.clearValueButton = new System.Windows.Forms.Button();
    53       this.setValueButton = new System.Windows.Forms.Button();
    54       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5550      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5651      this.valueGroupBox.SuspendLayout();
     
    8176                  | System.Windows.Forms.AnchorStyles.Right)));
    8277      this.valueGroupBox.Controls.Add(this.valuePanel);
    83       this.valueGroupBox.Controls.Add(this.clearValueButton);
    84       this.valueGroupBox.Controls.Add(this.setValueButton);
    8578      this.valueGroupBox.Location = new System.Drawing.Point(0, 120);
    8679      this.valueGroupBox.Name = "valueGroupBox";
     
    9790                  | System.Windows.Forms.AnchorStyles.Right)));
    9891      this.valuePanel.Controls.Add(this.viewHost);
    99       this.valuePanel.Location = new System.Drawing.Point(6, 49);
     92      this.valuePanel.Location = new System.Drawing.Point(6, 19);
    10093      this.valuePanel.Name = "valuePanel";
    101       this.valuePanel.Size = new System.Drawing.Size(374, 140);
     94      this.valuePanel.Size = new System.Drawing.Size(374, 170);
    10295      this.valuePanel.TabIndex = 0;
    10396      this.valuePanel.DragOver += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
     
    111104      this.viewHost.Location = new System.Drawing.Point(0, 0);
    112105      this.viewHost.Name = "viewHost";
    113       this.viewHost.Size = new System.Drawing.Size(374, 140);
     106      this.viewHost.Size = new System.Drawing.Size(374, 170);
    114107      this.viewHost.TabIndex = 0;
    115       //
    116       // clearValueButton
    117       //
    118       this.clearValueButton.Enabled = false;
    119       this.clearValueButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Remove;
    120       this.clearValueButton.Location = new System.Drawing.Point(36, 19);
    121       this.clearValueButton.Name = "clearValueButton";
    122       this.clearValueButton.Size = new System.Drawing.Size(24, 24);
    123       this.clearValueButton.TabIndex = 1;
    124       this.toolTip.SetToolTip(this.clearValueButton, "Clear Value");
    125       this.clearValueButton.UseVisualStyleBackColor = true;
    126       this.clearValueButton.Click += new System.EventHandler(this.clearValueButton_Click);
    127       //
    128       // setValueButton
    129       //
    130       this.setValueButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Add;
    131       this.setValueButton.Location = new System.Drawing.Point(6, 19);
    132       this.setValueButton.Name = "setValueButton";
    133       this.setValueButton.Size = new System.Drawing.Size(24, 24);
    134       this.setValueButton.TabIndex = 0;
    135       this.toolTip.SetToolTip(this.setValueButton, "Set Value");
    136       this.setValueButton.UseVisualStyleBackColor = true;
    137       this.setValueButton.Click += new System.EventHandler(this.setValueButton_Click);
     108      this.viewHost.ViewType = null;
    138109      //
    139110      // ValueParameterView
     
    164135    protected System.Windows.Forms.Panel valuePanel;
    165136    protected HeuristicLab.Core.Views.ViewHost viewHost;
    166     protected System.Windows.Forms.Button setValueButton;
    167     protected System.Windows.Forms.ToolTip toolTip;
    168     protected System.Windows.Forms.Button clearValueButton;
    169137  }
    170138}
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs

    r2890 r2891  
    3030  /// The visual representation of a <see cref="Parameter"/>.
    3131  /// </summary>
    32   [Content(typeof(OptionalValueParameter<>), true)]
    33   [Content(typeof(IValueParameter<>), false)]
     32  [Content(typeof(ValueParameter<>), true)]
    3433  public partial class ValueParameterView<T> : ParameterView where T : class, IItem {
    35     protected TypeSelectorDialog typeSelectorDialog;
    36 
    3734    /// <summary>
    3835    /// Gets or sets the variable to represent visually.
     
    4037    /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
    4138    /// No own data storage present.</remarks>
    42     public new IValueParameter<T> Content {
    43       get { return (IValueParameter<T>)base.Content; }
     39    public new ValueParameter<T> Content {
     40      get { return (ValueParameter<T>)base.Content; }
    4441      set { base.Content = value; }
    4542    }
     
    5754    /// <remarks>Calls <see cref="VariableView()"/>.</remarks>
    5855    /// <param name="variable">The variable to represent visually.</param>
    59     public ValueParameterView(IValueParameter<T> content)
     56    public ValueParameterView(ValueParameter<T> content)
    6057      : this() {
    6158      Content = content;
     
    8481      if (Content == null) {
    8582        Caption = "ValueParameter";
    86         setValueButton.Enabled = false;
    87         clearValueButton.Enabled = false;
    8883        viewHost.Content = null;
    8984        valueGroupBox.Enabled = false;
    9085      } else {
    9186        Caption = Content.Name + " (" + Content.GetType().Name + ")";
    92         setValueButton.Enabled = Content.Value == null;
    93         clearValueButton.Enabled = Content.Value != null;
    9487        valueGroupBox.Enabled = true;
    9588        viewHost.Content = Content.Value;
     
    10194        Invoke(new EventHandler(Content_ValueChanged), sender, e);
    10295      else {
    103         setValueButton.Enabled = Content.Value == null;
    104         clearValueButton.Enabled = Content.Value != null;
    10596        viewHost.Content = Content.Value;
    10697      }
    10798    }
    10899
    109     protected virtual void setValueButton_Click(object sender, EventArgs e) {
    110       if (typeSelectorDialog == null) {
    111         typeSelectorDialog = new TypeSelectorDialog();
    112         typeSelectorDialog.Caption = "Select Value";
    113         typeSelectorDialog.TypeSelector.Configure(Content.DataType, false, false);
    114       }
    115       if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK)
    116         Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    117     }
    118     protected virtual void clearValueButton_Click(object sender, EventArgs e) {
    119       Content.Value = null;
    120     }
    121100    protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) {
    122101      e.Effect = DragDropEffects.None;
  • trunk/sources/HeuristicLab.Parameters/3.3/HeuristicLab.Parameters-3.3.csproj

    r2890 r2891  
    6868    <None Include="HeuristicLabParametersPlugin.cs.frame" />
    6969    <Compile Include="ConstrainedValueParameter.cs" />
     70    <Compile Include="ValueParameter.cs" />
    7071    <Compile Include="LookupParameter.cs" />
    7172    <Compile Include="OptionalValueParameter.cs" />
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs

    r2890 r2891  
    2727namespace HeuristicLab.Parameters {
    2828  /// <summary>
    29   /// A parameter whose value is defined it the parameter itself. The value of the parameter can be null, if the parameter is not set.
     29  /// A parameter whose value is defined it the parameter itself or is null.
    3030  /// </summary>
    31   [Item("OptionalValueParameter<T>", "A parameter whose value is defined it the parameter itself. The value of the parameter can be null, if the parameter is not set.")]
     31  [Item("OptionalValueParameter<T>", "A parameter whose value is defined it the parameter itself or is null.")]
    3232  public class OptionalValueParameter<T> : Parameter, IValueParameter<T> where T : class, IItem {
    3333    private T value;
  • trunk/sources/HeuristicLab.Problems.TSP/3.3/TSP.cs

    r2890 r2891  
    7575    public TSP()
    7676      : base() {
    77       Parameters.Add(new OptionalValueParameter<BoolData>("Maximization", "Set to false as the Traveling Salesman Problem is a minimization problem.", new BoolData(false)));
    78       Parameters.Add(new OptionalValueParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrixData(0, 0)));
    79       Parameters.Add(new OptionalValueParameter<IPermutationCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions."));
    80       Parameters.Add(new OptionalValueParameter<ITSPEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions."));
     77      RandomPermutationCreator creator = new RandomPermutationCreator();
     78      TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
     79
     80      Parameters.Add(new ValueParameter<BoolData>("Maximization", "Set to false as the Traveling Salesman Problem is a minimization problem.", new BoolData(false)));
     81      Parameters.Add(new ValueParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrixData(0, 0)));
     82      Parameters.Add(new ValueParameter<IPermutationCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions.", creator));
     83      Parameters.Add(new ValueParameter<ITSPEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions.", evaluator));
    8184      Parameters.Add(new OptionalValueParameter<DoubleData>("BestKnownQuality", "The quality of the best known solution of this TSP instance."));
     85
     86      creator.PermutationParameter.ActualName = "TSPTour";
     87      creator.LengthParameter.Value = new IntData(0);
     88      evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
     89      evaluator.PermutationParameter.ActualName = creator.PermutationParameter.ActualName;
     90      evaluator.QualityParameter.ActualName = "TSPTourLength";
    8291
    8392      MaximizationParameter.ValueChanged += new EventHandler(MaximizationParameter_ValueChanged);
    8493      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    8594      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
    86 
    87       RandomPermutationCreator creator = new RandomPermutationCreator();
    88       creator.PermutationParameter.ActualName = "TSPTour";
    89       creator.LengthParameter.Value = new IntData(0);
    90       SolutionCreatorParameter.Value = creator;
    91       TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
    92       evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
    93       evaluator.PermutationParameter.ActualName = creator.PermutationParameter.ActualName;
    94       evaluator.QualityParameter.ActualName = "TSPTourLength";
    95       EvaluatorParameter.Value = evaluator;
    9695
    9796      var ops = ApplicationManager.Manager.GetInstances<IPermutationOperator>();
  • trunk/sources/HeuristicLab.Selection/3.3/ProportionalSelector.cs

    r2890 r2891  
    3636  [Creatable("Test")]
    3737  public sealed class ProportionalSelector : StochasticSingleObjectiveSelector {
    38     private OptionalValueParameter<BoolData> WindowingParameter {
    39       get { return (OptionalValueParameter<BoolData>)Parameters["Windowing"]; }
     38    private ValueParameter<BoolData> WindowingParameter {
     39      get { return (ValueParameter<BoolData>)Parameters["Windowing"]; }
    4040    }
    4141
     
    4747    public ProportionalSelector()
    4848      : base() {
    49       Parameters.Add(new OptionalValueParameter<BoolData>("Windowing", "Apply windowing strategy (selection probability is proportional to the quality differences and not to the total quality).", new BoolData(true)));
     49      Parameters.Add(new ValueParameter<BoolData>("Windowing", "Apply windowing strategy (selection probability is proportional to the quality differences and not to the total quality).", new BoolData(true)));
    5050      CopySelected.Value = true;
    5151    }
  • trunk/sources/HeuristicLab.Selection/3.3/Selector.cs

    r2890 r2891  
    3535  [EmptyStorableClass]
    3636  public abstract class Selector : SingleSuccessorOperator, ISelector {
    37     protected OptionalValueParameter<BoolData> CopySelectedParameter {
    38       get { return (OptionalValueParameter<BoolData>)Parameters["CopySelected"]; }
     37    protected ValueParameter<BoolData> CopySelectedParameter {
     38      get { return (ValueParameter<BoolData>)Parameters["CopySelected"]; }
    3939    }
    4040    public IValueLookupParameter<IntData> NumberOfSelectedSubScopesParameter {
     
    5555    protected Selector()
    5656      : base() {
    57       Parameters.Add(new OptionalValueParameter<BoolData>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolData(false)));
     57      Parameters.Add(new ValueParameter<BoolData>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolData(false)));
    5858      Parameters.Add(new ValueLookupParameter<IntData>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected."));
    5959      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which sub-scopes should be selected."));
Note: See TracChangeset for help on using the changeset viewer.