Changeset 2830


Ignore:
Timestamp:
02/19/10 02:15:10 (11 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on operators and SGA
  • improved performance
Location:
trunk/sources
Files:
13 added
1 deleted
49 edited
2 moved

Legend:

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

    r2819 r2830  
    66    ConfigMerger.exe = ConfigMerger.exe
    77    ..\documentation\License\gpl-3.0.txt = ..\documentation\License\gpl-3.0.txt
     8    HeuristicLab 3.3.vsmdi = HeuristicLab 3.3.vsmdi
    89    LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
    910    PreBuildEvent.cmd = PreBuildEvent.cmd
     
    149150Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Routing.TSP.Views-3.3", "HeuristicLab.Routing.TSP.Views\3.3\HeuristicLab.Routing.TSP.Views-3.3.csproj", "{DF2E61C4-A76D-4315-9D0B-53A077B1AC2C}"
    150151EndProject
     152Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.SGA-3.3.Tests", "HeuristicLab.SGA\3.3\Tests\HeuristicLab.SGA-3.3.Tests.csproj", "{F42F3576-7233-4B28-90F7-36AE15F30F92}"
     153EndProject
    151154Global
     155  GlobalSection(TestCaseManagementSettings) = postSolution
     156    CategoryFile = HeuristicLab 3.3.vsmdi
     157  EndGlobalSection
    152158  GlobalSection(SolutionConfigurationPlatforms) = preSolution
    153159    Debug|Any CPU = Debug|Any CPU
     
    661667    {DF2E61C4-A76D-4315-9D0B-53A077B1AC2C}.Release|x64.ActiveCfg = Release|Any CPU
    662668    {DF2E61C4-A76D-4315-9D0B-53A077B1AC2C}.Release|x86.ActiveCfg = Release|Any CPU
     669    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     670    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Debug|Any CPU.Build.0 = Debug|Any CPU
     671    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Debug|x64.ActiveCfg = Debug|Any CPU
     672    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Debug|x86.ActiveCfg = Debug|Any CPU
     673    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Release|Any CPU.ActiveCfg = Release|Any CPU
     674    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Release|Any CPU.Build.0 = Release|Any CPU
     675    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Release|x64.ActiveCfg = Release|Any CPU
     676    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Release|x86.ActiveCfg = Release|Any CPU
    663677  EndGlobalSection
    664678  GlobalSection(SolutionProperties) = preSolution
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableArray.cs

    r2790 r2830  
    6868    public ObservableArray(T[] array) {
    6969      this.array = (T[])array.Clone();
    70       OnCollectionReset(GetIndexedItems(), new IndexedItem<T>[0]);
    7170    }
    7271    public ObservableArray(IEnumerable<T> collection) {
    7372      array = collection.ToArray();
    74       OnCollectionReset(GetIndexedItems(), new IndexedItem<T>[0]);
    7573    }
    7674    #endregion
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableCollection.cs

    r2790 r2830  
    5959    public ObservableCollection(IEnumerable<T> collection) {
    6060      list = new List<T>(collection);
    61       OnItemsAdded(collection);
    6261    }
    6362    #endregion
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableDictionary.cs

    r2790 r2830  
    7979    public ObservableDictionary(IDictionary<TKey, TValue> dictionary) {
    8080      dict = new Dictionary<TKey, TValue>(dictionary);
    81       OnItemsAdded(dictionary);
    8281    }
    8382    public ObservableDictionary(int capacity, IEqualityComparer<TKey> comparer) {
     
    8685    public ObservableDictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer) {
    8786      dict = new Dictionary<TKey, TValue>(dictionary, comparer);
    88       OnItemsAdded(dictionary);
    8987    }
    9088    #endregion
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableKeyedCollection.cs

    r2790 r2830  
    6666      foreach (TItem item in collection)
    6767        dict.Add(GetKeyForItem(item), item);
    68       OnItemsAdded(collection);
    6968    }
    7069    protected ObservableKeyedCollection(int capacity, IEqualityComparer<TKey> comparer) {
     
    7675      foreach (TItem item in collection)
    7776        dict.Add(GetKeyForItem(item), item);
    78       OnItemsAdded(collection);
    7977    }
    8078    #endregion
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableList.cs

    r2790 r2830  
    7373    public ObservableList(IEnumerable<T> collection) {
    7474      list = new List<T>(collection);
    75       OnItemsAdded(GetIndexedItems());
    76       OnItemsAdded(collection);
    7775    }
    7876    #endregion
  • trunk/sources/HeuristicLab.Collections/3.3/ObservableSet.cs

    r2790 r2830  
    5151    public ObservableSet(IEnumerable<T> collection) {
    5252      set = new HashSet<T>(collection);
    53       OnItemsAdded(this);
    5453    }
    5554    public ObservableSet(IEqualityComparer<T> comparer) {
     
    5857    public ObservableSet(IEnumerable<T> collection, IEqualityComparer<T> comparer) {
    5958      set = new HashSet<T>(collection, comparer);
    60       OnItemsAdded(this);
    6159    }
    6260    #endregion
  • trunk/sources/HeuristicLab.Core/3.3/DeepCloneable.cs

    r2790 r2830  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    25 using System.Xml;
    2623using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2724
  • trunk/sources/HeuristicLab.Core/3.3/Item.cs

    r2790 r2830  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.ComponentModel;
    25 using System.Text;
    26 using System.Xml;
    2722using System.Drawing;
    28 using System.Resources;
     23using HeuristicLab.Common.Resources;
    2924using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    30 using HeuristicLab.Common.Resources;
    3125
    3226namespace HeuristicLab.Core {
     
    6155    protected virtual void OnChanged(ChangedEventArgs e) {
    6256      if ((e.RegisterChangedObject(this)) && (Changed != null))
    63           Changed(this, e);
     57        Changed(this, e);
    6458    }
    6559  }
  • trunk/sources/HeuristicLab.Core/3.3/ItemArray.cs

    r2790 r2830  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections;
    2425using System.Collections.Generic;
     
    5556    public ItemArray() : base() { }
    5657    public ItemArray(int length) : base(length) { }
    57     public ItemArray(T[] array) : base(array) { }
    58     public ItemArray(IEnumerable<T> collection) : base(collection) { }
     58    public ItemArray(T[] array) : base(array) {
     59      foreach (T item in this)
     60        item.Changed += new ChangedEventHandler(Item_Changed);
     61    }
     62    public ItemArray(IEnumerable<T> collection) : base(collection) {
     63      foreach (T item in this)
     64        item.Changed += new ChangedEventHandler(Item_Changed);
     65    }
    5966
    6067    public object Clone() {
     
    6269    }
    6370
    64     public IDeepCloneable Clone(Cloner cloner) {
    65       T[] items = new T[Length];
    66       for (int i = 0; i < items.Length; i++)
    67         items[i] = (T)cloner.Clone(this[i]);
    68       ItemArray<T> clone = (ItemArray<T>)Activator.CreateInstance(this.GetType(), new object[] { items });
     71    public virtual IDeepCloneable Clone(Cloner cloner) {
     72      ItemArray<T> clone = (ItemArray<T>)Activator.CreateInstance(this.GetType(), this.Select(x => (T)cloner.Clone(x)));
    6973      cloner.RegisterClonedObject(this, clone);
    7074      return clone;
  • trunk/sources/HeuristicLab.Core/3.3/ItemCollection.cs

    r2790 r2830  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections;
    2425using System.Collections.Generic;
     
    5657    public ItemCollection() : base() { }
    5758    public ItemCollection(int capacity) : base(capacity) { }
    58     public ItemCollection(IEnumerable<T> collection) : base(collection) { }
     59    public ItemCollection(IEnumerable<T> collection) : base(collection) {
     60      foreach (T item in this)
     61        item.Changed += new ChangedEventHandler(Item_Changed);
     62    }
    5963
    6064    public object Clone() {
     
    6266    }
    6367
    64     public IDeepCloneable Clone(Cloner cloner) {
    65       List<T> items = new List<T>();
    66       foreach (T item in this)
    67         items.Add((T)cloner.Clone(item));
    68       ItemCollection<T> clone = (ItemCollection<T>)Activator.CreateInstance(this.GetType(), items);
     68    public virtual IDeepCloneable Clone(Cloner cloner) {
     69      ItemCollection<T> clone = (ItemCollection<T>)Activator.CreateInstance(this.GetType(), this.Select(x => (T)cloner.Clone(x)));
    6970      cloner.RegisterClonedObject(this, clone);
    7071      return clone;
  • trunk/sources/HeuristicLab.Core/3.3/ItemList.cs

    r2790 r2830  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections;
    2425using System.Collections.Generic;
     
    5657    public ItemList() : base() { }
    5758    public ItemList(int capacity) : base(capacity) { }
    58     public ItemList(IEnumerable<T> collection) : base(collection) { }
     59    public ItemList(IEnumerable<T> collection) : base(collection) {
     60      foreach (T item in this)
     61        item.Changed += new ChangedEventHandler(Item_Changed);
     62    }
    5963
    6064    public object Clone() {
     
    6266    }
    6367
    64     public IDeepCloneable Clone(Cloner cloner) {
    65       List<T> items = new List<T>();
    66       foreach (T item in this)
    67         items.Add((T)cloner.Clone(item));
    68       ItemList<T> clone = (ItemList<T>)Activator.CreateInstance(this.GetType(), items);
     68    public virtual IDeepCloneable Clone(Cloner cloner) {
     69      ItemList<T> clone = (ItemList<T>)Activator.CreateInstance(this.GetType(), this.Select(x => (T)cloner.Clone(x)));
    6970      cloner.RegisterClonedObject(this, clone);
    7071      return clone;
  • trunk/sources/HeuristicLab.Core/3.3/ItemSet.cs

    r2790 r2830  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections;
    2425using System.Collections.Generic;
     
    5556
    5657    public ItemSet() : base() { }
    57     public ItemSet(IEnumerable<T> collection) : base(collection) { }
     58    public ItemSet(IEnumerable<T> collection) : base(collection) {
     59      foreach (T item in this)
     60        item.Changed += new ChangedEventHandler(Item_Changed);
     61    }
    5862
    5963    public object Clone() {
     
    6165    }
    6266
    63     public IDeepCloneable Clone(Cloner cloner) {
    64       List<T> items = new List<T>();
    65       foreach (T item in this)
    66         items.Add((T)cloner.Clone(item));
    67       ItemSet<T> clone = (ItemSet<T>)Activator.CreateInstance(this.GetType(), items);
     67    public virtual IDeepCloneable Clone(Cloner cloner) {
     68      ItemSet<T> clone = (ItemSet<T>)Activator.CreateInstance(this.GetType(), this.Select(x => (T)cloner.Clone(x)));
    6869      cloner.RegisterClonedObject(this, clone);
    6970      return clone;
  • trunk/sources/HeuristicLab.Core/3.3/NamedItem.cs

    r2793 r2830  
    7474    /// </summary>
    7575    protected NamedItem() {
    76       name = ItemName;
    77       description = ItemDescription;
     76      name = string.Empty;
     77      description = string.Empty;
    7878    }
    7979    /// <summary>
     
    8383    /// <param name="name">The name of the current instance.</param>
    8484    /// <param name="value">The value of the current instance.</param>
    85     protected NamedItem(string name)
    86       : this() {
     85    protected NamedItem(string name) {
    8786      if (name == null) throw new ArgumentNullException();
    8887      this.name = name;
     88      description = string.Empty;
    8989    }
    90     protected NamedItem(string name, string description)
    91       : this(name) {
     90    protected NamedItem(string name, string description) {
     91      if (name == null) throw new ArgumentNullException();
     92      this.name = name;
    9293      this.description = description;
    9394    }
  • trunk/sources/HeuristicLab.Core/3.3/NamedItemCollection.cs

    r2790 r2830  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections.Generic;
    2425using System.Drawing;
     
    4344    private object RestoreEvents {
    4445      get { return null; }
    45       set {
    46         foreach (T item in this) {
    47           item.NameChanging += new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
    48           item.NameChanged += new EventHandler(Item_NameChanged);
    49           item.Changed += new ChangedEventHandler(Item_Changed);
    50         }
    51       }
     46      set { RegisterItemEvents(this); }
    5247    }
    5348
    5449    public NamedItemCollection() : base() { }
    5550    public NamedItemCollection(int capacity) : base(capacity) { }
    56     public NamedItemCollection(IEnumerable<T> collection) : base(collection) { }
     51    public NamedItemCollection(IEnumerable<T> collection) : base(collection) {
     52      RegisterItemEvents(this);
     53    }
    5754
    5855    public object Clone() {
    5956      return Clone(new Cloner());
    6057    }
    61     public IDeepCloneable Clone(Cloner cloner) {
    62       List<T> items = new List<T>();
    63       foreach (T item in this)
    64         items.Add((T)cloner.Clone(item));
    65       NamedItemCollection<T> clone = (NamedItemCollection<T>)Activator.CreateInstance(this.GetType(), items);
     58    public virtual IDeepCloneable Clone(Cloner cloner) {
     59      NamedItemCollection<T> clone = (NamedItemCollection<T>)Activator.CreateInstance(this.GetType(), this.Select(x => (T)cloner.Clone(x)));
    6660      cloner.RegisterClonedObject(this, clone);
    6761      return clone;
     
    8680
    8781    protected override void OnItemsAdded(IEnumerable<T> items) {
    88       foreach (T item in items) {
    89         item.NameChanging += new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
    90         item.NameChanged += new EventHandler(Item_NameChanged);
    91         item.Changed += new ChangedEventHandler(Item_Changed);
    92       }
     82      RegisterItemEvents(items);
    9383      base.OnItemsAdded(items);
    9484    }
    9585    protected override void OnItemsRemoved(IEnumerable<T> items) {
    96       foreach (T item in items) {
    97         item.NameChanging -= new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
    98         item.NameChanged -= new EventHandler(Item_NameChanged);
    99         item.Changed -= new ChangedEventHandler(Item_Changed);
    100       }
     86      DeregisterItemEvents(items);
    10187      base.OnItemsRemoved(items);
    10288    }
     
    10894    #endregion
    10995    protected override void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) {
    110       foreach (T oldItem in oldItems) {
    111         oldItem.NameChanging -= new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
    112         oldItem.NameChanged -= new EventHandler(Item_NameChanged);
    113         oldItem.Changed -= new ChangedEventHandler(Item_Changed);
    114       }
     96      DeregisterItemEvents(oldItems);
     97      RegisterItemEvents(items);
     98      base.OnCollectionReset(items, oldItems);
     99    }
     100    protected override void OnPropertyChanged(string propertyName) {
     101      base.OnPropertyChanged(propertyName);
     102      OnChanged();
     103    }
     104
     105    private void RegisterItemEvents(IEnumerable<T> items) {
    115106      foreach (T item in items) {
    116107        item.NameChanging += new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
     
    118109        item.Changed += new ChangedEventHandler(Item_Changed);
    119110      }
    120       base.OnCollectionReset(items, oldItems);
    121111    }
    122     protected override void OnPropertyChanged(string propertyName) {
    123       base.OnPropertyChanged(propertyName);
    124       OnChanged();
     112    private void DeregisterItemEvents(IEnumerable<T> items) {
     113      foreach (T item in items) {
     114        item.NameChanging -= new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
     115        item.NameChanged -= new EventHandler(Item_NameChanged);
     116        item.Changed -= new ChangedEventHandler(Item_Changed);
     117      }
    125118    }
    126119
  • trunk/sources/HeuristicLab.Core/3.3/Scope.cs

    r2790 r2830  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    25 using System.Xml;
     22using HeuristicLab.Collections;
    2623using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    27 using HeuristicLab.Collections;
    2824
    2925namespace HeuristicLab.Core {
     
    9995      clone.Name = Name;
    10096      clone.Description = Description;
    101       clone.parent = (IScope)cloner.Clone(parent);
    102       clone.Variables = (VariableCollection)cloner.Clone(variables);
    103       clone.SubScopes = (ScopeList)cloner.Clone(subScopes);
     97      if (variables.Count > 0) clone.Variables = (VariableCollection)cloner.Clone(variables);
     98      if (subScopes.Count > 0) clone.SubScopes = (ScopeList)cloner.Clone(subScopes);
    10499      return clone;
    105100    }
  • trunk/sources/HeuristicLab.Core/3.3/ScopeList.cs

    r2790 r2830  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections;
    2422using System.Collections.Generic;
    25 using System.Collections.ObjectModel;
    26 using System.Text;
    27 using System.Drawing;
     23using System.Linq;
    2824using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Common.Resources;
    30 using HeuristicLab.Collections;
    3125
    3226namespace HeuristicLab.Core {
     
    3428  [Item("ScopeList", "Represents a list of scopes.")]
    3529  [Creatable("Test")]
    36   public class ScopeList : ItemList<IScope> {
     30  public sealed class ScopeList : ItemList<IScope> {
    3731    public ScopeList() : base() { }
    3832    public ScopeList(int capacity) : base(capacity) { }
    3933    public ScopeList(IEnumerable<IScope> collection) : base(collection) { }
     34
     35    public override IDeepCloneable Clone(Cloner cloner) {
     36      ScopeList clone = new ScopeList(this.Select(x => (IScope)cloner.Clone(x)));
     37      cloner.RegisterClonedObject(this, clone);
     38      return clone;
     39    }
    4040  }
    4141}
  • trunk/sources/HeuristicLab.Core/3.3/Variable.cs

    r2818 r2830  
    5353    public Variable()
    5454      : base("Anonymous") {
    55       Value = null;
     55      this.value = null;
    5656    }
    5757    /// <summary>
     
    6161    /// <param name="name">The name of the current instance.</param>
    6262    /// <param name="value">The value of the current instance.</param>
     63    public Variable(string name)
     64      : base(name) {
     65      this.value = null;
     66    }
     67    public Variable(string name, string description)
     68      : base(name, description) {
     69      this.value = null;
     70    }
    6371    public Variable(string name, IItem value)
    6472      : base(name) {
    65       Value = value;
     73      this.value = value;
     74      this.value.Changed += new ChangedEventHandler(Value_Changed);
     75    }
     76    public Variable(string name, string description, IItem value)
     77      : base(name, description) {
     78      this.value = value;
     79      this.value.Changed += new ChangedEventHandler(Value_Changed);
    6680    }
    6781
     
    7286    /// <returns>The cloned object as <see cref="Variable"/>.</returns>
    7387    public override IDeepCloneable Clone(Cloner cloner) {
    74       Variable clone = new Variable();
     88      Variable clone = new Variable(Name, Description, (IItem)cloner.Clone(value));
    7589      cloner.RegisterClonedObject(this, clone);
    76       clone.Name = Name;
    77       clone.Description = Description;
    78       clone.Value = (IItem)cloner.Clone(value);
    7990      return clone;
    8091    }
  • trunk/sources/HeuristicLab.Core/3.3/VariableCollection.cs

    r2790 r2830  
    2121
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2425
     
    2728  [Item("VariableCollection", "Represents a collection of variables.")]
    2829  [Creatable("Test")]
    29   public class VariableCollection : NamedItemCollection<IVariable> {
     30  public sealed class VariableCollection : NamedItemCollection<IVariable> {
    3031    public VariableCollection() : base() { }
    3132    public VariableCollection(int capacity) : base(capacity) { }
    3233    public VariableCollection(IEnumerable<IVariable> collection) : base(collection) { }
     34
     35    public override IDeepCloneable Clone(Cloner cloner) {
     36      VariableCollection clone = new VariableCollection(this.Select(x => (IVariable)cloner.Clone(x)));
     37      cloner.RegisterClonedObject(this, clone);
     38      return clone;
     39    }
    3340  }
    3441}
  • trunk/sources/HeuristicLab.Evolutionary/3.3/HeuristicLab.Evolutionary-3.3.csproj

    r2794 r2830  
    8282  <ItemGroup>
    8383    <None Include="HeuristicLabEvolutionaryPlugin.cs.frame" />
     84    <Compile Include="PopulationCreator.cs" />
    8485    <Compile Include="HeuristicLabEvolutionaryPlugin.cs" />
    8586    <Compile Include="Properties\AssemblyInfo.cs" />
  • trunk/sources/HeuristicLab.Operators.Views/3.3/AlgorithmOperatorView.Designer.cs

    r2829 r2830  
    2121
    2222namespace HeuristicLab.Operators.Views {
    23   partial class CombinedOperatorView {
     23  partial class AlgorithmOperatorView {
    2424    /// <summary>
    2525    /// Required designer variable.
     
    127127      this.operatorGraphViewHost.ViewType = null;
    128128      //
    129       // CombinedOperatorView
     129      // AlgorithmOperatorView
    130130      //
    131131      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    132132      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    133133      this.Controls.Add(this.tabControl);
    134       this.Name = "CombinedOperatorView";
     134      this.Name = "AlgorithmOperatorView";
    135135      this.Size = new System.Drawing.Size(486, 482);
    136136      this.Controls.SetChildIndex(this.tabControl, 0);
  • trunk/sources/HeuristicLab.Operators.Views/3.3/AlgorithmOperatorView.cs

    r2829 r2830  
    2929  /// </summary>
    3030  [Content(typeof(CombinedOperator), true)]
    31   public partial class CombinedOperatorView : NamedItemView {
    32     public new CombinedOperator Content {
    33       get { return (CombinedOperator)base.Content; }
     31  public partial class AlgorithmOperatorView : NamedItemView {
     32    public new AlgorithmOperator Content {
     33      get { return (AlgorithmOperator)base.Content; }
    3434      set { base.Content = value; }
    3535    }
     
    3838    /// Initializes a new instance of <see cref="ItemBaseView"/>.
    3939    /// </summary>
    40     public CombinedOperatorView() {
     40    public AlgorithmOperatorView() {
    4141      InitializeComponent();
    4242    }
     
    4545    /// </summary>
    4646    /// <param name="item">The item that should be displayed.</param>
    47     public CombinedOperatorView(CombinedOperator content)
     47    public AlgorithmOperatorView(AlgorithmOperator content)
    4848      : this() {
    4949      Content = content;
  • trunk/sources/HeuristicLab.Operators.Views/3.3/HeuristicLab.Operators.Views-3.3.csproj

    r2805 r2830  
    6868  </ItemGroup>
    6969  <ItemGroup>
    70     <Compile Include="CombinedOperatorView.cs">
     70    <Compile Include="AlgorithmOperatorView.cs">
    7171      <SubType>UserControl</SubType>
    7272    </Compile>
    73     <Compile Include="CombinedOperatorView.Designer.cs">
    74       <DependentUpon>CombinedOperatorView.cs</DependentUpon>
     73    <Compile Include="AlgorithmOperatorView.Designer.cs">
     74      <DependentUpon>AlgorithmOperatorView.cs</DependentUpon>
    7575    </Compile>
    7676    <None Include="HeuristicLabOperatorsViewsPlugin.cs.frame" />
  • trunk/sources/HeuristicLab.Operators/3.3/CombinedOperator.cs

    r2796 r2830  
    2727namespace HeuristicLab.Operators {
    2828  /// <summary>
    29   /// Operator which contains an operator graph.
     29  /// An operator which contains an operator graph.
    3030  /// </summary>
    3131  [Item("CombinedOperator", "An operator which contains an operator graph.")]
    3232  [Creatable("Test")]
    33   public sealed class CombinedOperator : SingleSuccessorOperator, IOperator {
    34     public override Image ItemImage {
    35       get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Module; }
    36     }
    37     [Storable]
    38     private OperatorGraph operatorGraph;
    39     public OperatorGraph OperatorGraph {
    40       get { return operatorGraph; }
    41     }
     33  public sealed class CombinedOperator : AlgorithmOperator, IOperator {
    4234    public new ParameterCollection Parameters {
    4335      get {
     
    5244    }
    5345
    54     public CombinedOperator()
    55       : base() {
    56       operatorGraph = new OperatorGraph();
    57     }
    58 
    59     public override IDeepCloneable Clone(Cloner cloner) {
    60       CombinedOperator clone = (CombinedOperator)base.Clone(cloner);
    61       clone.operatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
    62       return clone;
    63     }
    64 
    65     public override IExecutionSequence Apply() {
    66       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
    67       if (operatorGraph.InitialOperator != null)
    68         next.Insert(0, ExecutionContext.CreateChildContext(operatorGraph.InitialOperator));
    69       return next;
    70     }
     46    public CombinedOperator() : base() { }
    7147  }
    7248}
  • trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj

    r2818 r2830  
    9090    <Compile Include="Comparator.cs" />
    9191    <Compile Include="Assigner.cs" />
     92    <Compile Include="AlgorithmOperator.cs" />
    9293    <Compile Include="MultipleCallsOperator.cs" />
    9394    <Compile Include="Operator.cs" />
  • trunk/sources/HeuristicLab.Operators/3.3/ParallelSubScopesProcessor.cs

    r2796 r2830  
    3939        inner.Parallel = true;
    4040        for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++)
    41           inner.Add(ExecutionContext.CreateContext(Operators[i], ExecutionContext.Scope.SubScopes[i]));
     41          if (Operators[i] != null) inner.Add(ExecutionContext.CreateContext(Operators[i], ExecutionContext.Scope.SubScopes[i]));
    4242        next.Insert(0, inner);
    4343      }
  • trunk/sources/HeuristicLab.Operators/3.3/SequentialSubScopesProcessor.cs

    r2796 r2830  
    3838        ExecutionContextCollection inner = new ExecutionContextCollection();
    3939        for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++)
    40           inner.Add(ExecutionContext.CreateContext(Operators[i], ExecutionContext.Scope.SubScopes[i]));
     40          if (Operators[i] != null) inner.Add(ExecutionContext.CreateContext(Operators[i], ExecutionContext.Scope.SubScopes[i]));
    4141        next.Insert(0, inner);
    4242      }
  • trunk/sources/HeuristicLab.Operators/3.3/SubScopesRemover.cs

    r2794 r2830  
    2727namespace HeuristicLab.Operators {
    2828  /// <summary>
    29   /// An operator which removes one specified or (if not specified) all sub-scopes from the current scope.
     29  /// An operator which removes all sub-scopes or one specified sub-scope from the current scope.
    3030  /// </summary>
    31   [Item("SubScopesRemover", "An operator which removes one specified or (if not specified) all sub-scopes from the current scope.")]
     31  [Item("SubScopesRemover", "An operator which removes all sub-scopes or one specified sub-scope from the current scope.")]
    3232  [EmptyStorableClass]
    3333  [Creatable("Test")]
    34   public class SubScopesRemover : SingleSuccessorOperator {
     34  public sealed class SubScopesRemover : SingleSuccessorOperator {
     35    private ValueParameter<BoolData> RemoveAllSubScopesParameter {
     36      get { return (ValueParameter<BoolData>)Parameters["RemoveAllSubScopes"]; }
     37    }
    3538    public ValueLookupParameter<IntData> SubScopeIndexParameter {
    3639      get { return (ValueLookupParameter<IntData>)Parameters["SubScopeIndex"]; }
    3740    }
    38     protected ScopeParameter CurrentScopeParameter {
     41    private ScopeParameter CurrentScopeParameter {
    3942      get { return (ScopeParameter)Parameters["CurrentScope"]; }
     43    }
     44
     45    public bool RemoveAllSubScopes {
     46      get { return RemoveAllSubScopesParameter.Value.Value; }
     47      set { RemoveAllSubScopesParameter.Value.Value = value; }
    4048    }
    4149    public IScope CurrentScope {
     
    4553    public SubScopesRemover()
    4654      : base() {
    47       Parameters.Add(new ValueLookupParameter<IntData>("SubScopeIndex", "The index of the sub-scope which should be removed. If this parameter has no value, all sub-scopes of the current scope are removed."));
     55      Parameters.Add(new ValueParameter<BoolData>("RemoveAllSubScopes", "True if all sub-scopes of the current scope should be removed, otherwise false.", new BoolData(true)));
     56      Parameters.Add(new ValueLookupParameter<IntData>("SubScopeIndex", "The index of the sub-scope which should be removed. This parameter is ignored, if RemoveAllSubScopes is true."));
    4857      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which one or all sub-scopes should be removed."));
    4958    }
    5059
    5160    public override IExecutionSequence Apply() {
    52       IntData index = SubScopeIndexParameter.ActualValue;
    53       if (index != null)
    54         CurrentScope.SubScopes.RemoveAt(index.Value);
    55       else
     61      if (RemoveAllSubScopes)
    5662        CurrentScope.SubScopes.Clear();
     63      else {
     64        CurrentScope.SubScopes.RemoveAt(SubScopeIndexParameter.ActualValue.Value);
     65      }
    5766      return base.Apply();
    5867    }
  • trunk/sources/HeuristicLab.Permutation/3.3/CyclicCrossover.cs

    r2829 r2830  
    5454      if (parent1.Length != parent2.Length) throw new ArgumentException("CyclicCrossover: The parent permutations are of unequal length");
    5555      int length = parent1.Length;
    56       Permutation result = new Permutation(length);
     56      int[] result = new int[length];
    5757      bool[] indexCopied = new bool[length];
    5858      int[] invParent1 = new int[length];
     
    8989      } while (j < length);
    9090
    91       return result;
     91      return new Permutation(result);
    9292    }
    9393
  • trunk/sources/HeuristicLab.Permutation/3.3/InversionManipulator.cs

    r2794 r2830  
    3131  [Creatable("Test")]
    3232  public class InversionManipulator : PermutationManipulator {
    33 
    3433    /// <summary>
    3534    /// Inverts a randomly chosen part of a permutation.
     
    3837    /// <param name="permutation">The permutation to manipulate.</param>
    3938    /// <returns>The new manipulated permutation.</returns>
    40     public static Permutation Apply(IRandom random, Permutation permutation) {
    41       Permutation result = (Permutation)permutation.Clone();
     39    public static void Apply(IRandom random, Permutation permutation) {
    4240      int breakPoint1, breakPoint2;
    4341
    44       breakPoint1 = random.Next(result.Length - 1);
     42      breakPoint1 = random.Next(permutation.Length - 1);
    4543      do {
    46         breakPoint2 = random.Next(result.Length - 1);
     44        breakPoint2 = random.Next(permutation.Length - 1);
    4745      } while (breakPoint2 == breakPoint1);
    4846      if (breakPoint2 < breakPoint1) { int h = breakPoint1; breakPoint1 = breakPoint2; breakPoint2 = h; }
    4947
    50       for (int i = 0; i <= (breakPoint2 - breakPoint1); i++) {  // invert permutation between breakpoints
    51         result[breakPoint1 + i] = permutation[breakPoint2 - i];
     48      for (int i = 0; i <= (breakPoint2 - breakPoint1) / 2; i++) {  // invert permutation between breakpoints
     49        int temp = permutation[breakPoint1 + i];
     50        permutation[breakPoint1 + i] = permutation[breakPoint2 - i];
     51        permutation[breakPoint2 - i] = temp;
    5252      }
    53       return result;
    5453    }
    5554
     
    6059    /// <param name="permutation">The permutation to manipulate.</param>
    6160    /// <returns>The new manipulated permuation.</returns>
    62     protected override Permutation Manipulate(IRandom random, Permutation permutation) {
    63       return Apply(random, permutation);
     61    protected override void Manipulate(IRandom random, Permutation permutation) {
     62      Apply(random, permutation);
    6463    }
    6564  }
  • trunk/sources/HeuristicLab.Permutation/3.3/MaximalPreservativeCrossover.cs

    r2829 r2830  
    5959      if (parent1.Length < 4) throw new ArgumentException("MaximalPreservativeCrossover: The parent permutation must be at least of size 4");
    6060      int length = parent1.Length;
    61       Permutation result = new Permutation(length);
     61      int[] result = new int[length];
    6262      bool[] numberCopied = new bool[length];
    6363      int breakPoint1, breakPoint2, subsegmentLength, index;
     
    119119      } while (index != breakPoint1);
    120120
    121       return result;
     121      return new Permutation(result);
    122122    }
    123123
  • trunk/sources/HeuristicLab.Permutation/3.3/OrderCrossover.cs

    r2794 r2830  
    4545    /// <returns>The new permutation resulting from the crossover.</returns>
    4646    public static Permutation Apply(IRandom random, Permutation parent1, Permutation parent2) {
    47       Permutation result = new Permutation(parent1.Length);
     47      int[] result = new int[parent1.Length];
    4848      bool[] copied = new bool[result.Length];
    4949
     
    6666        }
    6767      }
    68       return result;
     68      return new Permutation(result);
    6969    }
    7070
  • trunk/sources/HeuristicLab.Permutation/3.3/PartiallyMatchedCrossover.cs

    r2829 r2830  
    5757      if (parent1.Length < 4) throw new ArgumentException("PartiallyMatchedCrossover: The parent permutation must be at least of size 4");
    5858      int length = parent1.Length;
    59       Permutation result = new Permutation(length); ;
     59      int[] result = new int[length];
    6060      int[] invResult = new int[length];
    6161
     
    8585      }
    8686
    87       return result;
     87      return new Permutation(result);
    8888    }
    8989
  • trunk/sources/HeuristicLab.Permutation/3.3/Permutation.cs

    r2794 r2830  
    4444    public Permutation(int[] elements)
    4545      : base(elements) {
    46       if (!Validate()) throw new ArgumentException("Elements do not represent a valid permutation.");
    4746    }
    4847    private Permutation(Permutation elements) : base(elements) { }
  • trunk/sources/HeuristicLab.Permutation/3.3/PermutationManipulator.cs

    r2794 r2830  
    4646
    4747    public sealed override IExecutionSequence Apply() {
    48       PermutationParameter.ActualValue = Manipulate(RandomParameter.ActualValue, PermutationParameter.ActualValue);
     48      Manipulate(RandomParameter.ActualValue, PermutationParameter.ActualValue);
    4949      return base.Apply();
    5050    }
    5151
    52     protected abstract Permutation Manipulate(IRandom random, Permutation permutation);
     52    protected abstract void Manipulate(IRandom random, Permutation permutation);
    5353  }
    5454}
  • trunk/sources/HeuristicLab.Routing.TSP/3.3/HeuristicLab.Routing.TSP-3.3.csproj

    r2805 r2830  
    8080    </Reference>
    8181    <Reference Include="System.Data" />
    82     <Reference Include="System.Drawing" />
    83     <Reference Include="System.Windows.Forms" />
    8482    <Reference Include="System.Xml" />
    8583  </ItemGroup>
  • trunk/sources/HeuristicLab.Routing.TSP/3.3/TSP.cs

    r2805 r2830  
    3434      get { return (ValueParameter<DoubleMatrixData>)Parameters["Coordinates"]; }
    3535    }
    36     private OperatorParameter SolutionGeneratorParameter {
    37       get { return (OperatorParameter)Parameters["SolutionGenerator"]; }
     36    private OperatorParameter SolutionCreatorParameter {
     37      get { return (OperatorParameter)Parameters["SolutionCreator"]; }
    3838    }
    39     private OperatorParameter EvaluatorParameter {
    40       get { return (OperatorParameter)Parameters["Evaluator"]; }
     39    private OperatorParameter SolutionEvaluatorParameter {
     40      get { return (OperatorParameter)Parameters["SolutionEvaluator"]; }
    4141    }
    4242
     
    4545      set { CoordinatesParameter.Value = value; }
    4646    }
    47     public IOperator SolutionGenerator {
    48       get { return SolutionGeneratorParameter.Value; }
    49       set { SolutionGeneratorParameter.Value = value; }
     47    public IOperator SolutionCreator {
     48      get { return SolutionCreatorParameter.Value; }
     49      set { SolutionCreatorParameter.Value = value; }
    5050    }
    51     public IOperator Evaluator {
    52       get { return EvaluatorParameter.Value; }
    53       set { EvaluatorParameter.Value = value; }
     51    public IOperator SolutionEvaluator {
     52      get { return SolutionEvaluatorParameter.Value; }
     53      set { SolutionEvaluatorParameter.Value = value; }
    5454    }
    5555
     
    5959      Parameters.Add(new ValueParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrixData(0, 0)));
    6060      Parameters.Add(new ValueParameter<DoubleData>("BestKnownQuality", "The quality of the best known solution of this TSP instance."));
    61       Parameters.Add(new OperatorParameter("SolutionGenerator", "The operator which should be used to generate new solutions."));
    62       Parameters.Add(new OperatorParameter("Evaluator", "The operator which should be used to evaluate solutions."));
     61      Parameters.Add(new OperatorParameter("SolutionCreator", "The operator which should be used to create new solutions."));
     62      Parameters.Add(new OperatorParameter("SolutionEvaluator", "The operator which should be used to evaluate solutions."));
    6363    }
    6464
     
    7070      RandomPermutationCreator creator = new RandomPermutationCreator();
    7171      creator.LengthParameter.Value = new IntData(cities);
    72       SolutionGenerator = creator;
     72      SolutionCreator = creator;
    7373      TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
    74       Evaluator = evaluator;
     74      SolutionEvaluator = evaluator;
    7575    }
    7676  }
  • trunk/sources/HeuristicLab.SGA/3.3

    • Property svn:ignore
      •  

        old new  
         1*.user
         2HeuristicLabSGAPlugin.cs
        13bin
        24obj
        3 *.user
  • trunk/sources/HeuristicLab.SGA/3.3/HeuristicLab.SGA-3.3.csproj

    r2546 r2830  
    7979    </Reference>
    8080    <Reference Include="System.Data" />
    81     <Reference Include="System.Drawing" />
    82     <Reference Include="System.Windows.Forms" />
    8381    <Reference Include="System.Xml" />
    8482  </ItemGroup>
    8583  <ItemGroup>
     84    <None Include="HeuristicLabSGAPlugin.cs.frame" />
     85    <Compile Include="SGAOperator.cs" />
    8686    <Compile Include="HeuristicLabSGAPlugin.cs" />
    8787    <Compile Include="Properties\AssemblyInfo.cs" />
    88     <Compile Include="SGA.cs" />
    89     <Compile Include="SGAView.cs">
    90       <SubType>UserControl</SubType>
    91     </Compile>
    92     <Compile Include="SGAView.Designer.cs">
    93       <DependentUpon>SGAView.cs</DependentUpon>
    94     </Compile>
    9588  </ItemGroup>
    9689  <ItemGroup>
    97     <ProjectReference Include="..\..\HeuristicLab.Common\3.2\HeuristicLab.Common-3.2.csproj">
    98       <Project>{1FC004FC-59AF-4249-B1B6-FF25873A20E4}</Project>
    99       <Name>HeuristicLab.Common-3.2</Name>
    100     </ProjectReference>
    101     <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
    102       <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
    103       <Name>HeuristicLab.Core.Views-3.3</Name>
     90    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
     91      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
     92      <Name>HeuristicLab.Collections-3.3</Name>
    10493    </ProjectReference>
    10594    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
     
    115104      <Name>HeuristicLab.Evolutionary-3.3</Name>
    116105    </ProjectReference>
    117     <ProjectReference Include="..\..\HeuristicLab.Logging\3.3\HeuristicLab.Logging-3.3.csproj">
    118       <Project>{72908B54-D136-4BF2-8474-25AA6CB66C92}</Project>
    119       <Name>HeuristicLab.Logging-3.3</Name>
    120     </ProjectReference>
    121     <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.2\HeuristicLab.MainForm.WindowsForms-3.2.csproj">
    122       <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
    123       <Name>HeuristicLab.MainForm.WindowsForms-3.2</Name>
    124     </ProjectReference>
    125     <ProjectReference Include="..\..\HeuristicLab.MainForm\3.2\HeuristicLab.MainForm-3.2.csproj">
    126       <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
    127       <Name>HeuristicLab.MainForm-3.2</Name>
    128     </ProjectReference>
    129106    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    130107      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
    131108      <Name>HeuristicLab.Operators-3.3</Name>
     109    </ProjectReference>
     110    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
     111      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
     112      <Name>HeuristicLab.Parameters-3.3</Name>
    132113    </ProjectReference>
    133114    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     
    139120      <Name>HeuristicLab.PluginInfrastructure</Name>
    140121    </ProjectReference>
    141     <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
    142       <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
    143       <Name>HeuristicLab.Random-3.3</Name>
    144     </ProjectReference>
    145122    <ProjectReference Include="..\..\HeuristicLab.Selection\3.3\HeuristicLab.Selection-3.3.csproj">
    146123      <Project>{2C36CD4F-E5F5-43A4-801A-201EA895FE17}</Project>
    147124      <Name>HeuristicLab.Selection-3.3</Name>
    148     </ProjectReference>
    149     <ProjectReference Include="..\..\HeuristicLab.SequentialEngine\3.3\HeuristicLab.SequentialEngine-3.3.csproj">
    150       <Project>{DC3D7072-7999-4719-B65D-3997744D5DC1}</Project>
    151       <Name>HeuristicLab.SequentialEngine-3.3</Name>
    152125    </ProjectReference>
    153126  </ItemGroup>
     
    155128    <None Include="HeuristicLab.snk" />
    156129    <None Include="Properties\AssemblyInfo.frame" />
    157   </ItemGroup>
    158   <ItemGroup>
    159     <EmbeddedResource Include="SGAView.resx">
    160       <DependentUpon>SGAView.cs</DependentUpon>
    161     </EmbeddedResource>
     130    <None Include="SGAEngine.hl" />
    162131  </ItemGroup>
    163132  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
     
    175144set Outdir=$(Outdir)
    176145
    177 call PreBuildEvent.cmd</PreBuildEvent>
     146call PreBuildEvent.cmd
     147SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\HeuristicLabSGAPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabSGAPlugin.cs"</PreBuildEvent>
    178148  </PropertyGroup>
    179149</Project>
  • trunk/sources/HeuristicLab.SGA/3.3/Properties/AssemblyInfo.frame

    r1872 r2830  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System.Reflection;
    23 using System.Runtime.CompilerServices;
    2423using System.Runtime.InteropServices;
    25 using HeuristicLab.PluginInfrastructure;
    2624
    2725// General Information about an assembly is controlled through the following
     
    3331[assembly: AssemblyCompany("")]
    3432[assembly: AssemblyProduct("HeuristicLab")]
    35 [assembly: AssemblyCopyright("(c) 2002-2008 HEAL")]
     33[assembly: AssemblyCopyright("(c) 2002-2010 HEAL")]
    3634[assembly: AssemblyTrademark("")]
    3735[assembly: AssemblyCulture("")]
     
    5452// You can specify all the values or you can default the Revision and Build Numbers
    5553// by using the '*' as shown below:
    56 [assembly: AssemblyVersion("3.3.0.$WCREV$")]
     54[assembly: AssemblyVersion("3.3.0.0")]
    5755[assembly: AssemblyFileVersion("3.3.0.$WCREV$")]
    58 [assembly: AssemblyBuildDate("$WCNOW$")]
  • trunk/sources/HeuristicLab.Selection/3.3/LeftReducer.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334    public LeftReducer() : base() { }
    3435
    35     protected override ScopeList Reduce(ScopeList scopes) {
    36       ScopeList reduced = new ScopeList();
     36    protected override List<IScope> Reduce(List<IScope> scopes) {
     37      List<IScope> reduced = new List<IScope>();
    3738      if (scopes.Count > 0) reduced.AddRange(scopes[0].SubScopes);
    3839      return reduced;
  • trunk/sources/HeuristicLab.Selection/3.3/LeftSelector.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334    public LeftSelector() : base() { }
    3435
    35     protected override ScopeList Select(ScopeList scopes) {
     36    protected override IScope[] Select(List<IScope> scopes) {
    3637      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
    3738      bool copy = CopySelectedParameter.Value.Value;
    38       ScopeList selected = new ScopeList();
     39      IScope[] selected = new IScope[count];
    3940
    4041      int j = 0;
    4142      for (int i = 0; i < count; i++) {
    4243        if (copy) {
    43           selected.Add((IScope)scopes[j].Clone());
     44          selected[i] = (IScope)scopes[j].Clone();
    4445          j++;
    4546          if (j >= scopes.Count) j = 0;
    4647        } else {
    47           selected.Add(scopes[0]);
     48          selected[i] = scopes[0];
    4849          scopes.RemoveAt(0);
    4950        }
  • trunk/sources/HeuristicLab.Selection/3.3/LinearRankSelector.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using System.Linq;
    2324using HeuristicLab.Core;
     
    3839    }
    3940
    40     protected override ScopeList Select(ScopeList scopes) {
     41    protected override IScope[] Select(List<IScope> scopes) {
    4142      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
    4243      bool copy = CopySelectedParameter.Value.Value;
     
    4445      bool maximization = MaximizationParameter.ActualValue.Value;
    4546      ItemArray<DoubleData> qualities = QualityParameter.ActualValue;
    46       ScopeList selected = new ScopeList();
     47      IScope[] selected = new IScope[count];
    4748
    4849      // create a list for each scope that contains the scope's index in the original scope list and its lots
     
    6465        }
    6566        if (copy)
    66           selected.Add((IScope)scopes[list[index].index].Clone());
     67          selected[i] = (IScope)scopes[list[index].index].Clone();
    6768        else {
    68           selected.Add(scopes[list[index].index]);
     69          selected[i] = scopes[list[index].index];
    6970          scopes.RemoveAt(list[index].index);
    7071          lotSum -= list[index].lots;
  • trunk/sources/HeuristicLab.Selection/3.3/MergingReducer.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334    public MergingReducer() : base() { }
    3435
    35     protected override ScopeList Reduce(ScopeList scopes) {
    36       ScopeList reduced = new ScopeList();
     36    protected override List<IScope> Reduce(List<IScope> scopes) {
     37      List<IScope> reduced = new List<IScope>();
    3738      for (int i = 0; i < scopes.Count; i++)
    3839        reduced.AddRange(scopes[i].SubScopes);
  • trunk/sources/HeuristicLab.Selection/3.3/ProportionalSelector.cs

    r2818 r2830  
    5151    }
    5252
    53     protected override ScopeList Select(ScopeList scopes) {
     53    protected override IScope[] Select(List<IScope> scopes) {
    5454      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
    5555      bool copy = CopySelectedParameter.Value.Value;
     
    5757      bool maximization = MaximizationParameter.ActualValue.Value;
    5858      bool windowing = WindowingParameter.Value.Value;
    59       ScopeList selected = new ScopeList();
     59      IScope[] selected = new IScope[count];
    6060
    6161      // prepare qualities for proportional selection
     
    9191        }
    9292        if (copy)
    93           selected.Add((IScope)scopes[index].Clone());
     93          selected[i] = (IScope)scopes[index].Clone();
    9494        else {
    95           selected.Add(scopes[index]);
     95          selected[i] = scopes[index];
    9696          scopes.RemoveAt(index);
    9797          qualitySum -= list[index];
  • trunk/sources/HeuristicLab.Selection/3.3/RandomSelector.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334    public RandomSelector() : base() { }
    3435
    35     protected override ScopeList Select(ScopeList scopes) {
     36    protected override IScope[] Select(List<IScope> scopes) {
    3637      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
    3738      bool copy = CopySelectedParameter.Value.Value;
    3839      IRandom random = RandomParameter.ActualValue;
    39       ScopeList selected = new ScopeList();
     40      IScope[] selected = new IScope[count];
    4041
    4142      for (int i = 0; i < count; i++) {
    4243        if (copy)
    43           selected.Add((IScope)scopes[random.Next(scopes.Count)].Clone());
     44          selected[i] = (IScope)scopes[random.Next(scopes.Count)].Clone();
    4445        else {
    4546          int index = random.Next(scopes.Count);
    46           selected.Add(scopes[index]);
     47          selected[i] = scopes[index];
    4748          scopes.RemoveAt(index);
    4849        }
  • trunk/sources/HeuristicLab.Selection/3.3/Reducer.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Operators;
     
    4647
    4748    public sealed override IExecutionSequence Apply() {
    48       ScopeList scopes = new ScopeList(CurrentScope.SubScopes);
    49       ScopeList reduced = Reduce(scopes);
     49      List<IScope> scopes = new List<IScope>(CurrentScope.SubScopes);
     50      List<IScope> reduced = Reduce(scopes);
    5051
    5152      CurrentScope.SubScopes.Clear();
     
    5556    }
    5657
    57     protected abstract ScopeList Reduce(ScopeList scopes);
     58    protected abstract List<IScope> Reduce(List<IScope> scopes);
    5859  }
    5960}
  • trunk/sources/HeuristicLab.Selection/3.3/RightReducer.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334    public RightReducer() : base() { }
    3435
    35     protected override ScopeList Reduce(ScopeList scopes) {
    36       ScopeList reduced = new ScopeList();
     36    protected override List<IScope> Reduce(List<IScope> scopes) {
     37      List<IScope> reduced = new List<IScope>();
    3738      if (scopes.Count > 0) reduced.AddRange(scopes[scopes.Count - 1].SubScopes);
    3839      return reduced;
  • trunk/sources/HeuristicLab.Selection/3.3/RightSelector.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334    public RightSelector() : base() { }
    3435
    35     protected override ScopeList Select(ScopeList scopes) {
     36    protected override IScope[] Select(List<IScope> scopes) {
    3637      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
    3738      bool copy = CopySelectedParameter.Value.Value;
    38       ScopeList selected = new ScopeList();
     39      IScope[] selected = new IScope[count];
    3940
    4041      int j = scopes.Count - 1;
    4142      for (int i = 0; i < count; i++) {
    4243        if (copy) {
    43           selected.Add((IScope)scopes[j].Clone());
     44          selected[i] = (IScope)scopes[j].Clone();
    4445          j--;
    4546          if (j < 0) j = scopes.Count - 1;
    4647        } else {
    47           selected.Add(scopes[scopes.Count - 1]);
     48          selected[i] = scopes[scopes.Count - 1];
    4849          scopes.RemoveAt(scopes.Count - 1);
    4950        }
  • trunk/sources/HeuristicLab.Selection/3.3/Selector.cs

    r2818 r2830  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    5960
    6061    public sealed override IExecutionSequence Apply() {
    61       ScopeList scopes = new ScopeList(CurrentScope.SubScopes);
    62       ScopeList selected = Select(scopes);
     62      List<IScope> scopes = new List<IScope>(CurrentScope.SubScopes);
     63      IScope[] selected = Select(scopes);
    6364
    6465      CurrentScope.SubScopes.Clear();
     
    7374    }
    7475
    75     protected abstract ScopeList Select(ScopeList scopes);
     76    protected abstract IScope[] Select(List<IScope> scopes);
    7677  }
    7778}
  • trunk/sources/HeuristicLab.Selection/3.3/TournamentSelector.cs

    r2818 r2830  
    4444    }
    4545
    46     protected override ScopeList Select(ScopeList scopes) {
     46    protected override IScope[] Select(List<IScope> scopes) {
    4747      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
    4848      bool copy = CopySelectedParameter.Value.Value;
     
    5151      List<double> qualities = QualityParameter.ActualValue.Select(x => x.Value).ToList();
    5252      int groupSize = GroupSizeParameter.ActualValue.Value;
    53       ScopeList selected = new ScopeList();
     53      IScope[] selected = new IScope[count];
    5454
    5555      for (int i = 0; i < count; i++) {
     
    6565
    6666        if (copy)
    67           selected.Add((IScope)scopes[best].Clone());
     67          selected[i] = (IScope)scopes[best].Clone();
    6868        else {
    69           selected.Add(scopes[best]);
     69          selected[i] = scopes[best];
    7070          scopes.RemoveAt(best);
    7171          qualities.RemoveAt(best);
Note: See TracChangeset for help on using the changeset viewer.