Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6934


Ignore:
Timestamp:
10/18/11 15:08:14 (13 years ago)
Author:
ascheibe
Message:

on behalf of spimming:
#1659

  • implemented abstract base class for benchmarking algorithms
  • added License information
  • corrected plugin dependencies
  • corrected descriptions
Location:
branches/Benchmarking/sources
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks.Views/3.3/BenchmarkView.Designer.cs

    r6920 r6934  
    2525    /// Required designer variable.
    2626    /// </summary>
    27     private System.ComponentModel.IContainer components = null;
    2827
    2928    #region Component Designer generated code
     
    3433    /// </summary>
    3534    private void InitializeComponent() {
    36       //System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AlgorithmView));
    37       //this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
    38       //this.problemTabPage = new System.Windows.Forms.TabPage();
    39       //this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    40       //this.openProblemButton = new System.Windows.Forms.Button();
    41       //this.newProblemButton = new System.Windows.Forms.Button();
    42       //this.parametersTabPage = new System.Windows.Forms.TabPage();
    43       //this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
    44       //this.resultsTabPage = new System.Windows.Forms.TabPage();
    45       //this.resultsView = new HeuristicLab.Optimization.Views.ResultCollectionView();
    46       //this.runsTabPage = new System.Windows.Forms.TabPage();
    47       //this.storeAlgorithmInEachRunCheckBox = new System.Windows.Forms.CheckBox();
    48       //this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();
    49       //this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    50       //((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    51       //this.tabControl.SuspendLayout();
    52       //this.problemTabPage.SuspendLayout();
    53       //this.parametersTabPage.SuspendLayout();
    54       //this.resultsTabPage.SuspendLayout();
    55       //this.runsTabPage.SuspendLayout();
    56       //this.SuspendLayout();
    57       ////
    58       //// startButton
    59       ////
    60       //this.startButton.Location = new System.Drawing.Point(0, 458);
    61       //this.toolTip.SetToolTip(this.startButton, "Start/Resume Experiment");
    62       ////
    63       //// executionTimeTextBox
    64       ////
    65       //this.executionTimeTextBox.Location = new System.Drawing.Point(542, 462);
    66       ////
    67       //// executionTimeLabel
    68       ////
    69       //this.executionTimeLabel.Location = new System.Drawing.Point(453, 465);
    70       ////
    71       //// pauseButton
    72       ////
    73       //this.pauseButton.Location = new System.Drawing.Point(30, 458);
    74       //this.toolTip.SetToolTip(this.pauseButton, "Pause Experiment");
    75       ////
    76       //// stopButton
    77       ////
    78       //this.stopButton.Location = new System.Drawing.Point(60, 458);
    79       //this.toolTip.SetToolTip(this.stopButton, "Stop Experiment");
    80       ////
    81       //// resetButton
    82       ////
    83       //this.resetButton.Location = new System.Drawing.Point(90, 458);
    84       //this.toolTip.SetToolTip(this.resetButton, "Reset Experiment");
    85       ////
    86       //// nameTextBox
    87       ////
    88       //this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    89       //this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    90       //this.nameTextBox.Location = new System.Drawing.Point(60, 0);
    91       //this.nameTextBox.Size = new System.Drawing.Size(594, 20);
    92       ////
    93       //// infoLabel
    94       ////
    95       //this.infoLabel.Location = new System.Drawing.Point(660, 3);
    96       ////
    97       //// tabControl
    98       ////
    99       //this.tabControl.AllowDrop = true;
    100       //this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    101       //      | System.Windows.Forms.AnchorStyles.Left)
    102       //      | System.Windows.Forms.AnchorStyles.Right)));
    103       //this.tabControl.Controls.Add(this.problemTabPage);
    104       //this.tabControl.Controls.Add(this.parametersTabPage);
    105       //this.tabControl.Controls.Add(this.resultsTabPage);
    106       //this.tabControl.Controls.Add(this.runsTabPage);
    107       //this.tabControl.Location = new System.Drawing.Point(0, 26);
    108       //this.tabControl.Name = "tabControl";
    109       //this.tabControl.SelectedIndex = 0;
    110       //this.tabControl.Size = new System.Drawing.Size(679, 430);
    111       //this.tabControl.TabIndex = 3;
    112       ////
    113       //// problemTabPage
    114       ////
    115       //this.problemTabPage.AllowDrop = true;
    116       //this.problemTabPage.Controls.Add(this.problemViewHost);
    117       //this.problemTabPage.Controls.Add(this.openProblemButton);
    118       //this.problemTabPage.Controls.Add(this.newProblemButton);
    119       //this.problemTabPage.Location = new System.Drawing.Point(4, 22);
    120       //this.problemTabPage.Name = "problemTabPage";
    121       //this.problemTabPage.Padding = new System.Windows.Forms.Padding(3);
    122       //this.problemTabPage.Size = new System.Drawing.Size(671, 404);
    123       //this.problemTabPage.TabIndex = 0;
    124       //this.problemTabPage.Text = "Problem";
    125       //this.problemTabPage.UseVisualStyleBackColor = true;
    126       //this.problemTabPage.DragDrop += new System.Windows.Forms.DragEventHandler(this.problemTabPage_DragDrop);
    127       //this.problemTabPage.DragEnter += new System.Windows.Forms.DragEventHandler(this.problemTabPage_DragEnterOver);
    128       //this.problemTabPage.DragOver += new System.Windows.Forms.DragEventHandler(this.problemTabPage_DragEnterOver);
    129       ////
    130       //// problemViewHost
    131       ////
    132       //this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    133       //      | System.Windows.Forms.AnchorStyles.Left)
    134       //      | System.Windows.Forms.AnchorStyles.Right)));
    135       //this.problemViewHost.Caption = "View";
    136       //this.problemViewHost.Content = null;
    137       //this.problemViewHost.Enabled = false;
    138       //this.problemViewHost.Location = new System.Drawing.Point(6, 36);
    139       //this.problemViewHost.Name = "problemViewHost";
    140       //this.problemViewHost.ReadOnly = false;
    141       //this.problemViewHost.Size = new System.Drawing.Size(659, 362);
    142       //this.problemViewHost.TabIndex = 3;
    143       //this.problemViewHost.ViewsLabelVisible = true;
    144       //this.problemViewHost.ViewType = null;
    145       ////
    146       //// openProblemButton
    147       ////
    148       //this.openProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Open;
    149       //this.openProblemButton.Location = new System.Drawing.Point(36, 6);
    150       //this.openProblemButton.Name = "openProblemButton";
    151       //this.openProblemButton.Size = new System.Drawing.Size(24, 24);
    152       //this.openProblemButton.TabIndex = 1;
    153       //this.toolTip.SetToolTip(this.openProblemButton, "Open Problem");
    154       //this.openProblemButton.UseVisualStyleBackColor = true;
    155       //this.openProblemButton.Click += new System.EventHandler(this.openProblemButton_Click);
    156       ////
    157       //// newProblemButton
    158       ////
    159       //this.newProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.NewDocument;
    160       //this.newProblemButton.Location = new System.Drawing.Point(6, 6);
    161       //this.newProblemButton.Name = "newProblemButton";
    162       //this.newProblemButton.Size = new System.Drawing.Size(24, 24);
    163       //this.newProblemButton.TabIndex = 0;
    164       //this.toolTip.SetToolTip(this.newProblemButton, "New Problem");
    165       //this.newProblemButton.UseVisualStyleBackColor = true;
    166       //this.newProblemButton.Click += new System.EventHandler(this.newProblemButton_Click);
    167       ////
    168       //// parametersTabPage
    169       ////
    170       //this.parametersTabPage.Controls.Add(this.parameterCollectionView);
    171       //this.parametersTabPage.Location = new System.Drawing.Point(4, 22);
    172       //this.parametersTabPage.Name = "parametersTabPage";
    173       //this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
    174       //this.parametersTabPage.Size = new System.Drawing.Size(671, 400);
    175       //this.parametersTabPage.TabIndex = 1;
    176       //this.parametersTabPage.Text = "Parameters";
    177       //this.parametersTabPage.UseVisualStyleBackColor = true;
    178       ////
    179       //// parameterCollectionView
    180       ////
    181       //this.parameterCollectionView.AllowEditingOfHiddenParameters = true;
    182       //this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    183       //      | System.Windows.Forms.AnchorStyles.Left)
    184       //      | System.Windows.Forms.AnchorStyles.Right)));
    185       //this.parameterCollectionView.Caption = "ParameterCollection View";
    186       //this.parameterCollectionView.Content = null;
    187       //this.parameterCollectionView.Location = new System.Drawing.Point(6, 6);
    188       //this.parameterCollectionView.Name = "parameterCollectionView";
    189       //this.parameterCollectionView.ReadOnly = false;
    190       //this.parameterCollectionView.Size = new System.Drawing.Size(659, 388);
    191       //this.parameterCollectionView.TabIndex = 0;
    192       ////
    193       //// resultsTabPage
    194       ////
    195       //this.resultsTabPage.Controls.Add(this.resultsView);
    196       //this.resultsTabPage.Location = new System.Drawing.Point(4, 22);
    197       //this.resultsTabPage.Name = "resultsTabPage";
    198       //this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3);
    199       //this.resultsTabPage.Size = new System.Drawing.Size(671, 400);
    200       //this.resultsTabPage.TabIndex = 2;
    201       //this.resultsTabPage.Text = "Results";
    202       //this.resultsTabPage.UseVisualStyleBackColor = true;
    203       ////
    204       //// resultsView
    205       ////
    206       //this.resultsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    207       //      | System.Windows.Forms.AnchorStyles.Left)
    208       //      | System.Windows.Forms.AnchorStyles.Right)));
    209       //this.resultsView.Caption = "ResultCollection View";
    210       //this.resultsView.Content = null;
    211       //this.resultsView.Location = new System.Drawing.Point(6, 6);
    212       //this.resultsView.Name = "resultsView";
    213       //this.resultsView.ReadOnly = true;
    214       //this.resultsView.Size = new System.Drawing.Size(659, 388);
    215       //this.resultsView.TabIndex = 0;
    216       ////
    217       //// runsTabPage
    218       ////
    219       //this.runsTabPage.Controls.Add(this.storeAlgorithmInEachRunCheckBox);
    220       //this.runsTabPage.Controls.Add(this.runsView);
    221       //this.runsTabPage.Location = new System.Drawing.Point(4, 22);
    222       //this.runsTabPage.Name = "runsTabPage";
    223       //this.runsTabPage.Padding = new System.Windows.Forms.Padding(3);
    224       //this.runsTabPage.Size = new System.Drawing.Size(671, 400);
    225       //this.runsTabPage.TabIndex = 3;
    226       //this.runsTabPage.Text = "Runs";
    227       //this.runsTabPage.UseVisualStyleBackColor = true;
    228       ////
    229       //// storeAlgorithmInEachRunCheckBox
    230       ////
    231       //this.storeAlgorithmInEachRunCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    232       //this.storeAlgorithmInEachRunCheckBox.AutoSize = true;
    233       //this.storeAlgorithmInEachRunCheckBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
    234       //this.storeAlgorithmInEachRunCheckBox.Checked = true;
    235       //this.storeAlgorithmInEachRunCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
    236       //this.storeAlgorithmInEachRunCheckBox.Location = new System.Drawing.Point(503, 6);
    237       //this.storeAlgorithmInEachRunCheckBox.Name = "storeAlgorithmInEachRunCheckBox";
    238       //this.storeAlgorithmInEachRunCheckBox.Size = new System.Drawing.Size(161, 17);
    239       //this.storeAlgorithmInEachRunCheckBox.TabIndex = 1;
    240       //this.storeAlgorithmInEachRunCheckBox.Text = "&Store Algorithm in each Run:";
    241       //this.toolTip.SetToolTip(this.storeAlgorithmInEachRunCheckBox, "Check to store a copy of the algorithm in each run.");
    242       //this.storeAlgorithmInEachRunCheckBox.UseVisualStyleBackColor = true;
    243       //this.storeAlgorithmInEachRunCheckBox.CheckedChanged += new System.EventHandler(this.storeAlgorithmInEachRunCheckBox_CheckedChanged);
    244       ////
    245       //// runsView
    246       ////
    247       //this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    248       //      | System.Windows.Forms.AnchorStyles.Left)
    249       //      | System.Windows.Forms.AnchorStyles.Right)));
    250       //this.runsView.Caption = "RunCollection View";
    251       //this.runsView.Content = null;
    252       //this.runsView.Location = new System.Drawing.Point(6, 6);
    253       //this.runsView.Name = "runsView";
    254       //this.runsView.ReadOnly = false;
    255       //this.runsView.Size = new System.Drawing.Size(659, 388);
    256       //this.runsView.TabIndex = 0;
    257       ////
    258       //// openFileDialog
    259       ////
    260       //this.openFileDialog.DefaultExt = "hl";
    261       //this.openFileDialog.FileName = "Problem";
    262       //this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*";
    263       //this.openFileDialog.Title = "Open Problem";
    264       ////
    265       //// AlgorithmView
    266       ////
    267       //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    268       //this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    269       //this.Controls.Add(this.tabControl);
    270       //this.Name = "AlgorithmView";
    271       //this.Size = new System.Drawing.Size(679, 482);
    272       //this.Controls.SetChildIndex(this.executionTimeLabel, 0);
    273       //this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
    274       //this.Controls.SetChildIndex(this.resetButton, 0);
    275       //this.Controls.SetChildIndex(this.tabControl, 0);
    276       //this.Controls.SetChildIndex(this.stopButton, 0);
    277       //this.Controls.SetChildIndex(this.pauseButton, 0);
    278       //this.Controls.SetChildIndex(this.startButton, 0);
    279       //this.Controls.SetChildIndex(this.infoLabel, 0);
    280       //this.Controls.SetChildIndex(this.nameLabel, 0);
    281       //this.Controls.SetChildIndex(this.nameTextBox, 0);
    282       //((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    283       //this.tabControl.ResumeLayout(false);
    284       //this.problemTabPage.ResumeLayout(false);
    285       //this.parametersTabPage.ResumeLayout(false);
    286       //this.resultsTabPage.ResumeLayout(false);
    287       //this.runsTabPage.ResumeLayout(false);
    288       //this.runsTabPage.PerformLayout();
    289       //this.ResumeLayout(false);
    290       //this.PerformLayout();
    29135
    29236    }
    29337
    29438    #endregion
    295 
    296     //protected HeuristicLab.MainForm.WindowsForms.DragOverTabControl tabControl;
    297     //protected System.Windows.Forms.TabPage parametersTabPage;
    298     //protected System.Windows.Forms.TabPage problemTabPage;
    299     //protected HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
    300     //protected HeuristicLab.MainForm.WindowsForms.ViewHost problemViewHost;
    301     //protected System.Windows.Forms.Button newProblemButton;
    302     //protected System.Windows.Forms.Button openProblemButton;
    303     //protected System.Windows.Forms.OpenFileDialog openFileDialog;
    304     //protected System.Windows.Forms.TabPage resultsTabPage;
    305     //protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView;
    306     //protected System.Windows.Forms.TabPage runsTabPage;
    307     //protected RunCollectionView runsView;
    308     //protected System.Windows.Forms.CheckBox storeAlgorithmInEachRunCheckBox;
    30939  }
    31040}
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks.Views/3.3/BenchmarkView.cs

    r6920 r6934  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    2522using System.Windows.Forms;
    26 using HeuristicLab.Common;
    27 using HeuristicLab.Core;
    28 using HeuristicLab.Core.Views;
    2923using HeuristicLab.MainForm;
    30 using HeuristicLab.PluginInfrastructure;
    31 using HeuristicLab.Optimization;
    3224using HeuristicLab.Optimization.Views;
    3325
     
    3830  [Content(typeof(Linpack), true)]
    3931  public partial class BenchmarkView : AlgorithmView {
    40     //private TypeSelectorDialog problemTypeSelectorDialog;
    4132    public BenchmarkView() {
    4233      InitializeComponent();
     
    4435      tabControl.TabPages.Remove(this.parametersTabPage);
    4536    }
    46 
    47     //public new IAlgorithm Content {
    48     //  get { return (IAlgorithm)base.Content; }
    49     //  set { base.Content = value; }
    50     //}
    51 
    52     //protected override void Dispose(bool disposing) {
    53     //  if (disposing) {
    54     //    if (problemTypeSelectorDialog != null) problemTypeSelectorDialog.Dispose();
    55     //    if (components != null) components.Dispose();
    56     //  }
    57     //  base.Dispose(disposing);
    58     //}
    59 
    60     //protected override void OnInitialized(EventArgs e) {
    61     //  // Set order of tab pages according to z order.
    62     //  // NOTE: This is required due to a bug in the VS designer.
    63     //  List<Control> tabPages = new List<Control>();
    64     //  for (int i = 0; i < tabControl.Controls.Count; i++) {
    65     //    tabPages.Add(tabControl.Controls[i]);
    66     //  }
    67     //  tabControl.Controls.Clear();
    68     //  foreach (Control control in tabPages)
    69     //    tabControl.Controls.Add(control);
    70 
    71     //  base.OnInitialized(e);
    72     //}
    73 
    74     //protected override void DeregisterContentEvents() {
    75     //  Content.ProblemChanged -= new EventHandler(Content_ProblemChanged);
    76     //  Content.StoreAlgorithmInEachRunChanged -= new EventHandler(Content_StoreAlgorithmInEachRunChanged);
    77     //  base.DeregisterContentEvents();
    78     //}
    79     //protected override void RegisterContentEvents() {
    80     //  base.RegisterContentEvents();
    81     //  Content.ProblemChanged += new EventHandler(Content_ProblemChanged);
    82     //  Content.StoreAlgorithmInEachRunChanged += new EventHandler(Content_StoreAlgorithmInEachRunChanged);
    83     //}
    84 
    85     //protected override void OnContentChanged() {
    86     //  base.OnContentChanged();
    87     //  if (Content == null) {
    88     //    parameterCollectionView.Content = null;
    89     //    problemViewHost.Content = null;
    90     //    resultsView.Content = null;
    91     //    runsView.Content = null;
    92     //    storeAlgorithmInEachRunCheckBox.Checked = true;
    93     //  } else {
    94     //    parameterCollectionView.Content = Content.Parameters;
    95     //    problemViewHost.ViewType = null;
    96     //    problemViewHost.Content = Content.Problem;
    97     //    resultsView.Content = Content.Results.AsReadOnly();
    98     //    runsView.Content = Content.Runs;
    99     //    storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun;
    100     //  }
    101     //}
    102 
    103     //protected override void SetEnabledStateOfControls() {
    104     //  base.SetEnabledStateOfControls();
    105     //  parameterCollectionView.Enabled = Content != null;
    106     //  newProblemButton.Enabled = Content != null && !ReadOnly;
    107     //  openProblemButton.Enabled = Content != null && !ReadOnly;
    108     //  problemViewHost.Enabled = Content != null;
    109     //  resultsView.Enabled = Content != null;
    110     //  runsView.Enabled = Content != null;
    111     //  storeAlgorithmInEachRunCheckBox.Enabled = Content != null && !ReadOnly;
    112     //}
    113 
    114     //protected override void OnClosed(FormClosedEventArgs e) {
    115     //  if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) {
    116     //    //The content must be stopped if no other view showing the content is available
    117     //    var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>();
    118     //    if (!optimizers.Contains(Content)) {
    119     //      var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers);
    120     //      if (!nestedOptimizers.Contains(Content)) Content.Stop();
    121     //    }
    122     //  }
    123     //  base.OnClosed(e);
    124     //}
    125 
    126     //#region Content Events
    127     //protected override void Content_Prepared(object sender, EventArgs e) {
    128     //  if (InvokeRequired)
    129     //    Invoke(new EventHandler(Content_Prepared), sender, e);
    130     //  else {
    131     //    base.Content_Prepared(sender, e);
    132     //    resultsView.Content = Content.Results.AsReadOnly();
    133     //  }
    134     //}
    135 
    136     //protected virtual void Content_ProblemChanged(object sender, EventArgs e) {
    137     //  if (InvokeRequired)
    138     //    Invoke(new EventHandler(Content_ProblemChanged), sender, e);
    139     //  else {
    140     //    problemViewHost.ViewType = null;
    141     //    problemViewHost.Content = Content.Problem;
    142     //  }
    143     //}
    144     //protected virtual void Content_StoreAlgorithmInEachRunChanged(object sender, EventArgs e) {
    145     //  if (InvokeRequired)
    146     //    Invoke(new EventHandler(Content_StoreAlgorithmInEachRunChanged), sender, e);
    147     //  else
    148     //    storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun;
    149     //}
    150     //#endregion
    151 
    152     //#region Control Events
    153     //protected virtual void newProblemButton_Click(object sender, EventArgs e) {
    154     //  if (problemTypeSelectorDialog == null) {
    155     //    problemTypeSelectorDialog = new TypeSelectorDialog();
    156     //    problemTypeSelectorDialog.Caption = "Select Problem";
    157     //    problemTypeSelectorDialog.TypeSelector.Caption = "Available Problems";
    158     //    problemTypeSelectorDialog.TypeSelector.Configure(Content.ProblemType, false, true);
    159     //  }
    160     //  if (problemTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    161     //    try {
    162     //      Content.Problem = (IProblem)problemTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    163     //    }
    164     //    catch (Exception ex) {
    165     //      ErrorHandling.ShowErrorDialog(this, ex);
    166     //    }
    167     //  }
    168     //}
    169     //protected virtual void openProblemButton_Click(object sender, EventArgs e) {
    170     //  openFileDialog.Title = "Open Problem";
    171     //  if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    172     //    newProblemButton.Enabled = openProblemButton.Enabled = false;
    173     //    problemViewHost.Enabled = false;
    174 
    175     //    ContentManager.LoadAsync(openFileDialog.FileName, delegate(IStorableContent content, Exception error) {
    176     //      try {
    177     //        if (error != null) throw error;
    178     //        IProblem problem = content as IProblem;
    179     //        if (problem == null)
    180     //          Invoke(new Action(() =>
    181     //            MessageBox.Show(this, "The selected file does not contain a problem.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error)));
    182     //        else if (!Content.ProblemType.IsInstanceOfType(problem))
    183     //          Invoke(new Action(() =>
    184     //            MessageBox.Show(this, "The selected file contains a problem type which is not supported by this algorithm.", "Invalid Problem Type", MessageBoxButtons.OK, MessageBoxIcon.Error)));
    185     //        else
    186     //          Content.Problem = problem;
    187     //      }
    188     //      catch (Exception ex) {
    189     //        Invoke(new Action(() => ErrorHandling.ShowErrorDialog(this, ex)));
    190     //      }
    191     //      finally {
    192     //        Invoke(new Action(delegate() {
    193     //          problemViewHost.Enabled = true;
    194     //          newProblemButton.Enabled = openProblemButton.Enabled = true;
    195     //        }));
    196     //      }
    197     //    });
    198     //  }
    199     //}
    200     //protected virtual void storeAlgorithmInEachRunCheckBox_CheckedChanged(object sender, EventArgs e) {
    201     //  if (Content != null) Content.StoreAlgorithmInEachRun = storeAlgorithmInEachRunCheckBox.Checked;
    202     //}
    203     //protected virtual void problemTabPage_DragEnterOver(object sender, DragEventArgs e) {
    204     //  e.Effect = DragDropEffects.None;
    205     //  if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.ProblemType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) {
    206     //    if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    207     //    else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
    208     //    else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
    209     //    else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
    210     //    else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
    211     //  }
    212     //}
    213     //protected virtual void problemTabPage_DragDrop(object sender, DragEventArgs e) {
    214     //  if (e.Effect != DragDropEffects.None) {
    215     //    IProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IProblem;
    216     //    if (e.Effect.HasFlag(DragDropEffects.Copy)) problem = (IProblem)problem.Clone();
    217     //    Content.Problem = problem;
    218     //  }
    219     //}
    220     //#endregion
    22137  }
    22238}
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks.Views/3.3/HeuristicLab.Algorithms.Benchmarks.Views-3.3.csproj

    r6920 r6934  
    3838  </PropertyGroup>
    3939  <ItemGroup>
     40    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     41    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     42    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     43    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     44    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     45    <Reference Include="HeuristicLab.Problems.DataAnalysis.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    4046    <Reference Include="System" />
    4147    <Reference Include="System.Core" />
     48    <Reference Include="System.Drawing" />
    4249    <Reference Include="System.Windows.Forms" />
    4350    <Reference Include="System.Xml.Linq" />
     
    6572    <ProjectReference Include="..\..\HeuristicLab.Algorithms.Benchmarks\3.3\HeuristicLab.Algorithms.Benchmarks-3.3.csproj">
    6673      <Project>{068C70A7-8CAF-4AB6-8721-4564D62292BC}</Project>
    67       <Name>HeuristicLab.Algorithms.Benchmark.3.3</Name>
     74      <Name>HeuristicLab.Algorithms.Benchmarks-3.3</Name>
    6875    </ProjectReference>
    6976    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
     
    103110      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    104111    </ProjectReference>
     112    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.csproj">
     113      <Project>{BF1E4DF4-A4CC-451F-9D50-303F405E265E}</Project>
     114      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4</Name>
     115    </ProjectReference>
     116  </ItemGroup>
     117  <ItemGroup>
     118    <EmbeddedResource Include="BenchmarkView.resx">
     119      <DependentUpon>BenchmarkView.cs</DependentUpon>
     120    </EmbeddedResource>
    105121  </ItemGroup>
    106122  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks.Views/3.3/Plugin.cs.frame

    r6920 r6934  
    2626  /// Plugin class for HeuristicLab.Algorithms.Benchmarks plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Algorithms.Benchmarks.Views", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.1.$WCREV$")]
     28  [Plugin("HeuristicLab.Algorithms.Benchmarks.Views", "Provides views for benchmarking algorithms.", "3.3.5.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Algorithms.Benchmarks.Views-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Algorithms.Benchmarks", "3.3")]
    3031  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3132  [PluginDependency("HeuristicLab.Common", "3.3")]
    32   [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
    3333  [PluginDependency("HeuristicLab.Core", "3.3")]
    34   [PluginDependency("HeuristicLab.Data", "3.3")]
    35   [PluginDependency("HeuristicLab.Operators", "3.3")]
     34  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
     35  [PluginDependency("HeuristicLab.MainForm", "3.3")]
     36  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    3637  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    37   [PluginDependency("HeuristicLab.Parameters", "3.3")]
    38   [PluginDependency("HeuristicLab.Persistence", "3.3")]
     38  [PluginDependency("HeuristicLab.Optimization.Views", "3.3")]
    3939  public class HeuristicLabAlgorithmsBenchmarksViewsPlugin : PluginBase {
    4040  }
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks/3.3/Dhrystone.cs

    r6920 r6934  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 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;
    223using System.Diagnostics;
    3 using System.Threading;
    4 using System.Threading.Tasks;
    524using HeuristicLab.Common;
    625using HeuristicLab.Core;
     
    1029
    1130namespace HeuristicLab.Algorithms.Benchmarks {
    12   [Item("Dhrystone Algorithm", "A Dhrystone benchmark algorithm.")]
     31  [Item("Dhrystone Algorithm", "Dhrystone benchmarking algorithm.")]
    1332  [Creatable("Benchmarks")]
    1433  [StorableClass]
    15   public class Dhrystone : Algorithm {
    16     private DateTime lastUpdateTime;
    17 
    18     [Storable]
    19     private ResultCollection results;
     34  public class Dhrystone : Benchmark {
    2035
    2136    #region Benchmark Fields
     
    4661    #endregion
    4762
    48     #region Properties
    49 
    50     public override ResultCollection Results {
    51       get { return results; }
    52     }
    53 
    54     #endregion
    55 
    5663    #region Costructors
    5764
    5865    public Dhrystone()
    5966      : base() {
    60       results = new ResultCollection();
     67
    6168    }
    6269
    6370    private Dhrystone(Dhrystone original, Cloner cloner)
    6471      : base(original, cloner) {
    65       results = new ResultCollection();
    66     }
    67 
    68     #endregion
     72
     73    }
     74
     75    #endregion
     76
     77    #region IDeepClonable Members
    6978
    7079    public override IDeepCloneable Clone(Cloner cloner) {
     
    7281    }
    7382
    74     public override void Prepare() {
    75       results.Clear();
    76       OnPrepared();
    77     }
    78 
    79     public override void Start() {
    80       var cancellationTokenSource = new CancellationTokenSource();
    81       OnStarted();
    82       Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
    83       task.ContinueWith(t => {
    84         try {
    85           t.Wait();
    86         }
    87         catch (AggregateException ex) {
    88           try {
    89             ex.Flatten().Handle(x => x is OperationCanceledException);
    90           }
    91           catch (AggregateException remaining) {
    92             if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
    93             else OnExceptionOccurred(remaining);
    94           }
    95         }
    96         cancellationTokenSource.Dispose();
    97         cancellationTokenSource = null;
    98         OnStopped();
    99       });
    100     }
    101 
    102     private void Run(object state) {
    103       CancellationToken cancellationToken = (CancellationToken)state;
    104       lastUpdateTime = DateTime.Now;
    105       System.Timers.Timer timer = new System.Timers.Timer(250);
    106       timer.AutoReset = true;
    107       timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
    108       timer.Start();
    109       try {
    110         RunBenchmark();
    111       }
    112       finally {
    113         timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
    114         timer.Stop();
    115         ExecutionTime += DateTime.Now - lastUpdateTime;
    116       }
    117 
    118       cancellationToken.ThrowIfCancellationRequested();
    119     }
    120 
    121     private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
    122       System.Timers.Timer timer = (System.Timers.Timer)sender;
    123       timer.Enabled = false;
    124       DateTime now = DateTime.Now;
    125       ExecutionTime += now - lastUpdateTime;
    126       lastUpdateTime = now;
    127       timer.Enabled = true;
    128     }
    129 
    130     #region Dhrystone Benchmark
    131 
    132     private void RunBenchmark() {
     83    #endregion
     84
     85    #region Benchmark Methods
     86
     87    protected override void RunBenchmark() {
    13388      int Int_Loc_1;
    13489      int Int_Loc_2;
     
    162117      }
    163118
    164       //System.Console.WriteLine("Execution start, " + Number_Of_Runs + " runs through Dhrystone");
    165119      Stopwatch sw = new Stopwatch();
    166120      sw.Start();
     
    205159      sw.Stop();
    206160      total_time = sw.ElapsedMilliseconds;
    207       //System.Console.WriteLine("total time: {0} ms", total_time);
    208       //System.Console.WriteLine("Result: " + Number_Of_Runs * 1000 / total_time + " dhrystone/ms.");
    209161
    210162      Results.Add(new Result("DIPS", new DoubleValue(Number_Of_Runs * 1000 / total_time)));
     
    389341      public int Int_Comp;
    390342      public string String_Comp;
    391       /*
    392       public int Enum_Comp_2;
    393       public string String_Comp_2;
    394       public char Char_Comp_1;
    395       public char Char_Comp_2;
    396        */
    397343    }
    398344
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks/3.3/HeuristicLab.Algorithms.Benchmarks-3.3.csproj

    r6920 r6934  
    4040    <Reference Include="System" />
    4141    <Reference Include="System.Core" />
     42    <Reference Include="System.Drawing" />
    4243    <Reference Include="System.Xml.Linq" />
    4344    <Reference Include="System.Data.DataSetExtensions" />
     
    4748  </ItemGroup>
    4849  <ItemGroup>
     50    <Compile Include="Benchmark.cs">
     51      <SubType>Code</SubType>
     52    </Compile>
    4953    <Compile Include="Whetstone.cs" />
    5054    <Compile Include="Dhrystone.cs" />
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks/3.3/Linpack.cs

    r6920 r6934  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 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;
    223using System.Diagnostics;
    3 using System.Threading;
    4 using System.Threading.Tasks;
    524using HeuristicLab.Common;
    625using HeuristicLab.Core;
     
    1029
    1130namespace HeuristicLab.Algorithms.Benchmarks {
    12   [Item("Linpack Algorithm", "A Linpack benchmark algorithm.")]
     31  [Item("Linpack Algorithm", "Linpack benchmarking algorithm.")]
    1332  [Creatable("Benchmarks")]
    1433  [StorableClass]
    15   public class Linpack : Algorithm {
    16     private DateTime lastUpdateTime;
    17 
    18     [Storable]
    19     private ResultCollection results;
     34  public class Linpack : Benchmark {
    2035
    2136    #region Benchmark Fields
     
    3348    #endregion
    3449
    35     #region Properties
    36 
    37     public override ResultCollection Results {
    38       get { return results; }
    39     }
    40 
    41     #endregion
    42 
    4350    #region Costructors
    4451
    4552    public Linpack()
    4653      : base() {
    47       results = new ResultCollection();
    4854    }
    4955
    5056    private Linpack(Linpack original, Cloner cloner)
    5157      : base(original, cloner) {
    52       results = new ResultCollection();
    5358    }
    5459
    5560    #endregion
     61
     62    #region IDeepClonable Members
    5663
    5764    public override IDeepCloneable Clone(Cloner cloner) {
     
    5966    }
    6067
    61     public override void Prepare() {
    62       results.Clear();
    63       OnPrepared();
    64     }
    65 
    66     public override void Start() {
    67       var cancellationTokenSource = new CancellationTokenSource();
    68       OnStarted();
    69       Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
    70       task.ContinueWith(t => {
    71         try {
    72           t.Wait();
    73         }
    74         catch (AggregateException ex) {
    75           try {
    76             ex.Flatten().Handle(x => x is OperationCanceledException);
    77           }
    78           catch (AggregateException remaining) {
    79             if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
    80             else OnExceptionOccurred(remaining);
    81           }
    82         }
    83         cancellationTokenSource.Dispose();
    84         cancellationTokenSource = null;
    85         OnStopped();
    86       });
    87     }
    88 
    89     private void Run(object state) {
    90       CancellationToken cancellationToken = (CancellationToken)state;
    91       lastUpdateTime = DateTime.Now;
    92       System.Timers.Timer timer = new System.Timers.Timer(250);
    93       timer.AutoReset = true;
    94       timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
    95       timer.Start();
    96       try {
    97         RunBenchmark();
    98       }
    99       finally {
    100         timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
    101         timer.Stop();
    102         ExecutionTime += DateTime.Now - lastUpdateTime;
    103       }
    104 
    105       cancellationToken.ThrowIfCancellationRequested();
    106     }
    107 
    108     private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
    109       System.Timers.Timer timer = (System.Timers.Timer)sender;
    110       timer.Enabled = false;
    111       DateTime now = DateTime.Now;
    112       ExecutionTime += now - lastUpdateTime;
    113       lastUpdateTime = now;
    114       timer.Enabled = true;
    115     }
     68    #endregion
    11669
    11770    #region Linpack Benchmark
    118 
    119     private void RunBenchmark() {
     71    // implementation based on Java version: http://www.netlib.org/benchmark/linpackjava/
     72
     73    protected override void RunBenchmark() {
    12074      int n = DEFAULT_PSIZE;
    12175      int ldaa = DEFAULT_PSIZE;
     
    189143      mflops_result /= 1000;
    190144
    191       //System.Console.WriteLine("Mflops/s: " + mflops_result + "  Time: " + time_result + " secs" + "  Norm Res: " + residn_result + "  Precision: " + eps_result);
    192 
    193145      Results.Add(new Result("Mflops/s", new DoubleValue(mflops_result)));
    194       //Results.Add(new Result("ca. Mflops/s", new DoubleValue(mflops_result * Environment.ProcessorCount)));
     146      Results.Add(new Result("total Mflops/s", new DoubleValue(mflops_result * Environment.ProcessorCount)));
    195147    }
    196148
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks/3.3/Plugin.cs.frame

    r6920 r6934  
    2626  /// Plugin class for HeuristicLab.Algorithms.Benchmark plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Algorithms.Benchmarks", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.1.$WCREV$")]
     28  [Plugin("HeuristicLab.Algorithms.Benchmarks", "Provides different benchmarking algorithms", "3.3.5.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Algorithms.Benchmarks-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Collections", "3.3")]
  • branches/Benchmarking/sources/HeuristicLab.Algorithms.Benchmarks/3.3/Whetstone.cs

    r6920 r6934  
    1 using System;
    2 using System.Threading;
    3 using System.Threading.Tasks;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 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;
    423using HeuristicLab.Common;
    524using HeuristicLab.Core;
     
    928
    1029namespace HeuristicLab.Algorithms.Benchmarks {
    11   [Item("Whetstone Algorithm", "A Whetstone benchmark algorithm.")]
     30  [Item("Whetstone Algorithm", "Whetstone benchmarking algorithm.")]
    1231  [Creatable("Benchmarks")]
    1332  [StorableClass]
    14   public class Whetstone : Algorithm {
    15     private DateTime lastUpdateTime;
    16 
    17     [Storable]
    18     private ResultCollection results;
     33  public class Whetstone : Benchmark {
    1934
    2035    #region Benchmark Fields
     
    2237    private long begin_time;
    2338    private long end_time;
    24     //private long total_time;
    2539
    2640    private int ITERATIONS;
     
    3448    #endregion
    3549
    36     #region Properties
    37 
    38     public override ResultCollection Results {
    39       get { return results; }
    40     }
    41 
    42     #endregion
    43 
    4450    #region Costructors
    4551
    4652    public Whetstone()
    4753      : base() {
    48       results = new ResultCollection();
     54
    4955    }
    5056
    5157    private Whetstone(Whetstone original, Cloner cloner)
    5258      : base(original, cloner) {
    53       results = new ResultCollection();
    54     }
    55 
    56     #endregion
     59
     60    }
     61
     62    #endregion
     63
     64    #region IDeepClonable Members
    5765
    5866    public override IDeepCloneable Clone(Cloner cloner) {
     
    6068    }
    6169
    62     public override void Prepare() {
    63       results.Clear();
    64       OnPrepared();
    65     }
    66 
    67     public override void Start() {
    68       var cancellationTokenSource = new CancellationTokenSource();
    69       OnStarted();
    70       Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
    71       task.ContinueWith(t => {
    72         try {
    73           t.Wait();
    74         }
    75         catch (AggregateException ex) {
    76           try {
    77             ex.Flatten().Handle(x => x is OperationCanceledException);
    78           }
    79           catch (AggregateException remaining) {
    80             if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
    81             else OnExceptionOccurred(remaining);
    82           }
    83         }
    84         cancellationTokenSource.Dispose();
    85         cancellationTokenSource = null;
    86         OnStopped();
    87       });
    88     }
    89 
    90     private void Run(object state) {
    91       CancellationToken cancellationToken = (CancellationToken)state;
    92       lastUpdateTime = DateTime.Now;
    93       System.Timers.Timer timer = new System.Timers.Timer(250);
    94       timer.AutoReset = true;
    95       timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
    96       timer.Start();
    97       try {
    98         RunBenchmark();
    99       }
    100       finally {
    101         timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
    102         timer.Stop();
    103         ExecutionTime += DateTime.Now - lastUpdateTime;
    104       }
    105 
    106       cancellationToken.ThrowIfCancellationRequested();
    107     }
    108 
    109     private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
    110       System.Timers.Timer timer = (System.Timers.Timer)sender;
    111       timer.Enabled = false;
    112       DateTime now = DateTime.Now;
    113       ExecutionTime += now - lastUpdateTime;
    114       lastUpdateTime = now;
    115       timer.Enabled = true;
    116     }
     70    #endregion
    11771
    11872    #region Whetstone Benchmark
    11973
    120     private void RunBenchmark() {
     74    protected override void RunBenchmark() {
    12175      ITERATIONS = 100; // ITERATIONS / 10 = Millions Whetstone instructions
    12276
     
    13084
    13185      for (int runNumber = 1; runNumber <= numberOfRuns; runNumber++) {
    132         //System.Console.WriteLine(runNumber + ". Test");
    13386        elapsedTime = (float)(MainCalc() / 1000);
    13487        meanTime = meanTime + (elapsedTime * 1000 / numberOfCycles);
     
    14295      meanRating = meanRating / numberOfRuns;
    14396      intRating = (int)meanRating;
    144       //System.Console.WriteLine("Number of Runs " + numberOfRuns);
    145       //System.Console.WriteLine("Average time per cycle " + meanTime + " ms.");
    146       //System.Console.WriteLine("Average Whetstone Rating " + intRating + " KWIPS");
    147       //Results.Add(new Result("KWIPS", new IntValue(intRating)));
     97
    14898      Results.Add(new Result("MWIPS", new IntValue(intRating / 1000)));
    14999    }
     
    264214
    265215      end_time = DateTime.Now.Ticks / 10000; // get ms
    266       //System.Console.WriteLine(" (time for " + numberOfCycles + " cycles): " + (end_time - begin_time) + " millisec.");
    267216
    268217      return (end_time - begin_time);
Note: See TracChangeset for help on using the changeset viewer.