Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3280


Ignore:
Timestamp:
04/07/10 05:22:33 (15 years ago)
Author:
swagner
Message:

Continued work on algorithm batch processing (#947).

Location:
trunk/sources
Files:
1 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs

    r3275 r3280  
    168168      geneticAlgorithmMainLoop.ResultsParameter.ActualName = "Results";
    169169
    170       Initialze();
     170      Initialize();
    171171    }
    172172    [StorableConstructor]
    173     private GeneticAlgorithm(bool deserializing) : base() { }
     173    private GeneticAlgorithm(bool deserializing) : base(deserializing) { }
    174174
    175175    public override IDeepCloneable Clone(Cloner cloner) {
    176176      GeneticAlgorithm clone = (GeneticAlgorithm)base.Clone(cloner);
    177       clone.Initialze();
     177      clone.Initialize();
    178178      return clone;
    179179    }
     
    249249    #region Helpers
    250250    [StorableHook(HookType.AfterDeserialization)]
    251     private void Initialze() {
     251    private void Initialize() {
    252252      InitializeSelectors();
    253253      UpdateSelectors();
  • trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearch.cs

    r3275 r3280  
    3333
    3434namespace HeuristicLab.Algorithms.LocalSearch {
    35   [Item("LocalSearch", "A local search algorithm.")]
     35  [Item("Local Search", "A local search algorithm.")]
    3636  [Creatable("Algorithms")]
    3737  [StorableClass]
     
    111111    #endregion
    112112
    113     [StorableConstructor]
    114     private LocalSearch(bool deserializing) : base() { }
    115113    public LocalSearch()
    116114      : base() {
     
    147145      Initialize();
    148146    }
     147    [StorableConstructor]
     148    private LocalSearch(bool deserializing) : base(deserializing) { }
    149149
    150150    public override IDeepCloneable Clone(Cloner cloner) {
  • trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r3275 r3280  
    133133    #endregion
    134134
    135     [StorableConstructor]
    136     private SimulatedAnnealing(bool deserializing) : base() { }
    137135    public SimulatedAnnealing()
    138136      : base() {
     
    175173      Initialize();
    176174    }
     175    [StorableConstructor]
     176    private SimulatedAnnealing(bool deserializing) : base(deserializing) { }
    177177
    178178    public override IDeepCloneable Clone(Cloner cloner) {
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs

    r3275 r3280  
    3333
    3434namespace HeuristicLab.Algorithms.TabuSearch {
    35   [Item("TabuSearch", "A tabu search algorithm.")]
     35  [Item("Tabu Search", "A tabu search algorithm.")]
    3636  [Creatable("Algorithms")]
    3737  [StorableClass]
     
    128128    #endregion
    129129
    130     [StorableConstructor]
    131     private TabuSearch(bool deserializing) : base() { }
    132130    public TabuSearch()
    133131      : base() {
     
    169167      Initialize();
    170168    }
     169    [StorableConstructor]
     170    private TabuSearch(bool deserializing) : base(deserializing) { }
    171171
    172172    public override IDeepCloneable Clone(Cloner cloner) {
  • trunk/sources/HeuristicLab.Core/3.3/DeepCloneable.cs

    r3017 r3280  
    2929  [StorableClass]
    3030  public abstract class DeepCloneable : IDeepCloneable {
     31    protected DeepCloneable() { }
     32    [StorableConstructor]
     33    protected DeepCloneable(bool deserializing) { }
     34
    3135    /// <summary>
    3236    /// Creates a deep clone of this instance.
  • trunk/sources/HeuristicLab.Core/3.3/Engine.cs

    r3265 r3280  
    4949
    5050    public override IDeepCloneable Clone(Cloner cloner) {
     51      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
    5152      Engine clone = (Engine)base.Clone(cloner);
    5253      IOperation[] contexts = executionStack.ToArray();
  • trunk/sources/HeuristicLab.Core/3.3/Item.cs

    r3017 r3280  
    4242    }
    4343
     44    protected Item() : base() { }
     45    [StorableConstructor]
     46    protected Item(bool deserializing) : base(deserializing) { }
     47
     48
    4449    /// <summary>
    4550    /// Gets the string representation of the current instance.
  • trunk/sources/HeuristicLab.Core/3.3/NamedItem.cs

    r3017 r3280  
    9191      else this.description = description;
    9292    }
     93    [StorableConstructor]
     94    protected NamedItem(bool deserializing) : base(deserializing) { }
    9395
    9496    /// <summary>
  • trunk/sources/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs

    r3260 r3280  
    3232  [StorableClass]
    3333  public abstract class ParameterizedNamedItem : NamedItem, IParameterizedNamedItem {
     34    [Storable]
    3435    private ParameterCollection parameters;
    35     [Storable]
    3636    protected ParameterCollection Parameters {
    3737      get { return parameters; }
    38       private set {
    39         parameters = value;
    40         readOnlyParameters = null;
    41       }
    4238    }
    4339    private ReadOnlyObservableKeyedCollection<string, IParameter> readOnlyParameters;
     
    5349      name = ItemName;
    5450      description = ItemDescription;
    55       Parameters = new ParameterCollection();
     51      parameters = new ParameterCollection();
    5652      readOnlyParameters = null;
    5753    }
     
    5955      : base(name) {
    6056      description = ItemDescription;
    61       Parameters = new ParameterCollection();
     57      parameters = new ParameterCollection();
    6258      readOnlyParameters = null;
    6359    }
     
    6561      : base(name) {
    6662      description = ItemDescription;
    67       Parameters = parameters;
     63      this.parameters = parameters;
    6864      readOnlyParameters = null;
    6965    }
    7066    protected ParameterizedNamedItem(string name, string description)
    7167      : base(name, description) {
    72       Parameters = new ParameterCollection();
     68      parameters = new ParameterCollection();
    7369      readOnlyParameters = null;
    7470    }
    7571    protected ParameterizedNamedItem(string name, string description, ParameterCollection parameters)
    7672      : base(name, description) {
    77       Parameters = parameters;
     73      this.parameters = parameters;
    7874      readOnlyParameters = null;
    7975    }
     76    [StorableConstructor]
     77    protected ParameterizedNamedItem(bool deserializing) : base(deserializing) { }
    8078
    8179    public override IDeepCloneable Clone(Cloner cloner) {
    8280      ParameterizedNamedItem clone = (ParameterizedNamedItem)base.Clone(cloner);
    83       clone.Parameters = (ParameterCollection)cloner.Clone(parameters);
     81      clone.parameters = (ParameterCollection)cloner.Clone(parameters);
     82      clone.readOnlyParameters = null;
    8483      return clone;
    8584    }
     
    8786    public virtual void CollectParameterValues(IDictionary<string, IItem> values) {
    8887      foreach (IValueParameter param in parameters.OfType<IValueParameter>()) {
    89         values.Add(param.Name, param.Value != null ? (IItem)param.Value.Clone() : null);
     88        values.Add(param.Name, param.Value);
    9089        if (param.Value is IParameterizedItem) {
    9190          Dictionary<string, IItem> children = new Dictionary<string, IItem>();
  • trunk/sources/HeuristicLab.Core/3.3/Scope.cs

    r3160 r3280  
    3535      get { return parent; }
    3636      set {
    37         if (parent != null) parent.SubScopes.Remove(this);
    38         parent = value;
    39         if ((parent != null) && !parent.SubScopes.Contains(this)) parent.SubScopes.Add(this);
     37        if (parent != value) {
     38          IScope oldParent = parent;
     39          parent = null;
     40          if (oldParent != null) oldParent.SubScopes.Remove(this);
     41          parent = value;
     42          if ((parent != null) && !parent.SubScopes.Contains(this)) parent.SubScopes.Add(this);
     43        }
    4044      }
    4145    }
     
    97101      clone.Description = Description;
    98102      if (variables.Count > 0) clone.variables = (VariableCollection)cloner.Clone(variables);
    99       if (subScopes.Count > 0) clone.SubScopes = (ScopeList)cloner.Clone(subScopes);
     103      if (subScopes.Count > 0) {
     104        clone.SubScopes = (ScopeList)cloner.Clone(subScopes);
     105        foreach (IScope child in clone.SubScopes)
     106          child.Parent = clone;
     107      }
    100108      return clone;
    101109    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs

    r3277 r3280  
    3838      if (disposing) {
    3939        foreach (ListViewItem item in itemsListView.Items)
    40           ((Run)item.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged);
     40          ((IRun)item.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged);
    4141        if (components != null) components.Dispose();
    4242      }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3277 r3280  
    3131  [View("RunCollection View")]
    3232  [Content(typeof(RunCollection), true)]
    33   [Content(typeof(IObservableCollection<Run>), false)]
     33  [Content(typeof(IObservableCollection<IRun>), false)]
    3434  public partial class RunCollectionView : AsynchronousContentView {
    35     public new IObservableCollection<Run> Content {
    36       get { return (IObservableCollection<Run>)base.Content; }
     35    public new IObservableCollection<IRun> Content {
     36      get { return (IObservableCollection<IRun>)base.Content; }
    3737      set { base.Content = value; }
    3838    }
     
    4747    }
    4848
    49     public RunCollectionView(IObservableCollection<Run> content)
     49    public RunCollectionView(IObservableCollection<IRun> content)
    5050      : this() {
    5151      Content = content;
     
    5353
    5454    protected override void DeregisterContentEvents() {
    55       Content.ItemsAdded -= new CollectionItemsChangedEventHandler<Run>(Content_ItemsAdded);
    56       Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<Run>(Content_ItemsRemoved);
    57       Content.CollectionReset -= new CollectionItemsChangedEventHandler<Run>(Content_CollectionReset);
     55      Content.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);
     56      Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
     57      Content.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    5858      base.DeregisterContentEvents();
    5959    }
    6060    protected override void RegisterContentEvents() {
    6161      base.RegisterContentEvents();
    62       Content.ItemsAdded += new CollectionItemsChangedEventHandler<Run>(Content_ItemsAdded);
    63       Content.ItemsRemoved += new CollectionItemsChangedEventHandler<Run>(Content_ItemsRemoved);
    64       Content.CollectionReset += new CollectionItemsChangedEventHandler<Run>(Content_CollectionReset);
     62      Content.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);
     63      Content.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
     64      Content.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    6565    }
    6666
     
    7777        Caption += " (" + Content.GetType().Name + ")";
    7878        itemsListView.Enabled = true;
    79         foreach (Run item in Content)
     79        foreach (IRun item in Content)
    8080          AddListViewItem(CreateListViewItem(item));
    8181      }
    8282    }
    8383
    84     protected virtual ListViewItem CreateListViewItem(Run item) {
     84    protected virtual ListViewItem CreateListViewItem(IRun item) {
    8585      if (!itemsListView.SmallImageList.Images.ContainsKey(item.GetType().FullName))
    8686        itemsListView.SmallImageList.Images.Add(item.GetType().FullName, item.ItemImage);
     
    9595    protected virtual void AddListViewItem(ListViewItem listViewItem) {
    9696      itemsListView.Items.Add(listViewItem);
    97       ((Run)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
     97      ((IRun)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
    9898    }
    9999    protected virtual void RemoveListViewItem(ListViewItem listViewItem) {
    100       ((Run)listViewItem.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged);
     100      ((IRun)listViewItem.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged);
    101101      listViewItem.Remove();
    102102    }
     
    106106      }
    107107    }
    108     protected virtual IEnumerable<ListViewItem> GetListViewItemsForItem(Run item) {
     108    protected virtual IEnumerable<ListViewItem> GetListViewItemsForItem(IRun item) {
    109109      foreach (ListViewItem listViewItem in itemsListView.Items) {
    110         if (((Run)listViewItem.Tag) == item)
     110        if (((IRun)listViewItem.Tag) == item)
    111111          yield return listViewItem;
    112112      }
     
    117117      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly;
    118118      if (itemsListView.SelectedItems.Count == 1) {
    119         Run item = (Run)itemsListView.SelectedItems[0].Tag;
     119        IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
    120120        detailsGroupBox.Enabled = true;
    121121        viewHost.ViewType = null;
     
    134134        if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly) {
    135135          foreach (ListViewItem item in itemsListView.SelectedItems)
    136             Content.Remove((Run)item.Tag);
     136            Content.Remove((IRun)item.Tag);
    137137        }
    138138      }
     
    140140    protected virtual void itemsListView_DoubleClick(object sender, EventArgs e) {
    141141      if (itemsListView.SelectedItems.Count == 1) {
    142         Run item = (Run)itemsListView.SelectedItems[0].Tag;
     142        IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
    143143        IView view = MainFormManager.CreateDefaultView(item);
    144144        if (view != null) view.Show();
     
    147147    protected virtual void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
    148148      ListViewItem listViewItem = (ListViewItem)e.Item;
    149       Run item = (Run)listViewItem.Tag;
     149      IRun item = (IRun)listViewItem.Tag;
    150150      DataObject data = new DataObject();
    151151      data.SetData("Type", item.GetType());
     
    162162      e.Effect = DragDropEffects.None;
    163163      Type type = e.Data.GetData("Type") as Type;
    164       if ((!Content.IsReadOnly) && (type != null) && (typeof(Run).IsAssignableFrom(type))) {
     164      if ((!Content.IsReadOnly) && (type != null) && (typeof(IRun).IsAssignableFrom(type))) {
    165165        if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy;  // CTRL key
    166166        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    172172    protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) {
    173173      if (e.Effect != DragDropEffects.None) {
    174         Run item = e.Data.GetData("Value") as Run;
    175         if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) item = (Run)item.Clone();
     174        IRun item = e.Data.GetData("Value") as IRun;
     175        if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) item = (IRun)item.Clone();
    176176        Content.Add(item);
    177177      }
     
    183183      if (itemsListView.SelectedItems.Count > 0) {
    184184        foreach (ListViewItem item in itemsListView.SelectedItems)
    185           Content.Remove((Run)item.Tag);
     185          Content.Remove((IRun)item.Tag);
    186186        itemsListView.SelectedItems.Clear();
    187187      }
     
    190190
    191191    #region Content Events
    192     protected virtual void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<Run> e) {
    193       if (InvokeRequired)
    194         Invoke(new CollectionItemsChangedEventHandler<Run>(Content_ItemsAdded), sender, e);
     192    protected virtual void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     193      if (InvokeRequired)
     194        Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded), sender, e);
    195195      else
    196         foreach (Run item in e.Items)
     196        foreach (IRun item in e.Items)
    197197          AddListViewItem(CreateListViewItem(item));
    198198    }
    199     protected virtual void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<Run> e) {
    200       if (InvokeRequired)
    201         Invoke(new CollectionItemsChangedEventHandler<Run>(Content_ItemsRemoved), sender, e);
     199    protected virtual void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     200      if (InvokeRequired)
     201        Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved), sender, e);
    202202      else {
    203         foreach (Run item in e.Items) {
     203        foreach (IRun item in e.Items) {
    204204          foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {
    205205            RemoveListViewItem(listViewItem);
     
    209209      }
    210210    }
    211     protected virtual void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<Run> e) {
    212       if (InvokeRequired)
    213         Invoke(new CollectionItemsChangedEventHandler<Run>(Content_CollectionReset), sender, e);
     211    protected virtual void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     212      if (InvokeRequired)
     213        Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset), sender, e);
    214214      else {
    215         foreach (Run item in e.OldItems) {
     215        foreach (IRun item in e.OldItems) {
    216216          foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {
    217217            RemoveListViewItem(listViewItem);
     
    219219          }
    220220        }
    221         foreach (Run item in e.Items)
     221        foreach (IRun item in e.Items)
    222222          AddListViewItem(CreateListViewItem(item));
    223223      }
     
    230230        Invoke(new EventHandler(Item_ToStringChanged), sender, e);
    231231      else {
    232         Run item = (Run)sender;
     232        IRun item = (IRun)sender;
    233233        foreach (ListViewItem listViewItem in GetListViewItemsForItem(item))
    234234          UpdateListViewItem(listViewItem);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.Designer.cs

    r3277 r3280  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Parameters", System.Windows.Forms.HorizontalAlignment.Left);
    49       System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Results", System.Windows.Forms.HorizontalAlignment.Left);
     48      System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Results", System.Windows.Forms.HorizontalAlignment.Left);
     49      System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Parameters", System.Windows.Forms.HorizontalAlignment.Left);
    5050      this.parametersResultsGroupBox = new System.Windows.Forms.GroupBox();
    5151      this.splitContainer = new System.Windows.Forms.SplitContainer();
     
    113113            this.valueColumnHeader});
    114114      this.listView.FullRowSelect = true;
    115       listViewGroup1.Header = "Parameters";
    116       listViewGroup1.Name = "parametersGroup";
    117       listViewGroup2.Header = "Results";
    118       listViewGroup2.Name = "resultsGroup";
     115      listViewGroup1.Header = "Results";
     116      listViewGroup1.Name = "resultsGroup";
     117      listViewGroup2.Header = "Parameters";
     118      listViewGroup2.Name = "parametersGroup";
    119119      this.listView.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] {
    120120            listViewGroup1,
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r3277 r3280  
    3131  /// </summary>
    3232  [View("Run View")]
    33   [Content(typeof(Run), true)]
     33  [Content(typeof(IRun), true)]
    3434  public sealed partial class RunView : NamedItemView {
    3535    /// <summary>
     
    3838    /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
    3939    /// No own data storage present.</remarks>
    40     public new Run Content {
    41       get { return (Run)base.Content; }
     40    public new IRun Content {
     41      get { return (IRun)base.Content; }
    4242      set { base.Content = value; }
    4343    }
     
    5555    /// <remarks>Calls <see cref="VariableView()"/>.</remarks>
    5656    /// <param name="variable">The variable to represent visually.</param>
    57     public RunView(Run content)
     57    public RunView(IRun content)
    5858      : this() {
    5959      Content = content;
     
    7676    private void FillListView() {
    7777      if (!listView.SmallImageList.Images.ContainsKey("Default"))
    78         listView.SmallImageList.Images.Add("Default", HeuristicLab.Common.Resources.VS2008ImageLibrary.Class);
     78        listView.SmallImageList.Images.Add("Default", HeuristicLab.Common.Resources.VS2008ImageLibrary.Nothing);
    7979
    8080      listView.Items.Clear();
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs

    r3275 r3280  
    6464    }
    6565
     66    [Storable]
    6667    private IProblem problem;
    67     [Storable]
    68     private IProblem ProblemPersistence {
    69       get { return problem; }
    70       set {
    71         if (problem != null) DeregisterProblemEvents();
    72         problem = value;
    73         if (problem != null) RegisterProblemEvents();
    74       }
    75     }
    7668    public IProblem Problem {
    7769      get { return problem; }
     
    9183
    9284    [Storable]
     85    protected int runsCounter;
     86
     87    [Storable]
    9388    private RunCollection runs;
    9489    public RunCollection Runs {
     
    10095      executionState = ExecutionState.Stopped;
    10196      executionTime = TimeSpan.Zero;
     97      runsCounter = 0;
    10298      runs = new RunCollection();
    10399    }
     
    106102      executionState = ExecutionState.Stopped;
    107103      executionTime = TimeSpan.Zero;
     104      runsCounter = 0;
    108105      runs = new RunCollection();
    109106    }
     
    112109      executionState = ExecutionState.Stopped;
    113110      executionTime = TimeSpan.Zero;
     111      runsCounter = 0;
    114112      runs = new RunCollection();
    115113    }
     
    118116      executionState = ExecutionState.Stopped;
    119117      executionTime = TimeSpan.Zero;
     118      runsCounter = 0;
    120119      runs = new RunCollection();
    121120    }
     
    124123      executionState = ExecutionState.Stopped;
    125124      executionTime = TimeSpan.Zero;
    126       runs = new RunCollection();
     125      runsCounter = 0;
     126      runs = new RunCollection();
     127    }
     128    internal Algorithm(Algorithm algorithm, Cloner cloner)
     129      : base(algorithm.Name, algorithm.Description, (ParameterCollection)cloner.Clone(algorithm.Parameters)) {
     130      executionState = algorithm.executionState;
     131      executionTime = algorithm.executionTime;
     132      problem = (IProblem)cloner.Clone(algorithm.problem);
     133      runsCounter = algorithm.runsCounter;
     134      runs = (RunCollection)cloner.Clone(algorithm.runs);
     135      Initialize();
     136    }
     137    [StorableConstructor]
     138    protected Algorithm(bool deserializing) : base(deserializing) { }
     139
     140    [StorableHook(HookType.AfterDeserialization)]
     141    private void Initialize() {
     142      if (problem != null) RegisterProblemEvents();
    127143    }
    128144
    129145    public override IDeepCloneable Clone(Cloner cloner) {
     146      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
    130147      Algorithm clone = (Algorithm)base.Clone(cloner);
    131148      clone.executionState = executionState;
    132149      clone.executionTime = executionTime;
    133       clone.Problem = (IProblem)cloner.Clone(problem);
     150      clone.problem = (IProblem)cloner.Clone(problem);
     151      clone.runsCounter = runsCounter;
    134152      clone.runs = (RunCollection)cloner.Clone(runs);
     153      clone.Initialize();
    135154      return clone;
    136155    }
     
    143162      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused) && (ExecutionState != ExecutionState.Stopped))
    144163        throw new InvalidOperationException(string.Format("Prepare not allowed in execution state \"{0}\".", ExecutionState));
    145       if (clearRuns) runs.Clear();
     164      if (clearRuns) {
     165        runsCounter = 0;
     166        runs.Clear();
     167      }
    146168      Prepare();
    147169    }
     
    165187    public virtual void CollectResultValues(IDictionary<string, IItem> values) {
    166188      foreach (IResult result in Results)
    167         values.Add(result.Name, result.Value != null ? (IItem)result.Value.Clone() : null);
     189        values.Add(result.Name, result.Value);
    168190    }
    169191
     
    205227    public event EventHandler Stopped;
    206228    protected virtual void OnStopped() {
    207       Run run = new Run("Run (" + ExecutionTime.ToString() + ")");
    208       CollectParameterValues(run.Parameters);
    209       CollectResultValues(run.Results);
    210       runs.Add(run);
    211229      ExecutionState = ExecutionState.Stopped;
     230      runsCounter++;
     231      runs.Add(new Run(string.Format("{0} Run {1} ({2})", Name, runsCounter, ExecutionTime), this));
    212232      EventHandler handler = Stopped;
    213233      if (handler != null) handler(this, EventArgs.Empty);
  • trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs

    r3276 r3280  
    6666    }
    6767
     68    [Storable]
    6869    private IAlgorithm algorithm;
    69     [Storable]
    70     private IAlgorithm AlgorithmPersistence {
    71       get { return algorithm; }
    72       set {
    73         if (algorithm != null) DeregisterAlgorithmEvents();
    74         algorithm = value;
    75         if (algorithm != null) RegisterAlgorithmEvents();
    76       }
    77     }
    7870    public IAlgorithm Algorithm {
    7971      get { return algorithm; }
     
    113105    public BatchRun()
    114106      : base() {
     107      name = ItemName;
     108      description = ItemDescription;
    115109      executionState = ExecutionState.Stopped;
    116110      executionTime = TimeSpan.Zero;
     
    119113      stopPending = false;
    120114    }
    121     public BatchRun(string name) : base(name) {
     115    public BatchRun(string name)
     116      : base(name) {
     117      description = ItemDescription;
    122118      executionState = ExecutionState.Stopped;
    123119      executionTime = TimeSpan.Zero;
     
    126122      stopPending = false;
    127123    }
    128     public BatchRun(string name, string description) : base(name, description) {
     124    public BatchRun(string name, string description)
     125      : base(name, description) {
    129126      executionState = ExecutionState.Stopped;
    130127      executionTime = TimeSpan.Zero;
     
    133130      stopPending = false;
    134131    }
     132    [StorableConstructor]
     133    private BatchRun(bool deserializing)
     134      : base(deserializing) {
     135      stopPending = false;
     136    }
     137
     138    [StorableHook(HookType.AfterDeserialization)]
     139    private void Initialize() {
     140      if (algorithm != null) RegisterAlgorithmEvents();
     141    }
    135142
    136143    public override IDeepCloneable Clone(Cloner cloner) {
     144      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
    137145      BatchRun clone = (BatchRun)base.Clone(cloner);
    138146      clone.executionState = executionState;
    139147      clone.executionTime = executionTime;
    140       clone.Algorithm = (IAlgorithm)cloner.Clone(algorithm);
     148      clone.algorithm = (IAlgorithm)cloner.Clone(algorithm);
    141149      clone.repetitions = repetitions;
    142150      clone.runs = (RunCollection)cloner.Clone(runs);
    143151      clone.stopPending = stopPending;
     152      clone.Initialize();
    144153      return clone;
    145154    }
     
    234243      algorithm.Started += new EventHandler(Algorithm_Started);
    235244      algorithm.Stopped += new EventHandler(Algorithm_Stopped);
    236       algorithm.Runs.CollectionReset += new CollectionItemsChangedEventHandler<Run>(Algorithm_Runs_CollectionReset);
    237       algorithm.Runs.ItemsAdded += new CollectionItemsChangedEventHandler<Run>(Algorithm_Runs_ItemsAdded);
    238       algorithm.Runs.ItemsRemoved += new CollectionItemsChangedEventHandler<Run>(Algorithm_Runs_ItemsRemoved);
     245      algorithm.Runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Algorithm_Runs_CollectionReset);
     246      algorithm.Runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(Algorithm_Runs_ItemsAdded);
     247      algorithm.Runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Algorithm_Runs_ItemsRemoved);
    239248    }
    240249    private void DeregisterAlgorithmEvents() {
     
    245254      algorithm.Started -= new EventHandler(Algorithm_Started);
    246255      algorithm.Stopped -= new EventHandler(Algorithm_Stopped);
    247       algorithm.Runs.CollectionReset -= new CollectionItemsChangedEventHandler<Run>(Algorithm_Runs_CollectionReset);
    248       algorithm.Runs.ItemsAdded -= new CollectionItemsChangedEventHandler<Run>(Algorithm_Runs_ItemsAdded);
    249       algorithm.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<Run>(Algorithm_Runs_ItemsRemoved);
     256      algorithm.Runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Algorithm_Runs_CollectionReset);
     257      algorithm.Runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(Algorithm_Runs_ItemsAdded);
     258      algorithm.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Algorithm_Runs_ItemsRemoved);
    250259    }
    251260    private void Algorithm_ExceptionOccurred(object sender, EventArgs<Exception> e) {
     
    277286      }
    278287    }
    279     private void Algorithm_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<Run> e) {
     288    private void Algorithm_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    280289      Runs.RemoveRange(e.OldItems);
    281290      Runs.AddRange(e.Items);
    282291    }
    283     private void Algorithm_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<Run> e) {
     292    private void Algorithm_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    284293      Runs.AddRange(e.Items);
    285294    }
    286     private void Algorithm_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<Run> e) {
     295    private void Algorithm_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    287296      Runs.RemoveRange(e.Items);
    288297    }
  • trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs

    r3275 r3280  
    3434  [StorableClass]
    3535  public abstract class EngineAlgorithm : Algorithm {
     36    [Storable]
    3637    private OperatorGraph operatorGraph;
    37     [Storable]
    38     private OperatorGraph OperatorGraphPersistence {
    39       get { return operatorGraph; }
    40       set {
    41         if (operatorGraph != null) operatorGraph.InitialOperatorChanged -= new EventHandler(OperatorGraph_InitialOperatorChanged);
    42         operatorGraph = value;
    43         if (operatorGraph != null) operatorGraph.InitialOperatorChanged += new EventHandler(OperatorGraph_InitialOperatorChanged);
    44       }
    45     }
    4638    protected OperatorGraph OperatorGraph {
    4739      get { return operatorGraph; }
     
    4941        if (value == null) throw new ArgumentNullException();
    5042        if (value != operatorGraph) {
    51           if (operatorGraph != null) operatorGraph.InitialOperatorChanged -= new EventHandler(OperatorGraph_InitialOperatorChanged);
     43          operatorGraph.InitialOperatorChanged -= new EventHandler(OperatorGraph_InitialOperatorChanged);
    5244          operatorGraph = value;
    53           if (operatorGraph != null) operatorGraph.InitialOperatorChanged += new EventHandler(OperatorGraph_InitialOperatorChanged);
     45          operatorGraph.InitialOperatorChanged += new EventHandler(OperatorGraph_InitialOperatorChanged);
    5446          OnOperatorGraphChanged();
    5547          Prepare();
     
    6456    }
    6557
     58    [Storable]
    6659    private IEngine engine;
    67     [Storable]
    68     private IEngine EnginePersistence {
    69       get { return engine; }
    70       set {
    71         if (engine != null) DeregisterEngineEvents();
    72         engine = value;
    73         if (engine != null) RegisterEngineEvents();
    74       }
    75     }
    7660    public IEngine Engine {
    7761      get { return engine; }
     
    9781      globalScope = new Scope("Global Scope");
    9882      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    99       OperatorGraph = new OperatorGraph();
    100       InitializeEngine();
     83      operatorGraph = new OperatorGraph();
     84      Initialize();
    10185    }
    10286    protected EngineAlgorithm(string name)
     
    10488      globalScope = new Scope("Global Scope");
    10589      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    106       OperatorGraph = new OperatorGraph();
    107       InitializeEngine();
     90      operatorGraph = new OperatorGraph();
     91      Initialize();
    10892    }
    10993    protected EngineAlgorithm(string name, ParameterCollection parameters)
     
    11195      globalScope = new Scope("Global Scope");
    11296      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    113       OperatorGraph = new OperatorGraph();
    114       InitializeEngine();
     97      operatorGraph = new OperatorGraph();
     98      Initialize();
    11599    }
    116100    protected EngineAlgorithm(string name, string description)
     
    118102      globalScope = new Scope("Global Scope");
    119103      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    120       OperatorGraph = new OperatorGraph();
    121       InitializeEngine();
     104      operatorGraph = new OperatorGraph();
     105      Initialize();
    122106    }
    123107    protected EngineAlgorithm(string name, string description, ParameterCollection parameters)
     
    125109      globalScope = new Scope("Global Scope");
    126110      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    127       OperatorGraph = new OperatorGraph();
    128       InitializeEngine();
    129     }
    130 
    131     private void InitializeEngine() {
    132       if (ApplicationManager.Manager != null) {
     111      operatorGraph = new OperatorGraph();
     112      Initialize();
     113    }
     114    internal EngineAlgorithm(EngineAlgorithm algorithm, Cloner cloner)
     115      : base(algorithm, cloner) {
     116      globalScope = (IScope)cloner.Clone(algorithm.globalScope);
     117      operatorGraph = (OperatorGraph)cloner.Clone(algorithm.operatorGraph);
     118      engine = (IEngine)cloner.Clone(algorithm.engine);
     119      Initialize();
     120    }
     121    [StorableConstructor]
     122    protected EngineAlgorithm(bool deserializing) : base(deserializing) { }
     123
     124    [StorableHook(HookType.AfterDeserialization)]
     125    private void Initialize() {
     126      operatorGraph.InitialOperatorChanged += new EventHandler(OperatorGraph_InitialOperatorChanged);
     127      if ((engine == null) && (ApplicationManager.Manager != null)) {
    133128        var types = ApplicationManager.Manager.GetTypes(typeof(IEngine));
    134129        Type t = types.FirstOrDefault(x => x.Name.Equals("SequentialEngine"));
    135130        if (t == null) t = types.FirstOrDefault();
    136         if (t != null) Engine = (IEngine)Activator.CreateInstance(t);
    137       }
     131        if (t != null) engine = (IEngine)Activator.CreateInstance(t);
     132      }
     133      if (engine != null) RegisterEngineEvents();
    138134    }
    139135
     
    141137      EngineAlgorithm clone = (EngineAlgorithm)base.Clone(cloner);
    142138      clone.globalScope = (IScope)cloner.Clone(globalScope);
    143       clone.Engine = (IEngine)cloner.Clone(engine);
    144       clone.OperatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
     139      clone.engine = (IEngine)cloner.Clone(engine);
     140      clone.operatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
     141      clone.Initialize();
    145142      return clone;
    146143    }
    147144
    148145    public UserDefinedAlgorithm CreateUserDefinedAlgorithm() {
    149       UserDefinedAlgorithm algorithm = new UserDefinedAlgorithm(Name, Description);
    150       Cloner cloner = new Cloner();
    151       foreach (IParameter param in Parameters)
    152         algorithm.Parameters.Add((IParameter)cloner.Clone(param));
    153       algorithm.Problem = (IProblem)cloner.Clone(Problem);
    154       algorithm.Engine = (IEngine)cloner.Clone(engine);
    155       algorithm.OperatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
    156       return algorithm;
     146      return new UserDefinedAlgorithm(this, new Cloner());
    157147    }
    158148
  • trunk/sources/HeuristicLab.Optimization/3.3/Experiment.cs

    r3276 r3280  
    6262    }
    6363
     64    [Storable]
    6465    private OptimizerList optimizers;
    65     [Storable]
    6666    public OptimizerList Optimizers {
    6767      get { return optimizers; }
    68       private set {
    69         if (optimizers != value) {
    70           if (optimizers != null) DeregisterOptimizersEvents();
    71           optimizers = value;
    72           if (optimizers != null) RegisterOptimizersEvents();
    73           foreach (IOptimizer optimizer in optimizers)
    74             RegisterOptimizerEvents(optimizer);
    75         }
    76       }
    7768    }
    7869
     
    8778    public Experiment()
    8879      : base() {
     80      name = ItemName;
     81      description = ItemDescription;
    8982      executionState = ExecutionState.Stopped;
    9083      executionTime = TimeSpan.Zero;
    91       Optimizers = new OptimizerList();
     84      optimizers = new OptimizerList();
    9285      runs = new RunCollection();
    9386      stopPending = false;
    94     }
    95     public Experiment(string name) : base(name) {
     87      Initialize();
     88    }
     89    public Experiment(string name)
     90      : base(name) {
     91      description = ItemDescription;
    9692      executionState = ExecutionState.Stopped;
    9793      executionTime = TimeSpan.Zero;
    98       Optimizers = new OptimizerList();
     94      optimizers = new OptimizerList();
    9995      runs = new RunCollection();
    10096      stopPending = false;
    101     }
    102     public Experiment(string name, string description) : base(name, description) {
     97      Initialize();
     98    }
     99    public Experiment(string name, string description)
     100      : base(name, description) {
    103101      executionState = ExecutionState.Stopped;
    104102      executionTime = TimeSpan.Zero;
    105       Optimizers = new OptimizerList();
     103      optimizers = new OptimizerList();
    106104      runs = new RunCollection();
    107105      stopPending = false;
     106      Initialize();
     107    }
     108    [StorableConstructor]
     109    private Experiment(bool deserializing)
     110      : base(deserializing) {
     111      stopPending = false;
     112    }
     113
     114    [StorableHook(HookType.AfterDeserialization)]
     115    private void Initialize() {
     116      RegisterOptimizersEvents();
     117      foreach (IOptimizer optimizer in optimizers)
     118        RegisterOptimizerEvents(optimizer);
    108119    }
    109120
    110121    public override IDeepCloneable Clone(Cloner cloner) {
     122      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
    111123      Experiment clone = (Experiment)base.Clone(cloner);
    112124      clone.executionState = executionState;
    113125      clone.executionTime = executionTime;
    114       clone.Optimizers = (OptimizerList)cloner.Clone(optimizers);
     126      clone.optimizers = (OptimizerList)cloner.Clone(optimizers);
    115127      clone.runs = (RunCollection)cloner.Clone(runs);
    116128      clone.stopPending = stopPending;
     129      clone.Initialize();
    117130      return clone;
    118131    }
     
    244257      optimizer.Started += new EventHandler(optimizer_Started);
    245258      optimizer.Stopped += new EventHandler(optimizer_Stopped);
    246       optimizer.Runs.CollectionReset += new CollectionItemsChangedEventHandler<Run>(optimizer_Runs_CollectionReset);
    247       optimizer.Runs.ItemsAdded += new CollectionItemsChangedEventHandler<Run>(optimizer_Runs_ItemsAdded);
    248       optimizer.Runs.ItemsRemoved += new CollectionItemsChangedEventHandler<Run>(optimizer_Runs_ItemsRemoved);
     259      optimizer.Runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_CollectionReset);
     260      optimizer.Runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsAdded);
     261      optimizer.Runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsRemoved);
    249262    }
    250263    private void DeregisterOptimizerEvents(IOptimizer optimizer) {
     
    255268      optimizer.Started -= new EventHandler(optimizer_Started);
    256269      optimizer.Stopped -= new EventHandler(optimizer_Stopped);
    257       optimizer.Runs.CollectionReset -= new CollectionItemsChangedEventHandler<Run>(optimizer_Runs_CollectionReset);
    258       optimizer.Runs.ItemsAdded -= new CollectionItemsChangedEventHandler<Run>(optimizer_Runs_ItemsAdded);
    259       optimizer.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<Run>(optimizer_Runs_ItemsRemoved);
     270      optimizer.Runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_CollectionReset);
     271      optimizer.Runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsAdded);
     272      optimizer.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsRemoved);
    260273    }
    261274    private void optimizer_ExceptionOccurred(object sender, EventArgs<Exception> e) {
     
    287300      }
    288301    }
    289     private void optimizer_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<Run> e) {
     302    private void optimizer_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    290303      Runs.RemoveRange(e.OldItems);
    291304      Runs.AddRange(e.Items);
    292305    }
    293     private void optimizer_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<Run> e) {
     306    private void optimizer_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    294307      Runs.AddRange(e.Items);
    295308    }
    296     private void optimizer_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<Run> e) {
     309    private void optimizer_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    297310      Runs.RemoveRange(e.Items);
    298311    }
  • trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r3274 r3280  
    8787    <Compile Include="Algorithm.cs" />
    8888    <Compile Include="BatchRun.cs" />
     89    <Compile Include="Interfaces\IRun.cs" />
    8990    <Compile Include="OptimizerList.cs" />
    9091    <Compile Include="Experiment.cs" />
  • trunk/sources/HeuristicLab.Optimization/3.3/Run.cs

    r3275 r3280  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Core;
     
    3031  [Item("Run", "The parameters and results of an algorithm run.")]
    3132  [StorableClass]
    32   public sealed class Run : NamedItem {
    33     public override bool CanChangeName {
    34       get { return false; }
     33  public sealed class Run : NamedItem, IRun {
     34    [Storable]
     35    private IAlgorithm algorithm;
     36    public IAlgorithm Algorithm {
     37      get { return algorithm; }
    3538    }
    36     public override bool CanChangeDescription {
    37       get { return false; }
    38     }
    39 
    4039    [Storable]
    4140    private Dictionary<string, IItem> parameters;
     
    5049
    5150    public Run()
    52       : base("Anonymous") {
     51      : base() {
     52      name = ItemName;
     53      description = ItemDescription;
     54      algorithm = null;
    5355      parameters = new Dictionary<string, IItem>();
    5456      results = new Dictionary<string, IItem>();
    5557    }
    56     public Run(string name)
     58    public Run(IAlgorithm algorithm)
     59      : base() {
     60      if (algorithm == null) throw new ArgumentNullException();
     61      name = algorithm.Name + " Run (" + algorithm.ExecutionTime.ToString() + ")";
     62      description = ItemDescription;
     63      Initialize((IAlgorithm)algorithm.Clone());
     64    }
     65    public Run(string name, IAlgorithm algorithm)
    5766      : base(name) {
     67      if (algorithm == null) throw new ArgumentNullException();
     68      description = ItemDescription;
     69      Initialize((IAlgorithm)algorithm.Clone());
     70    }
     71    public Run(string name, string description, IAlgorithm algorithm)
     72      : base(name, description) {
     73      if (algorithm == null) throw new ArgumentNullException();
     74      Initialize((IAlgorithm)algorithm.Clone());
     75    }
     76
     77    private void Initialize(IAlgorithm algorithm) {
     78      this.algorithm = algorithm;
    5879      parameters = new Dictionary<string, IItem>();
    5980      results = new Dictionary<string, IItem>();
    60     }
    61     public Run(string name, string description)
    62       : base(name, description) {
    63       parameters = new Dictionary<string, IItem>();
    64       results = new Dictionary<string, IItem>();
     81      this.algorithm.CollectParameterValues(parameters);
     82      this.algorithm.CollectResultValues(results);
    6583    }
    6684
    6785    public override IDeepCloneable Clone(Cloner cloner) {
    68       Run clone = new Run(Name, Description);
    69       cloner.RegisterClonedObject(this, clone);
     86      Run clone = (Run)base.Clone(cloner);
     87      clone.algorithm = (IAlgorithm)cloner.Clone(algorithm);
    7088      foreach (string key in parameters.Keys)
    7189        clone.parameters.Add(key, (IItem)cloner.Clone(parameters[key]));
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs

    r3274 r3280  
    2828  [StorableClass]
    2929  [Item("RunCollection", "Represents a collection of runs.")]
    30   public class RunCollection : ItemCollection<Run> {
     30  public class RunCollection : ItemCollection<IRun> {
    3131    public RunCollection() : base() { }
    3232    public RunCollection(int capacity) : base(capacity) { }
    33     public RunCollection(IEnumerable<Run> collection) : base(collection) { }
     33    public RunCollection(IEnumerable<IRun> collection) : base(collection) { }
    3434
    3535    public override IDeepCloneable Clone(Cloner cloner) {
    36       RunCollection clone = new RunCollection(this.Select(x => (Run)cloner.Clone(x)));
     36      RunCollection clone = new RunCollection(this.Select(x => (IRun)cloner.Clone(x)));
    3737      cloner.RegisterClonedObject(this, clone);
    3838      return clone;
  • trunk/sources/HeuristicLab.Optimization/3.3/UserDefinedAlgorithm.cs

    r3262 r3280  
    5252    public UserDefinedAlgorithm(string name) : base(name) { }
    5353    public UserDefinedAlgorithm(string name, string description) : base(name, description) { }
     54    internal UserDefinedAlgorithm(EngineAlgorithm algorithm, Cloner cloner) : base(algorithm, cloner) { }
     55    [StorableConstructor]
     56    private UserDefinedAlgorithm(bool deserializing) : base(deserializing) { }
    5457
    5558    public event EventHandler OperatorGraphChanged;
Note: See TracChangeset for help on using the changeset viewer.