Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Algorithms.Benchmarks/3.3/Benchmark.cs @ 17387

Last change on this file since 17387 was 17180, checked in by swagner, 5 years ago

#2875: Removed years in copyrights

File size: 3.0 KB
RevLine 
[7247]1#region License Information
2/* HeuristicLab
[17180]3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[7247]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;
23using System.Drawing;
24using System.Threading;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Optimization;
[16565]28using HEAL.Attic;
[7247]29
30namespace HeuristicLab.Algorithms.Benchmarks {
31  [Item("Benchmark", "Base class for benchmarks.")]
[16565]32  [StorableType("0715912F-4F40-40F6-AC08-677CC4F76819")]
[7247]33  public abstract class Benchmark : IBenchmark {
34    public virtual string ItemName {
35      get { return ItemAttribute.GetName(this.GetType()); }
36    }
37    public virtual string ItemDescription {
38      get { return ItemAttribute.GetDescription(this.GetType()); }
39    }
40    public Version ItemVersion {
41      get { return ItemAttribute.GetVersion(this.GetType()); }
42    }
43    public static Image StaticItemImage {
44      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
45    }
46    public virtual Image ItemImage {
47      get { return ItemAttribute.GetImage(this.GetType()); }
48    }
49
50    [Storable]
51    private byte[][] chunk;
52    public byte[][] ChunkData {
53      get { return chunk; }
54      set { chunk = value; }
55    }
56
57    [Storable]
58    private TimeSpan timeLimit;
59    public TimeSpan TimeLimit {
60      get { return timeLimit; }
61      set { timeLimit = value; }
62    }
63
64    [StorableConstructor]
[16565]65    protected Benchmark(StorableConstructorFlag _) { }
[7247]66    protected Benchmark(Benchmark original, Cloner cloner) {
67      cloner.RegisterClonedObject(original, this);
68    }
69    protected Benchmark() { }
70
71    public object Clone() {
72      return Clone(new Cloner());
73    }
74    public abstract IDeepCloneable Clone(Cloner cloner);
75
76    public abstract void Run(CancellationToken token, ResultCollection results);
77
78    public override string ToString() {
79      return ItemName;
80    }
81
82    public event EventHandler ItemImageChanged;
83    protected virtual void OnItemImageChanged() {
84      EventHandler handler = ItemImageChanged;
85      if (handler != null) handler(this, EventArgs.Empty);
86    }
87
88    public event EventHandler ToStringChanged;
89    protected virtual void OnToStringChanged() {
90      EventHandler handler = ToStringChanged;
91      if (handler != null) handler(this, EventArgs.Empty);
92    }
93  }
94}
Note: See TracBrowser for help on using the repository browser.