Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17149


Ignore:
Timestamp:
07/22/19 14:15:55 (5 years ago)
Author:
abeham
Message:

#3005: merged to stable (16872, 16873, 16875, 16890)

Location:
stable
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.ALPS

  • stable/HeuristicLab.Algorithms.ALPS/3.3/AlpsOffspringSelectionGeneticAlgorithmMainOperator.cs

    r17097 r17149  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2627using HeuristicLab.Optimization.Operators;
    2728using HeuristicLab.Parameters;
    28 using HEAL.Attic;
    2929using HeuristicLab.Selection;
    3030
     
    266266
    267267      variableCreator1.Name = "MutatedOffspring = true";
    268       variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true), false));
     268      variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true)) { GetsCollected = false });
    269269      variableCreator1.Successor = null;
    270270
    271271      variableCreator2.Name = "MutatedOffspring = false";
    272       variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false), false));
     272      variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false)) { GetsCollected = false });
    273273      variableCreator2.Successor = null;
    274274
  • stable/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.cs

    r17097 r17149  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2627using HeuristicLab.Optimization.Operators;
    2728using HeuristicLab.Parameters;
    28 using HEAL.Attic;
    2929using HeuristicLab.Selection;
    3030
     
    218218
    219219      variableCreator1.Name = "MutatedOffspring = true";
    220       variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true), false));
     220      variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true)) { GetsCollected = false });
    221221
    222222      variableCreator2.Name = "MutatedOffspring = false";
    223       variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false), false));
     223      variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false)) { GetsCollected = false });
    224224
    225225      conditionalSelector.ConditionParameter.ActualName = "MutatedOffspring";
  • stable/HeuristicLab.Analysis

  • stable/HeuristicLab.Analysis/3.3/DataVisualization/DataTableValuesCollector.cs

    r17097 r17149  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    2728using HeuristicLab.Operators;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Analysis {
     
    5959      : base() {
    6060      Parameters.Add(new ValueLookupParameter<DataTable>("DataTable", "The table of data values where the collected values should be stored."));
    61       Parameters.Add(new FixedValueParameter<BoolValue>("StartIndexZero", "True, if the collected data values should start with index 0, otherwise false.", new BoolValue(true), false));
     61      Parameters.Add(new FixedValueParameter<BoolValue>("StartIndexZero", "True, if the collected data values should start with index 0, otherwise false.", new BoolValue(true)) { GetsCollected = false });
    6262      StartIndexZeroParameter.Hidden = true;
    6363    }
     
    6868      #region Backwards compatible code (remove with 3.4)
    6969      if (!Parameters.ContainsKey("StartIndexZero")) {
    70         Parameters.Add(new FixedValueParameter<BoolValue>("StartIndexZero", "True, if the collected data values should start with index 0, otherwise false.", new BoolValue(true), false));
     70        Parameters.Add(new FixedValueParameter<BoolValue>("StartIndexZero", "True, if the collected data values should start with index 0, otherwise false.", new BoolValue(true)) { GetsCollected = false });
    7171        StartIndexZeroParameter.Hidden = true;
    7272      }
  • stable/HeuristicLab.Core

  • stable/HeuristicLab.Core/3.3/Interfaces/IValueParameter.cs

    r17097 r17149  
    2727  public interface IValueParameter : IParameter {
    2828    IItem Value { get; set; }
     29    bool ReadOnly { get; set; }
    2930    bool GetsCollected { get; set; }
    3031    event EventHandler ValueChanged;
     32    event EventHandler ReadOnlyChanged;
    3133    event EventHandler GetsCollectedChanged;
    3234  }
  • stable/HeuristicLab.Optimization

  • stable/HeuristicLab.Optimization/3.3/Problems/Problem.cs

    r17105 r17149  
    2323using System.Collections.Generic;
    2424using System.Drawing;
     25using HEAL.Attic;
    2526using HeuristicLab.Collections;
    2627using HeuristicLab.Common;
     
    2829using HeuristicLab.Data;
    2930using HeuristicLab.Parameters;
    30 using HEAL.Attic;
    3131
    3232namespace HeuristicLab.Optimization {
     
    5252    protected Problem()
    5353      : base() {
    54       Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(), false));
     54      Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>()) { GetsCollected = false });
    5555      OperatorsParameter.Hidden = true;
    5656      RegisterEventHandlers();
     
    6666        if (operators != null) {
    6767          Parameters.Remove(OperatorsParameterName);
    68           Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(operators), false));
     68          Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(operators)) { GetsCollected = false });
    6969          OperatorsParameter.Hidden = true;
    7070        }
     
    9595        //necessary to convert old experiments files where no parameter was used for saving the operators
    9696        if (!Parameters.ContainsKey(OperatorsParameterName)) {
    97           Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(), false));
     97          Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>()) { GetsCollected = false });
    9898          OperatorsParameter.Hidden = true;
    9999        }
     
    107107        #region Backwards compatible code, remove with 3.4
    108108        if (!Parameters.ContainsKey(OperatorsParameterName)) {
    109           Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(), false));
     109          Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>()) { GetsCollected = false });
    110110          OperatorsParameter.Hidden = true;
    111111        }
  • stable/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs

    r17097 r17149  
    2525using System.Linq;
    2626using System.Threading;
     27using HEAL.Attic;
    2728using HeuristicLab.Collections;
    2829using HeuristicLab.Common;
     
    3031using HeuristicLab.Data;
    3132using HeuristicLab.Parameters;
    32 using HEAL.Attic;
    3333using HeuristicLab.PluginInfrastructure;
    3434
     
    130130        ItemList<IOperator> tmp = ((ValueParameter<ItemList<IOperator>>)Parameters["Operators"]).Value;
    131131        Parameters.Remove("Operators");
    132         Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp), false));
     132        Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp)) { GetsCollected = false });
    133133      }
    134134      #endregion
  • stable/HeuristicLab.Parameters.Views/3.3/ConstrainedValueParameterView.cs

    r17097 r17149  
    6262    protected override void DeregisterContentEvents() {
    6363      Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged);
     64      Content.ReadOnlyChanged -= new EventHandler(Content_ReadOnlyChanged);
    6465      Content.ValidValues.ItemsAdded -= new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsAdded);
    6566      Content.ValidValues.ItemsRemoved -= new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved);
     
    7677      base.RegisterContentEvents();
    7778      Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged);
     79      Content.ReadOnlyChanged += new EventHandler(Content_ReadOnlyChanged);
    7880      Content.ValidValues.ItemsAdded += new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsAdded);
    7981      Content.ValidValues.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved);
     
    100102      base.SetEnabledStateOfControls();
    101103      valueGroupBox.Enabled = Content != null;
    102       valueComboBox.Enabled = (valueComboBox.Items.Count > 0) && !ReadOnly;
     104      valueComboBox.Enabled = Content != null && valueComboBox.Items.Count > 0 && !Content.ReadOnly && !ReadOnly;
    103105      showInRunCheckBox.Enabled = Content != null && !ReadOnly;
    104106    }
     
    153155        FillValueComboBox();
    154156    }
     157    protected virtual void Content_ReadOnlyChanged(object sender, EventArgs e) {
     158      if (InvokeRequired)
     159        Invoke(new EventHandler(Content_ReadOnlyChanged), sender, e);
     160      else {
     161        SetEnabledStateOfControls();
     162      }
     163    }
    155164    protected virtual void Content_GetsCollectedChanged(object sender, EventArgs e) {
    156165      if (InvokeRequired)
  • stable/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.cs

    r17097 r17149  
    7474      Content.ActualNameChanged -= new EventHandler(Content_ActualNameChanged);
    7575      Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged);
     76      Content.ReadOnlyChanged -= new EventHandler(Content_ReadOnlyChanged);
    7677      Content.ValueChanged -= new EventHandler(Content_ValueChanged);
    7778      base.DeregisterContentEvents();
     
    8687      Content.ActualNameChanged += new EventHandler(Content_ActualNameChanged);
    8788      Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged);
     89      Content.ReadOnlyChanged += new EventHandler(Content_ReadOnlyChanged);
    8890      Content.ValueChanged += new EventHandler(Content_ValueChanged);
    8991    }
     
    108110      actualNameTextBox.Enabled = Content != null;
    109111      actualNameTextBox.ReadOnly = ReadOnly;
    110       setValueButton.Enabled = Content != null && !ReadOnly;
    111       clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;
     112      setValueButton.Enabled = Content != null && !Content.ReadOnly && !ReadOnly;
     113      clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !ReadOnly;
    112114      showInRunCheckBox.Enabled = Content != null && !ReadOnly;
    113115    }
     
    124126      else {
    125127        SetDataTypeTextBoxText();
    126         clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;
     128        clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !ReadOnly;
    127129        valueViewHost.ViewType = null;
    128130        valueViewHost.Content = Content != null ? Content.Value : null;
     131      }
     132    }
     133    protected virtual void Content_ReadOnlyChanged(object sender, EventArgs e) {
     134      if (InvokeRequired)
     135        Invoke(new EventHandler(Content_ReadOnlyChanged), sender, e);
     136      else {
     137        SetEnabledStateOfControls();
    129138      }
    130139    }
  • stable/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs

    r17097 r17149  
    7474    protected override void DeregisterContentEvents() {
    7575      Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged);
     76      Content.ReadOnlyChanged -= new EventHandler(Content_ReadOnlyChanged);
    7677      Content.ValueChanged -= new EventHandler(Content_ValueChanged);
    7778      base.DeregisterContentEvents();
     
    8586      base.RegisterContentEvents();
    8687      Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged);
     88      Content.ReadOnlyChanged += new EventHandler(Content_ReadOnlyChanged);
    8789      Content.ValueChanged += new EventHandler(Content_ValueChanged);
    8890    }
     
    103105    protected override void SetEnabledStateOfControls() {
    104106      base.SetEnabledStateOfControls();
    105       setValueButton.Enabled = Content != null && !(Content is IFixedValueParameter) && !ReadOnly;
    106       clearValueButton.Enabled = Content != null && Content.Value != null && !(Content is IFixedValueParameter) && !(Content is ValueParameter<T>) && !ReadOnly;
     107      setValueButton.Enabled = Content != null && !Content.ReadOnly && !(Content is IFixedValueParameter) && !ReadOnly;
     108      clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !(Content is IFixedValueParameter) && !(Content is ValueParameter<T>) && !ReadOnly;
    107109      showInRunCheckBox.Enabled = Content != null && !ReadOnly;
    108110    }
     
    113115      else {
    114116        SetDataTypeTextBoxText();
    115         setValueButton.Enabled = Content != null && !(Content is IFixedValueParameter) && !ReadOnly;
    116         clearValueButton.Enabled = Content != null && Content.Value != null && !(Content is IFixedValueParameter<T>) && !(Content is ValueParameter<T>) && !ReadOnly;
     117        setValueButton.Enabled = Content != null && !Content.ReadOnly && !(Content is IFixedValueParameter) && !ReadOnly;
     118        clearValueButton.Enabled = Content != null && !Content.ReadOnly && Content.Value != null && !(Content is IFixedValueParameter<T>) && !(Content is ValueParameter<T>) && !ReadOnly;
    117119        valueViewHost.ViewType = null;
    118120        valueViewHost.Content = Content != null ? Content.Value : null;
     121      }
     122    }
     123
     124    protected virtual void Content_ReadOnlyChanged(object sender, EventArgs e) {
     125      if (InvokeRequired)
     126        Invoke(new EventHandler(Content_ReadOnlyChanged), sender, e);
     127      else {
     128        SetEnabledStateOfControls();
    119129      }
    120130    }
     
    135145        try {
    136146          Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    137         }
    138         catch (Exception ex) {
     147        } catch (Exception ex) {
    139148          ErrorHandling.ShowErrorDialog(this, ex);
    140149        }
  • stable/HeuristicLab.Parameters/3.3/ConstrainedValueParameter.cs

    r17097 r17149  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Collections;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    27 using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Parameters {
     
    4747    public ConstrainedValueParameter() : base() { }
    4848    public ConstrainedValueParameter(string name) : base(name) { }
    49     public ConstrainedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    5049    public ConstrainedValueParameter(string name, ItemSet<T> validValues) : base(name, validValues) { }
    51     public ConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) : base(name, validValues, getsCollected) { }
    5250    public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value) : base(name, validValues, value) { }
    53     public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) : base(name, validValues, value, getsCollected) { }
    5451    public ConstrainedValueParameter(string name, string description) : base(name, description) { }
    55     public ConstrainedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    5652    public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues) : base(name, description, validValues) { }
    57     public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) : base(name, description, validValues, getsCollected) { }
    5853    public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value) : base(name, description, validValues, value) { }
    59     public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) : base(name, description, validValues, value, getsCollected) { }
    6054
    6155    public override IDeepCloneable Clone(Cloner cloner) {
  • stable/HeuristicLab.Parameters/3.3/FixedValueParameter.cs

    r17097 r17149  
    2121
    2222using System;
     23using HEAL.Attic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    25 using HEAL.Attic;
    2626
    2727namespace HeuristicLab.Parameters {
     
    3131  [Item("FixedValueParameter", "A parameter whose value is defined in the parameter itself and cannot be set.")]
    3232  [StorableType("7787B99D-5F32-4639-B47A-76CB4D204392")]
    33   public class FixedValueParameter<T> : ValueParameter<T>, IFixedValueParameter<T> where T : class,IItem, new() {
     33  public class FixedValueParameter<T> : ValueParameter<T>, IFixedValueParameter<T> where T : class, IItem, new() {
    3434
    3535    public override T Value {
     
    4646    public FixedValueParameter() : base() { }
    4747    public FixedValueParameter(string name) : base(name) { }
    48     public FixedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    4948    public FixedValueParameter(string name, T value) : base(name, value) { }
    50     public FixedValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }
    5149    public FixedValueParameter(string name, string description) : base(name, description) { }
    52     public FixedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    5350    public FixedValueParameter(string name, string description, T value) : base(name, description, value) { }
    54     public FixedValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { }
    5551
    5652    public override IDeepCloneable Clone(Cloner cloner) {
  • stable/HeuristicLab.Parameters/3.3/OperatorParameter.cs

    r17097 r17149  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    24 using HEAL.Attic;
    2525
    2626namespace HeuristicLab.Parameters {
     
    3636    public OperatorParameter() : base("Anonymous") { }
    3737    public OperatorParameter(string name) : base(name) { }
    38     public OperatorParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    3938    public OperatorParameter(string name, IOperator value) : base(name, value) { }
    40     public OperatorParameter(string name, IOperator value, bool getsCollected) : base(name, value, getsCollected) { }
    4139    public OperatorParameter(string name, string description) : base(name, description) { }
    42     public OperatorParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    4340    public OperatorParameter(string name, string description, IOperator value) : base(name, description, value) { }
    44     public OperatorParameter(string name, string description, IOperator value, bool getsCollected) : base(name, description, value, getsCollected) { }
    4541
    4642    public override IDeepCloneable Clone(Cloner cloner) {
  • stable/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs

    r17097 r17149  
    2222using System;
    2323using System.Drawing;
     24using HEAL.Attic;
    2425using HeuristicLab.Collections;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    27 using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Parameters {
     
    4040      }
    4141    }
    42      
     42
    4343    [Storable]
    4444    private ItemSet<T> validValues;
     
    5252      get { return this.value; }
    5353      set {
     54        if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter.");
    5455        if (value != this.value) {
    5556          if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value.");
     
    7475    }
    7576
     77    [Storable(DefaultValue = false)]
     78    private bool readOnly;
     79    public bool ReadOnly {
     80      get { return readOnly; }
     81      set {
     82        if (value == readOnly) return;
     83        readOnly = value;
     84        OnReadOnlyChanged();
     85      }
     86    }
     87
    7688    [Storable(DefaultValue = true)]
    7789    private bool getsCollected;
     
    93105      validValues = cloner.Clone(original.validValues);
    94106      value = cloner.Clone(original.value);
     107      readOnly = original.readOnly;
    95108      getsCollected = original.getsCollected;
    96109      Initialize();
     
    99112      : base("Anonymous", typeof(T)) {
    100113      this.validValues = new ItemSet<T>();
     114      this.readOnly = false;
    101115      this.getsCollected = true;
    102116      Initialize();
     
    105119      : base(name, typeof(T)) {
    106120      this.validValues = new ItemSet<T>();
    107       this.getsCollected = true;
    108       Initialize();
    109     }
    110     public OptionalConstrainedValueParameter(string name, bool getsCollected)
    111       : base(name, typeof(T)) {
    112       this.validValues = new ItemSet<T>();
    113       this.getsCollected = getsCollected;
     121      this.readOnly = false;
     122      this.getsCollected = true;
    114123      Initialize();
    115124    }
     
    117126      : base(name, typeof(T)) {
    118127      this.validValues = validValues;
    119       this.getsCollected = true;
    120       Initialize();
    121     }
    122     public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected)
    123       : base(name, typeof(T)) {
    124       this.validValues = validValues;
    125       this.getsCollected = getsCollected;
     128      this.readOnly = false;
     129      this.getsCollected = true;
    126130      Initialize();
    127131    }
     
    130134      this.validValues = validValues;
    131135      this.value = value;
    132       this.getsCollected = true;
    133       Initialize();
    134     }
    135     public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected)
    136       : base(name, typeof(T)) {
    137       this.validValues = validValues;
    138       this.value = value;
    139       this.getsCollected = getsCollected;
     136      this.readOnly = false;
     137      this.getsCollected = true;
    140138      Initialize();
    141139    }
     
    143141      : base(name, description, typeof(T)) {
    144142      this.validValues = new ItemSet<T>();
    145       this.getsCollected = true;
    146       Initialize();
    147     }
    148     public OptionalConstrainedValueParameter(string name, string description, bool getsCollected)
    149       : base(name, description, typeof(T)) {
    150       this.validValues = new ItemSet<T>();
    151       this.getsCollected = getsCollected;
     143      this.readOnly = false;
     144      this.getsCollected = true;
    152145      Initialize();
    153146    }
     
    155148      : base(name, description, typeof(T)) {
    156149      this.validValues = validValues;
    157       this.getsCollected = true;
    158       Initialize();
    159     }
    160     public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected)
    161       : base(name, description, typeof(T)) {
    162       this.validValues = validValues;
    163       this.getsCollected = getsCollected;
     150      this.readOnly = false;
     151      this.getsCollected = true;
    164152      Initialize();
    165153    }
     
    168156      this.validValues = validValues;
    169157      this.value = value;
    170       this.getsCollected = true;
    171       Initialize();
    172     }
    173     public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected)
    174       : base(name, description, typeof(T)) {
    175       this.validValues = validValues;
    176       this.value = value;
    177       this.getsCollected = getsCollected;
     158      this.readOnly = false;
     159      this.getsCollected = true;
    178160      Initialize();
    179161    }
     
    212194      OnToStringChanged();
    213195    }
     196    public event EventHandler ReadOnlyChanged;
     197    protected virtual void OnReadOnlyChanged() {
     198      EventHandler handler = ReadOnlyChanged;
     199      if (handler != null) handler(this, EventArgs.Empty);
     200    }
    214201    public event EventHandler GetsCollectedChanged;
    215202    protected virtual void OnGetsCollectedChanged() {
  • stable/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs

    r17097 r17149  
    2222using System;
    2323using System.Drawing;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    26 using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Parameters {
     
    4545      get { return this.value; }
    4646      set {
     47        if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter.");
    4748        if (value != this.value) {
    4849          DeregisterValueEvents();
     
    6364          );
    6465        Value = val;
     66      }
     67    }
     68
     69    [Storable(DefaultValue = false)]
     70    private bool readOnly;
     71    public bool ReadOnly {
     72      get { return readOnly; }
     73      set {
     74        if (value == readOnly) return;
     75        readOnly = value;
     76        OnReadOnlyChanged();
    6577      }
    6678    }
     
    108120      : base(original, cloner) {
    109121      value = cloner.Clone(original.value);
     122      readOnly = original.readOnly;
    110123      getsCollected = original.getsCollected;
    111124      reactOnValueToStringChangedAndValueItemImageChanged = original.reactOnValueToStringChangedAndValueItemImageChanged;
     
    114127    public OptionalValueParameter()
    115128      : base("Anonymous", typeof(T)) {
     129      this.readOnly = false;
    116130      this.getsCollected = true;
    117131      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
     
    119133    public OptionalValueParameter(string name)
    120134      : base(name, typeof(T)) {
    121       this.getsCollected = true;
    122       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    123     }
    124     public OptionalValueParameter(string name, bool getsCollected)
    125       : base(name, typeof(T)) {
    126       this.getsCollected = getsCollected;
     135      this.readOnly = false;
     136      this.getsCollected = true;
    127137      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    128138    }
     
    130140      : base(name, typeof(T)) {
    131141      this.value = value;
    132       this.getsCollected = true;
    133       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    134       RegisterValueEvents();
    135     }
    136     public OptionalValueParameter(string name, T value, bool getsCollected)
    137       : base(name, typeof(T)) {
    138       this.value = value;
    139       this.getsCollected = getsCollected;
     142      this.readOnly = false;
     143      this.getsCollected = true;
    140144      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    141145      RegisterValueEvents();
     
    143147    public OptionalValueParameter(string name, string description)
    144148      : base(name, description, typeof(T)) {
    145       this.getsCollected = true;
    146       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    147     }
    148     public OptionalValueParameter(string name, string description, bool getsCollected)
    149       : base(name, description, typeof(T)) {
    150       this.getsCollected = getsCollected;
    151       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    152     }
     149      this.readOnly = false;
     150      this.getsCollected = true;
     151      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
     152    }
     153
    153154    public OptionalValueParameter(string name, string description, T value)
    154155      : base(name, description, typeof(T)) {
    155156      this.value = value;
    156       this.getsCollected = true;
    157       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    158       RegisterValueEvents();
    159     }
    160     public OptionalValueParameter(string name, string description, T value, bool getsCollected)
    161       : base(name, description, typeof(T)) {
    162       this.value = value;
    163       this.getsCollected = getsCollected;
     157      this.readOnly = false;
     158      this.getsCollected = true;
    164159      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    165160      RegisterValueEvents();
     
    197192      OnToStringChanged();
    198193    }
     194
     195    public event EventHandler ReadOnlyChanged;
     196    protected virtual void OnReadOnlyChanged() {
     197      EventHandler handler = ReadOnlyChanged;
     198      if (handler != null) handler(this, EventArgs.Empty);
     199    }
    199200    public event EventHandler GetsCollectedChanged;
    200201    protected virtual void OnGetsCollectedChanged() {
  • stable/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs

    r17097 r17149  
    2222using System;
    2323using System.Drawing;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    26 using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Parameters {
     
    4545      get { return this.value; }
    4646      set {
     47        if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter.");
    4748        if (value != this.value) {
    4849          DeregisterValueEvents();
     
    6667    }
    6768
     69    [Storable(DefaultValue = false)]
     70    private bool readOnly;
     71    public bool ReadOnly {
     72      get { return readOnly; }
     73      set {
     74        if (value == readOnly) return;
     75        readOnly = value;
     76        OnReadOnlyChanged();
     77      }
     78    }
     79
    6880    [Storable(DefaultValue = true)]
    6981    private bool getsCollected;
     
    8496      : base(original, cloner) {
    8597      value = cloner.Clone(original.value);
     98      readOnly = original.readOnly;
    8699      getsCollected = original.getsCollected;
    87100      RegisterValueEvents();
     
    89102    public ValueLookupParameter()
    90103      : base() {
     104      this.readOnly = false;
    91105      this.Hidden = false;
    92106      this.getsCollected = true;
     
    94108    public ValueLookupParameter(string name)
    95109      : base(name) {
     110      this.readOnly = false;
    96111      this.Hidden = false;
    97112      this.getsCollected = true;
    98     }
    99     public ValueLookupParameter(string name, bool getsCollected)
    100       : base(name) {
    101       this.Hidden = false;
    102       this.getsCollected = getsCollected;
    103113    }
    104114    public ValueLookupParameter(string name, T value)
    105115      : base(name) {
    106116      this.value = value;
     117      this.readOnly = false;
    107118      this.Hidden = false;
    108119      this.getsCollected = true;
    109120      RegisterValueEvents();
    110121    }
    111     public ValueLookupParameter(string name, T value, bool getsCollected)
    112       : base(name) {
    113       this.value = value;
    114       this.Hidden = false;
    115       this.getsCollected = getsCollected;
    116       RegisterValueEvents();
    117     }
    118122    public ValueLookupParameter(string name, string description)
    119123      : base(name, description) {
     124      this.readOnly = false;
    120125      this.Hidden = false;
    121126      this.getsCollected = true;
    122     }
    123     public ValueLookupParameter(string name, string description, bool getsCollected)
    124       : base(name, description) {
    125       this.Hidden = false;
    126       this.getsCollected = getsCollected;
    127127    }
    128128    public ValueLookupParameter(string name, string description, T value)
    129129      : base(name, description) {
    130130      this.value = value;
     131      this.readOnly = false;
    131132      this.Hidden = false;
    132133      this.getsCollected = true;
    133134      RegisterValueEvents();
    134135    }
    135     public ValueLookupParameter(string name, string description, T value, bool getsCollected)
    136       : base(name, description) {
    137       this.value = value;
    138       this.Hidden = false;
    139       this.getsCollected = getsCollected;
    140       RegisterValueEvents();
    141     }
    142136    public ValueLookupParameter(string name, string description, string actualName)
    143137      : base(name, description, actualName) {
     138      this.readOnly = false;
    144139      this.Hidden = false;
    145140      this.getsCollected = true;
    146     }
    147     public ValueLookupParameter(string name, string description, string actualName, bool getsCollected)
    148       : base(name, description, actualName) {
    149       this.Hidden = false;
    150       this.getsCollected = getsCollected;
    151141    }
    152142    #endregion
     
    177167      OnToStringChanged();
    178168    }
     169    public event EventHandler ReadOnlyChanged;
     170    protected virtual void OnReadOnlyChanged() {
     171      EventHandler handler = ReadOnlyChanged;
     172      if (handler != null) handler(this, EventArgs.Empty);
     173    }
    179174    public event EventHandler GetsCollectedChanged;
    180175    protected virtual void OnGetsCollectedChanged() {
  • stable/HeuristicLab.Parameters/3.3/ValueParameter.cs

    r17097 r17149  
    2222using System;
    2323using System.Reflection;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    26 using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Parameters {
     
    4747    public ValueParameter() : base() { }
    4848    public ValueParameter(string name) : base(name) { base.Value = CreateDefaultValue(); }
    49     public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { base.Value = CreateDefaultValue(); }
    5049    public ValueParameter(string name, T value) : base(name, value) { }
    51     public ValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }
    5250    public ValueParameter(string name, string description) : base(name, description) { base.Value = CreateDefaultValue(); }
    53     public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { base.Value = CreateDefaultValue(); }
    5451    public ValueParameter(string name, string description, T value) : base(name, description, value) { }
    55     public ValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { }
    56                                                                                  
     52
    5753    protected T CreateDefaultValue() {
    5854      Type type = typeof(T);
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs

    r17097 r17149  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    2930using HeuristicLab.Optimization;
    3031using HeuristicLab.Parameters;
    31 using HEAL.Attic;
    3232
    3333namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
     
    114114    public SymbolicRegressionConstantOptimizationEvaluator()
    115115      : base() {
    116       Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "Determines how many iterations should be calculated while optimizing the constant of a symbolic expression tree (0 indicates other or default stopping criterion).", new IntValue(10), true));
    117       Parameters.Add(new FixedValueParameter<DoubleValue>(ConstantOptimizationImprovementParameterName, "Determines the relative improvement which must be achieved in the constant optimization to continue with it (0 indicates other or default stopping criterion).", new DoubleValue(0), true) { Hidden = true });
    118       Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationProbabilityParameterName, "Determines the probability that the constants are optimized", new PercentValue(1), true));
    119       Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationRowsPercentageParameterName, "Determines the percentage of the rows which should be used for constant optimization", new PercentValue(1), true));
     116      Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "Determines how many iterations should be calculated while optimizing the constant of a symbolic expression tree (0 indicates other or default stopping criterion).", new IntValue(10)));
     117      Parameters.Add(new FixedValueParameter<DoubleValue>(ConstantOptimizationImprovementParameterName, "Determines the relative improvement which must be achieved in the constant optimization to continue with it (0 indicates other or default stopping criterion).", new DoubleValue(0)) { Hidden = true });
     118      Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationProbabilityParameterName, "Determines the probability that the constants are optimized", new PercentValue(1)));
     119      Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationRowsPercentageParameterName, "Determines the percentage of the rows which should be used for constant optimization", new PercentValue(1)));
    120120      Parameters.Add(new FixedValueParameter<BoolValue>(UpdateConstantsInTreeParameterName, "Determines if the constants in the tree should be overwritten by the optimized constants.", new BoolValue(true)) { Hidden = true });
    121121      Parameters.Add(new FixedValueParameter<BoolValue>(UpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be  optimized.", new BoolValue(true)) { Hidden = true });
  • stable/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Problem.cs

    r17097 r17149  
    2323using System.Diagnostics.Contracts;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    2930using HeuristicLab.Optimization;
    3031using HeuristicLab.Parameters;
    31 using HEAL.Attic;
    3232
    3333
     
    128128      g.AddTerminalSymbols(new string[] { "Move", "Left", "Right" });
    129129      base.Encoding = new SymbolicExpressionTreeEncoding(g, 20, 10);
     130      base.Encoding.GrammarParameter.ReadOnly = true;
    130131    }
    131132
  • stable/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs

    r17097 r17149  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030using HeuristicLab.Problems.DataAnalysis;
    3131using HeuristicLab.Problems.Instances;
     
    8787      var g = new SimpleSymbolicExpressionGrammar(); // empty grammar is replaced in UpdateGrammar()
    8888      base.Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
     89      Encoding.GrammarParameter.ReadOnly = true;
    8990
    9091      UpdateGrammar();
     
    177178      }
    178179
     180      Encoding.GrammarParameter.ReadOnly = false;
    179181      Encoding.Grammar = g;
     182      Encoding.GrammarParameter.ReadOnly = true;
    180183    }
    181184    #endregion
  • stable/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs

    r17097 r17149  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    2829using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2930using HeuristicLab.Parameters;
    30 using HEAL.Attic;
    3131
    3232
  • stable/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs

    r17097 r17149  
    2424using System.Diagnostics.Contracts;
    2525using System.Linq;
     26using HEAL.Attic;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Core;
     
    2930using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    3031using HeuristicLab.Parameters;
    31 using HEAL.Attic;
    3232
    3333
     
    8888      var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar
    8989      Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
     90      Encoding.GrammarParameter.ReadOnly = true;
    9091
    9192      UpdateGrammar();
     
    110111        g.AddTerminalSymbol(string.Format("d{0}", i));
    111112
     113      Encoding.GrammarParameter.ReadOnly = false;
    112114      Encoding.Grammar = g;
     115      Encoding.GrammarParameter.ReadOnly = true;
    113116
    114117      BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits)
  • stable/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs

    r17097 r17149  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2627using HeuristicLab.Optimization;
    2728using HeuristicLab.Parameters;
    28 using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.GeneticProgramming.Robocode {
     
    8686
    8787      Encoding = new SymbolicExpressionTreeEncoding(new Grammar(), 1000, 10);
     88      Encoding.GrammarParameter.ReadOnly = true;
    8889      Encoding.FunctionArguments = 0;
    8990      Encoding.FunctionDefinitions = 0;
     
    134135    }
    135136
    136     void RobocodePathParameter_ValueChanged(object sender, System.EventArgs e) {
     137    private void RobocodePathParameter_ValueChanged(object sender, System.EventArgs e) {
    137138      EnemiesParameter.Value.RobocodePath = RobocodePathParameter.Value.Value;
    138139    }
  • stable/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs

    r17097 r17149  
    2424using System.IO;
    2525using System.Linq;
     26using HEAL.Attic;
    2627using HeuristicLab.Analysis;
    2728using HeuristicLab.Common;
     
    3233using HeuristicLab.Optimization.Operators;
    3334using HeuristicLab.Parameters;
    34 using HEAL.Attic;
    3535using HeuristicLab.PluginInfrastructure;
    3636using HeuristicLab.Problems.Instances;
     
    210210      if (oldCoordinates != null) {
    211211        Parameters.Remove(oldCoordinates);
    212         Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", oldCoordinates.Value, oldCoordinates.GetsCollected));
     212        Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", oldCoordinates.Value) { GetsCollected = oldCoordinates.GetsCollected });
    213213      }
    214214
Note: See TracChangeset for help on using the changeset viewer.