Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Optimization/3.3/Run.cs @ 3275

Last change on this file since 3275 was 3275, checked in by swagner, 14 years ago

Continued work on algorithm batch processing (#947).

File size: 2.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System.Collections.Generic;
23using HeuristicLab.Core;
24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
25
26namespace HeuristicLab.Optimization {
27  /// <summary>
28  /// Represents the parameters and results of an algorithm run.
29  /// </summary>
30  [Item("Run", "The parameters and results of an algorithm run.")]
31  [StorableClass]
32  public sealed class Run : NamedItem {
33    public override bool CanChangeName {
34      get { return false; }
35    }
36    public override bool CanChangeDescription {
37      get { return false; }
38    }
39
40    [Storable]
41    private Dictionary<string, IItem> parameters;
42    public IDictionary<string, IItem> Parameters {
43      get { return parameters; }
44    }
45    [Storable]
46    private Dictionary<string, IItem> results;
47    public IDictionary<string, IItem> Results {
48      get { return results; }
49    }
50
51    public Run()
52      : base("Anonymous") {
53      parameters = new Dictionary<string, IItem>();
54      results = new Dictionary<string, IItem>();
55    }
56    public Run(string name)
57      : base(name) {
58      parameters = new Dictionary<string, IItem>();
59      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>();
65    }
66
67    public override IDeepCloneable Clone(Cloner cloner) {
68      Run clone = new Run(Name, Description);
69      cloner.RegisterClonedObject(this, clone);
70      foreach (string key in parameters.Keys)
71        clone.parameters.Add(key, (IItem)cloner.Clone(parameters[key]));
72      foreach (string key in results.Keys)
73        clone.results.Add(key, (IItem)cloner.Clone(results[key]));
74      return clone;
75    }
76  }
77}
Note: See TracBrowser for help on using the repository browser.