Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2916


Ignore:
Timestamp:
03/03/10 03:14:37 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on engines and algorithms
Location:
trunk/sources
Files:
1 added
2 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.SGA.Views/3.3/SGAView.Designer.cs

    r2885 r2916  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.engineTabPage.SuspendLayout();
    4748      this.tabControl.SuspendLayout();
    4849      this.parametersTabPage.SuspendLayout();
    4950      this.problemTabPage.SuspendLayout();
     51      this.resultsTabPage.SuspendLayout();
    5052      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5153      this.SuspendLayout();
     54      //
     55      // createUserDefinedAlgorithmButton
     56      //
     57      this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(90, 552);
     58      this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm");
     59      //
     60      // engineComboBox
     61      //
     62      this.engineComboBox.Size = new System.Drawing.Size(675, 21);
     63      //
     64      // engineTabPage
     65      //
     66      this.engineTabPage.Size = new System.Drawing.Size(736, 401);
     67      //
     68      // engineViewHost
     69      //
     70      this.engineViewHost.Size = new System.Drawing.Size(724, 362);
     71      //
     72      // tabControl
     73      //
     74      this.tabControl.Size = new System.Drawing.Size(744, 427);
     75      //
     76      // parametersTabPage
     77      //
     78      this.parametersTabPage.Size = new System.Drawing.Size(736, 401);
     79      //
     80      // problemTabPage
     81      //
     82      this.problemTabPage.Size = new System.Drawing.Size(736, 401);
     83      //
     84      // parameterCollectionView
     85      //
     86      this.parameterCollectionView.Size = new System.Drawing.Size(724, 389);
     87      //
     88      // problemViewHost
     89      //
     90      this.problemViewHost.Size = new System.Drawing.Size(724, 359);
     91      //
     92      // newProblemButton
     93      //
     94      this.toolTip.SetToolTip(this.newProblemButton, "New Problem");
     95      //
     96      // saveProblemButton
     97      //
     98      this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");
     99      //
     100      // openProblemButton
     101      //
     102      this.toolTip.SetToolTip(this.openProblemButton, "Open Problem");
     103      //
     104      // startButton
     105      //
     106      this.startButton.Location = new System.Drawing.Point(0, 552);
     107      this.toolTip.SetToolTip(this.startButton, "Start Algorithm");
     108      //
     109      // stopButton
     110      //
     111      this.stopButton.Location = new System.Drawing.Point(30, 552);
     112      this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm");
     113      //
     114      // resetButton
     115      //
     116      this.resetButton.Location = new System.Drawing.Point(60, 552);
     117      this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm");
     118      //
     119      // executionTimeLabel
     120      //
     121      this.executionTimeLabel.Location = new System.Drawing.Point(518, 559);
     122      //
     123      // executionTimeTextBox
     124      //
     125      this.executionTimeTextBox.Location = new System.Drawing.Point(607, 556);
     126      //
     127      // resultsTabPage
     128      //
     129      this.resultsTabPage.Size = new System.Drawing.Size(736, 401);
     130      //
     131      // resultsView
     132      //
     133      this.resultsView.Size = new System.Drawing.Size(724, 389);
    52134      //
    53135      // nameTextBox
     
    55137      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    56138      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
     139      this.nameTextBox.Size = new System.Drawing.Size(672, 20);
     140      //
     141      // descriptionTextBox
     142      //
     143      this.descriptionTextBox.Size = new System.Drawing.Size(672, 87);
    57144      //
    58145      // SGAView
     
    61148      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    62149      this.Name = "SGAView";
     150      this.Size = new System.Drawing.Size(744, 576);
     151      this.engineTabPage.ResumeLayout(false);
     152      this.engineTabPage.PerformLayout();
    63153      this.tabControl.ResumeLayout(false);
    64154      this.parametersTabPage.ResumeLayout(false);
    65155      this.problemTabPage.ResumeLayout(false);
     156      this.resultsTabPage.ResumeLayout(false);
    66157      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    67158      this.ResumeLayout(false);
     
    73164
    74165
     166
    75167  }
    76168}
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/HeuristicLab.Algorithms.SGA-3.3.csproj

    r2900 r2916  
    141141    <None Include="HeuristicLabAlgorithmsSGAPlugin.cs.frame" />
    142142    <None Include="Properties\AssemblyInfo.frame" />
    143     <None Include="SGAEngine.hl" />
    144143  </ItemGroup>
    145144  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests

    • Property svn:ignore
      •  

        old new  
        11bin
        22obj
         3*.user
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests/HeuristicLab.Algorithms.SGA-3.3.Tests.csproj

    r2906 r2916  
    114114      <Name>HeuristicLab.Operators-3.3</Name>
    115115    </ProjectReference>
     116    <ProjectReference Include="..\..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     117      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     118      <Name>HeuristicLab.Optimization-3.3</Name>
     119    </ProjectReference>
    116120    <ProjectReference Include="..\..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    117121      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
     
    152156  </ItemGroup>
    153157  <ItemGroup>
    154     <None Include="SGAEngine.hl">
     158    <None Include="SGA.hl">
    155159      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    156160    </None>
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests/UnitTest.cs

    r2884 r2916  
    1 using System;
    2 using System.Diagnostics;
     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;
    323using System.Threading;
    4 using HeuristicLab.Core;
     24using HeuristicLab.Optimization;
    525using HeuristicLab.Persistence.Default.Xml;
    626using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    5878
    5979    [TestMethod]
    60     [DeploymentItem(@"SGAEngine.hl")]
     80    [DeploymentItem(@"SGA.hl")]
    6181    public void SGAPerformanceTest() {
    62       IEngine engine = (IEngine)XmlParser.Deserialize("SGAEngine.hl");
    63       engine.Stopped += new EventHandler(engine_Stopped);
    64       engine.Prepare();
    65       engine.Start();
     82      IAlgorithm sga = (IAlgorithm)XmlParser.Deserialize("SGA.hl");
     83      sga.Stopped += new EventHandler(sga_Stopped);
     84      sga.Prepare();
     85      sga.Start();
    6686      trigger.WaitOne();
    67       TestContext.WriteLine("Runtime: {0}", engine.ExecutionTime.ToString());
     87      TestContext.WriteLine("Runtime: {0}", sga.ExecutionTime.ToString());
    6888    }
    6989
    70     private void engine_Stopped(object sender, EventArgs e) {
     90    private void sga_Stopped(object sender, EventArgs e) {
    7191      trigger.Set();
    7292    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/Auxiliary.cs

    r2818 r2916  
    5555    /// <param name="ex">The exception to format.</param>
    5656    /// <returns>The formated message.</returns>
    57     private static string BuildErrorMessage(Exception ex) {
     57    public static string BuildErrorMessage(Exception ex) {
     58      string nl = Environment.NewLine;
    5859      StringBuilder sb = new StringBuilder();
    59       sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace);
     60      sb.Append("Sorry, but something went wrong!" + nl + ex.Message + nl + ex.StackTrace);
    6061
    6162      while (ex.InnerException != null) {
    6263        ex = ex.InnerException;
    63         sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace);
     64        sb.Append(nl + "-----" + nl + ex.Message + nl + ex.StackTrace);
    6465      }
    6566      return sb.ToString();
  • trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.Designer.cs

    r2834 r2916  
    3333    protected override void Dispose(bool disposing) {
    3434      if (disposing) {
    35         if (typeSelectorDialog != null) typeSelectorDialog.Dispose();
    3635        if (components != null) components.Dispose();
    3736      }
     
    4948      this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    5049      this.executionTimeLabel = new System.Windows.Forms.Label();
    51       this.scopeView = new HeuristicLab.Core.Views.ScopeView();
    52       this.resetButton = new System.Windows.Forms.Button();
    5350      this.stopButton = new System.Windows.Forms.Button();
    5451      this.startButton = new System.Windows.Forms.Button();
    5552      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    56       this.newOperatorGraphButton = new System.Windows.Forms.Button();
    57       this.openOperatorGraphButton = new System.Windows.Forms.Button();
    58       this.saveOperatorGraphButton = new System.Windows.Forms.Button();
    59       this.tabControl = new System.Windows.Forms.TabControl();
    60       this.operatorGraphTabPage = new System.Windows.Forms.TabPage();
    61       this.operatorGraphViewHost = new HeuristicLab.Core.Views.ViewHost();
    62       this.globalScopeTabPage = new System.Windows.Forms.TabPage();
    63       this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    64       this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    65       this.tabControl.SuspendLayout();
    66       this.operatorGraphTabPage.SuspendLayout();
    67       this.globalScopeTabPage.SuspendLayout();
     53      this.logTextBox = new System.Windows.Forms.TextBox();
    6854      this.SuspendLayout();
    6955      //
     
    8672      this.executionTimeLabel.TabIndex = 4;
    8773      this.executionTimeLabel.Text = "&Execution Time:";
    88       //
    89       // scopeView
    90       //
    91       this.scopeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    92                   | System.Windows.Forms.AnchorStyles.Left)
    93                   | System.Windows.Forms.AnchorStyles.Right)));
    94       this.scopeView.Caption = "Scope";
    95       this.scopeView.Content = null;
    96       this.scopeView.Location = new System.Drawing.Point(6, 6);
    97       this.scopeView.Name = "scopeView";
    98       this.scopeView.Size = new System.Drawing.Size(782, 572);
    99       this.scopeView.TabIndex = 0;
    100       //
    101       // resetButton
    102       //
    103       this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    104       this.resetButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Restart;
    105       this.resetButton.Location = new System.Drawing.Point(60, 616);
    106       this.resetButton.Name = "resetButton";
    107       this.resetButton.Size = new System.Drawing.Size(24, 24);
    108       this.resetButton.TabIndex = 3;
    109       this.toolTip.SetToolTip(this.resetButton, "Reset Engine");
    110       this.resetButton.UseVisualStyleBackColor = true;
    111       this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
    11274      //
    11375      // stopButton
     
    13698      this.startButton.Click += new System.EventHandler(this.startButton_Click);
    13799      //
    138       // newOperatorGraphButton
     100      // logTextBox
    139101      //
    140       this.newOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.NewDocument;
    141       this.newOperatorGraphButton.Location = new System.Drawing.Point(6, 6);
    142       this.newOperatorGraphButton.Name = "newOperatorGraphButton";
    143       this.newOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    144       this.newOperatorGraphButton.TabIndex = 0;
    145       this.toolTip.SetToolTip(this.newOperatorGraphButton, "Create New Operator Graph");
    146       this.newOperatorGraphButton.UseVisualStyleBackColor = true;
    147       this.newOperatorGraphButton.Click += new System.EventHandler(this.newOperatorGraphButton_Click);
    148       //
    149       // openOperatorGraphButton
    150       //
    151       this.openOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Open;
    152       this.openOperatorGraphButton.Location = new System.Drawing.Point(36, 6);
    153       this.openOperatorGraphButton.Name = "openOperatorGraphButton";
    154       this.openOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    155       this.openOperatorGraphButton.TabIndex = 1;
    156       this.toolTip.SetToolTip(this.openOperatorGraphButton, "Open Operator Graph");
    157       this.openOperatorGraphButton.UseVisualStyleBackColor = true;
    158       this.openOperatorGraphButton.Click += new System.EventHandler(this.openOperatorGraphButton_Click);
    159       //
    160       // saveOperatorGraphButton
    161       //
    162       this.saveOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
    163       this.saveOperatorGraphButton.Location = new System.Drawing.Point(66, 6);
    164       this.saveOperatorGraphButton.Name = "saveOperatorGraphButton";
    165       this.saveOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    166       this.saveOperatorGraphButton.TabIndex = 2;
    167       this.toolTip.SetToolTip(this.saveOperatorGraphButton, "Save Operator Graph");
    168       this.saveOperatorGraphButton.UseVisualStyleBackColor = true;
    169       this.saveOperatorGraphButton.Click += new System.EventHandler(this.saveOperatorGraphButton_Click);
    170       //
    171       // tabControl
    172       //
    173       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     102      this.logTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    174103                  | System.Windows.Forms.AnchorStyles.Left)
    175104                  | System.Windows.Forms.AnchorStyles.Right)));
    176       this.tabControl.Controls.Add(this.operatorGraphTabPage);
    177       this.tabControl.Controls.Add(this.globalScopeTabPage);
    178       this.tabControl.Location = new System.Drawing.Point(0, 0);
    179       this.tabControl.Name = "tabControl";
    180       this.tabControl.SelectedIndex = 0;
    181       this.tabControl.Size = new System.Drawing.Size(802, 610);
    182       this.tabControl.TabIndex = 3;
    183       //
    184       // operatorGraphTabPage
    185       //
    186       this.operatorGraphTabPage.Controls.Add(this.operatorGraphViewHost);
    187       this.operatorGraphTabPage.Controls.Add(this.saveOperatorGraphButton);
    188       this.operatorGraphTabPage.Controls.Add(this.openOperatorGraphButton);
    189       this.operatorGraphTabPage.Controls.Add(this.newOperatorGraphButton);
    190       this.operatorGraphTabPage.Location = new System.Drawing.Point(4, 22);
    191       this.operatorGraphTabPage.Name = "operatorGraphTabPage";
    192       this.operatorGraphTabPage.Padding = new System.Windows.Forms.Padding(3);
    193       this.operatorGraphTabPage.Size = new System.Drawing.Size(794, 584);
    194       this.operatorGraphTabPage.TabIndex = 0;
    195       this.operatorGraphTabPage.Text = "Operator Graph";
    196       this.operatorGraphTabPage.UseVisualStyleBackColor = true;
    197       //
    198       // operatorGraphViewHost
    199       //
    200       this.operatorGraphViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    201                   | System.Windows.Forms.AnchorStyles.Left)
    202                   | System.Windows.Forms.AnchorStyles.Right)));
    203       this.operatorGraphViewHost.Content = null;
    204       this.operatorGraphViewHost.Location = new System.Drawing.Point(6, 36);
    205       this.operatorGraphViewHost.Name = "operatorGraphViewHost";
    206       this.operatorGraphViewHost.Size = new System.Drawing.Size(782, 542);
    207       this.operatorGraphViewHost.TabIndex = 3;
    208       this.operatorGraphViewHost.ViewType = null;
    209       //
    210       // globalScopeTabPage
    211       //
    212       this.globalScopeTabPage.Controls.Add(this.scopeView);
    213       this.globalScopeTabPage.Location = new System.Drawing.Point(4, 22);
    214       this.globalScopeTabPage.Name = "globalScopeTabPage";
    215       this.globalScopeTabPage.Padding = new System.Windows.Forms.Padding(3);
    216       this.globalScopeTabPage.Size = new System.Drawing.Size(794, 584);
    217       this.globalScopeTabPage.TabIndex = 1;
    218       this.globalScopeTabPage.Text = "Global Scope";
    219       this.globalScopeTabPage.UseVisualStyleBackColor = true;
    220       //
    221       // openFileDialog
    222       //
    223       this.openFileDialog.DefaultExt = "hl";
    224       this.openFileDialog.FileName = "Item";
    225       this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*";
    226       this.openFileDialog.Title = "Open File";
    227       //
    228       // saveFileDialog
    229       //
    230       this.saveFileDialog.DefaultExt = "hl";
    231       this.saveFileDialog.FileName = "Item";
    232       this.saveFileDialog.Filter = "Uncompressed HeuristicLab Files|*.hl|HeuristicLab Files|*.hl|All Files|*.*";
    233       this.saveFileDialog.FilterIndex = 2;
    234       this.saveFileDialog.Title = "Save File";
     105      this.logTextBox.Location = new System.Drawing.Point(0, 0);
     106      this.logTextBox.Multiline = true;
     107      this.logTextBox.Name = "logTextBox";
     108      this.logTextBox.ReadOnly = true;
     109      this.logTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
     110      this.logTextBox.Size = new System.Drawing.Size(802, 610);
     111      this.logTextBox.TabIndex = 6;
     112      this.logTextBox.WordWrap = false;
    235113      //
    236114      // EngineView
     
    238116      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    239117      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    240       this.Controls.Add(this.tabControl);
     118      this.Controls.Add(this.logTextBox);
    241119      this.Controls.Add(this.executionTimeTextBox);
    242120      this.Controls.Add(this.stopButton);
    243121      this.Controls.Add(this.executionTimeLabel);
    244       this.Controls.Add(this.resetButton);
    245122      this.Controls.Add(this.startButton);
    246123      this.Name = "EngineView";
    247124      this.Size = new System.Drawing.Size(802, 640);
    248       this.tabControl.ResumeLayout(false);
    249       this.operatorGraphTabPage.ResumeLayout(false);
    250       this.globalScopeTabPage.ResumeLayout(false);
    251125      this.ResumeLayout(false);
    252126      this.PerformLayout();
     
    258132    protected System.Windows.Forms.TextBox executionTimeTextBox;
    259133    protected System.Windows.Forms.Label executionTimeLabel;
    260     protected System.Windows.Forms.Button resetButton;
    261134    protected System.Windows.Forms.Button stopButton;
    262135    protected System.Windows.Forms.Button startButton;
    263     protected HeuristicLab.Core.Views.ScopeView scopeView;
    264136    protected System.Windows.Forms.ToolTip toolTip;
    265     protected System.Windows.Forms.TabControl tabControl;
    266     protected System.Windows.Forms.TabPage globalScopeTabPage;
    267     protected System.Windows.Forms.OpenFileDialog openFileDialog;
    268     protected System.Windows.Forms.SaveFileDialog saveFileDialog;
    269     protected System.Windows.Forms.TabPage operatorGraphTabPage;
    270     protected System.Windows.Forms.Button saveOperatorGraphButton;
    271     protected System.Windows.Forms.Button openOperatorGraphButton;
    272     protected System.Windows.Forms.Button newOperatorGraphButton;
    273     protected ViewHost operatorGraphViewHost;
     137    protected System.Windows.Forms.TextBox logTextBox;
    274138
    275139  }
  • trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.cs

    r2834 r2916  
    2121
    2222using System;
    23 using System.Windows.Forms;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.MainForm;
    26 using HeuristicLab.Persistence.Default.Xml;
    2725
    2826namespace HeuristicLab.Core.Views {
     
    3331  [Content(typeof(IEngine), false)]
    3432  public partial class EngineView : ItemView {
    35     protected TypeSelectorDialog typeSelectorDialog;
    3633    private int executionTimeCounter;
    3734
     
    6158    /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
    6259    protected override void DeregisterContentEvents() {
    63       Content.OperatorGraphChanged -= new EventHandler(Content_OperatorGraphChanged);
    6460      Content.Prepared -= new EventHandler(Content_Prepared);
    6561      Content.Started -= new EventHandler(Content_Started);
     
    7672    protected override void RegisterContentEvents() {
    7773      base.RegisterContentEvents();
    78       Content.OperatorGraphChanged += new EventHandler(Content_OperatorGraphChanged);
    7974      Content.Prepared += new EventHandler(Content_Prepared);
    8075      Content.Started += new EventHandler(Content_Started);
     
    9186      base.OnContentChanged();
    9287      stopButton.Enabled = false;
     88      logTextBox.Clear();
    9389      if (Content == null) {
    94         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;
    95         operatorGraphViewHost.Enabled = false;
    96         scopeView.Enabled = false;
    97         startButton.Enabled = resetButton.Enabled = false;
     90        logTextBox.Enabled = false;
     91        startButton.Enabled = false;
    9892        executionTimeTextBox.Enabled = false;
    9993      } else {
    100         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true;
    101         operatorGraphViewHost.Content = Content.OperatorGraph;
    102         operatorGraphViewHost.Enabled = true;
    103         scopeView.Content = Content.GlobalScope;
    104         scopeView.Enabled = true;
     94        logTextBox.Enabled = true;
    10595        startButton.Enabled = !Content.Finished;
    106         resetButton.Enabled = true;
    10796        UpdateExecutionTimeTextBox();
    10897        executionTimeTextBox.Enabled = true;
     
    111100
    112101    #region Content Events
    113     protected virtual void Content_OperatorGraphChanged(object sender, EventArgs e) {
    114       if (InvokeRequired)
    115         Invoke(new EventHandler(Content_OperatorGraphChanged), sender, e);
    116       else
    117         operatorGraphViewHost.Content = Content.OperatorGraph;
    118     }
    119102    protected virtual void Content_Prepared(object sender, EventArgs e) {
    120103      if (InvokeRequired)
    121104        Invoke(new EventHandler(Content_Prepared), sender, e);
    122105      else {
    123         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true;
    124         operatorGraphViewHost.Enabled = true;
    125         scopeView.Enabled = true;
    126106        startButton.Enabled = !Content.Finished;
    127107        stopButton.Enabled = false;
    128         resetButton.Enabled = true;
    129108        UpdateExecutionTimeTextBox();
     109        logTextBox.Clear();
     110        Log("Engine prepared");
    130111      }
    131112    }
     
    135116        Invoke(new EventHandler(Content_Started), sender, e);
    136117      else {
    137         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;
    138         operatorGraphViewHost.Enabled = false;
    139         scopeView.Enabled = false;
    140118        startButton.Enabled = false;
    141119        stopButton.Enabled = true;
    142         resetButton.Enabled = false;
    143120        UpdateExecutionTimeTextBox();
     121        Log("Engine started");
    144122      }
    145123    }
     
    148126        Invoke(new EventHandler(Content_Stopped), sender, e);
    149127      else {
    150         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true;
    151         operatorGraphViewHost.Enabled = true;
    152         scopeView.Enabled = true;
    153128        startButton.Enabled = !Content.Finished;
    154129        stopButton.Enabled = false;
    155         resetButton.Enabled = true;
    156130        UpdateExecutionTimeTextBox();
     131        if (Content.Finished) Log("Engine finished");
     132        else Log("Engine stopped");
    157133      }
    158134    }
     
    168144        Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e);
    169145      else
    170         Auxiliary.ShowErrorMessageBox(e.Value);
     146        Log(Auxiliary.BuildErrorMessage(e.Value));
    171147    }
    172148    #endregion
    173149
    174150    #region Button events
    175     protected void newOperatorGraphButton_Click(object sender, EventArgs e) {
    176       Content.OperatorGraph = new OperatorGraph();
    177     }
    178     protected void openOperatorGraphButton_Click(object sender, EventArgs e) {
    179       openFileDialog.Title = "Open Operator Graph";
    180       if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    181         OperatorGraph operatorGraph = null;
    182         try {
    183           operatorGraph = XmlParser.Deserialize(openFileDialog.FileName) as OperatorGraph;
    184         }
    185         catch (Exception ex) {
    186           Auxiliary.ShowErrorMessageBox(ex);
    187         }
    188         if (operatorGraph == null)
    189           MessageBox.Show(this, "Selected file does not contain an operator graph.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);
    190         else
    191           Content.OperatorGraph = operatorGraph;
    192       }
    193     }
    194     protected void saveOperatorGraphButton_Click(object sender, EventArgs e) {
    195       saveFileDialog.Title = "Save Operator Graph";
    196       if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
    197         try {
    198           if (saveFileDialog.FilterIndex == 1)
    199             XmlGenerator.Serialize(Content.OperatorGraph, saveFileDialog.FileName, 0);
    200           else
    201             XmlGenerator.Serialize(Content.OperatorGraph, saveFileDialog.FileName, 9);
    202         }
    203         catch (Exception ex) {
    204           Auxiliary.ShowErrorMessageBox(ex);
    205         }
    206       }
    207     }
    208151    protected virtual void startButton_Click(object sender, EventArgs e) {
    209152      Content.Start();
     
    211154    protected virtual void stopButton_Click(object sender, EventArgs e) {
    212155      Content.Stop();
    213     }
    214     protected virtual void resetButton_Click(object sender, EventArgs e) {
    215       Content.Prepare();
    216156    }
    217157    #endregion
     
    224164        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    225165    }
     166    protected virtual void Log(string message) {
     167      if (InvokeRequired)
     168        Invoke(new Action<string>(Log), message);
     169      else {
     170        message = DateTime.Now.ToString() + "\t" + message;
     171        string[] newLines = message.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
     172        string[] lines = new string[logTextBox.Lines.Length + newLines.Length];
     173        logTextBox.Lines.CopyTo(lines, 0);
     174        newLines.CopyTo(lines, logTextBox.Lines.Length);
     175        logTextBox.Lines = lines;
     176      }
     177    }
    226178    #endregion
    227179  }
  • trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemView.cs

    r2870 r2916  
    9292
    9393    protected virtual void nameTextBox_Validating(object sender, CancelEventArgs e) {
    94       if (Content.CanChangeName) {
     94      if ((Content != null) && (Content.CanChangeName)) {
    9595        Content.Name = nameTextBox.Text;
    9696
  • trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.Designer.cs

    r2841 r2916  
    8282      this.viewsLabel.Size = new System.Drawing.Size(16, 16);
    8383      this.viewsLabel.TabIndex = 0;
    84       this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view.\r\nRight-click to change current view.");
     84      this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view." + System.Environment.NewLine + "Right-click to change current view.");
    8585      this.viewsLabel.DoubleClick += new System.EventHandler(this.viewsLabel_DoubleClick);
    8686      //
  • trunk/sources/HeuristicLab.Core/3.3/Engine.cs

    r2851 r2916  
    3939    }
    4040
    41     private OperatorGraph operatorGraph;
    42     /// <summary>
    43     /// Gets or sets the current operator graph.
    44     /// </summary>
    45     [Storable]
    46     public OperatorGraph OperatorGraph {
    47       get { return operatorGraph; }
    48       set {
    49         if (value == null) throw new ArgumentNullException();
    50         if (value != operatorGraph) {
    51           if (operatorGraph != null) operatorGraph.InitialOperatorChanged -= new EventHandler(operatorGraph_InitialOperatorChanged);
    52           operatorGraph = value;
    53           if (operatorGraph != null) operatorGraph.InitialOperatorChanged += new EventHandler(operatorGraph_InitialOperatorChanged);
    54           OnOperatorGraphChanged();
    55           Prepare();
    56         }
    57       }
    58     }
    59 
    60     /// <summary>
    61     /// Field of the current instance that represent the global scope.
    62     /// </summary>
    63     [Storable]
    64     private IScope globalScope;
    65     /// <summary>
    66     /// Gets the current global scope.
    67     /// </summary>
    68     public IScope GlobalScope {
    69       get { return globalScope; }
    70     }
    71 
    7241    [Storable]
    7342    private TimeSpan executionTime;
     
    134103    /// </summary>
    135104    protected Engine() {
    136       globalScope = new Scope("Global");
    137105      executionStack = new Stack<IOperation>();
    138       OperatorGraph = new OperatorGraph();
    139106    }
    140107
     
    148115    public override IDeepCloneable Clone(Cloner cloner) {
    149116      Engine clone = (Engine)base.Clone(cloner);
    150       clone.OperatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
    151       clone.globalScope = (Scope)cloner.Clone(globalScope);
    152117      clone.executionTime = executionTime;
    153118      IOperation[] contexts = executionStack.ToArray();
     
    162127      Canceled = false;
    163128      running = false;
    164       globalScope.Clear();
    165129      ExecutionTime = new TimeSpan();
    166130      executionStack.Clear();
     
    168132        executionStack.Push(initialOperation);
    169133      OnPrepared();
    170     }
    171     /// <inheritdoc/>
    172     /// <remarks>Sets <c>myCanceled</c> and <c>myRunning</c> to <c>false</c>. The global scope is cleared,
    173     /// the execution time is reset, the execution stack is cleared and a new <see cref="AtomicOperation"/>
    174     /// with the initial operator is added. <br/>
    175     /// Calls <see cref="OnPrepared"/>.</remarks>
    176     public void Prepare() {
    177       if (OperatorGraph.InitialOperator != null)
    178         Prepare(new ExecutionContext(null, OperatorGraph.InitialOperator, GlobalScope));
    179134    }
    180135    /// <inheritdoc/>
     
    229184    protected abstract void ProcessNextOperator();
    230185
    231     private void operatorGraph_InitialOperatorChanged(object sender, EventArgs e) {
    232       Prepare();
    233     }
    234 
    235     /// <summary>
    236     /// Occurs when the operator graph was changed.
    237     /// </summary>
    238     public event EventHandler OperatorGraphChanged;
    239     /// <summary>
    240     /// Fires a new <c>OperatorGraphChanged</c> event.
    241     /// </summary>
    242     protected virtual void OnOperatorGraphChanged() {
    243       if (OperatorGraphChanged != null)
    244         OperatorGraphChanged(this, EventArgs.Empty);
    245     }
    246186    /// <summary>
    247187    /// Occurs when the execution time changed.
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IEngine.cs

    r2834 r2916  
    3131  public interface IEngine : IItem {
    3232    /// <summary>
    33     /// Gets the operator graph of the current instance.
    34     /// </summary>
    35     OperatorGraph OperatorGraph { get; set; }
    36     /// <summary>
    37     /// Gets the global scope of the current instance.
    38     /// </summary>
    39     IScope GlobalScope { get; }
    40 
    41     /// <summary>
    4233    /// Gets the execution time of the current instance.
    4334    /// </summary>
     
    5344    bool Finished { get; }
    5445
    55     /// <summary>
    56     /// Prepares the engine for a new run.
    57     /// </summary>
    58     void Prepare();
    5946    /// <summary>
    6047    /// Prepares the engine with a given initial operation.
     
    7461    void Stop();
    7562
    76     /// <summary>
    77     /// Occurs when the operator graph was changed.
    78     /// </summary>
    79     event EventHandler OperatorGraphChanged;
    8063    /// <summary>
    8164    /// Occurs when the execution time was changed.
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Tests

    • Property svn:ignore set to
      bin
      obj
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ContentView.cs

    r2790 r2916  
    5353            if (this.content != null) this.DeregisterContentEvents();
    5454            this.content = value;
     55            if (this.content != null) this.RegisterContentEvents();
    5556            this.OnContentChanged();
    56             if (this.content != null) this.RegisterContentEvents();
    5757          }
    5858        }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs

    r2882 r2916  
    104104      this.parametersTabPage.Name = "parametersTabPage";
    105105      this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
    106       this.parametersTabPage.Size = new System.Drawing.Size(482, 178);
     106      this.parametersTabPage.Size = new System.Drawing.Size(671, 307);
    107107      this.parametersTabPage.TabIndex = 0;
    108108      this.parametersTabPage.Text = "Parameters";
     
    118118      this.parameterCollectionView.Location = new System.Drawing.Point(6, 6);
    119119      this.parameterCollectionView.Name = "parameterCollectionView";
    120       this.parameterCollectionView.Size = new System.Drawing.Size(470, 166);
     120      this.parameterCollectionView.Size = new System.Drawing.Size(659, 295);
    121121      this.parameterCollectionView.TabIndex = 0;
    122122      //
     
    186186      this.resultsTabPage.Name = "resultsTabPage";
    187187      this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3);
    188       this.resultsTabPage.Size = new System.Drawing.Size(482, 178);
     188      this.resultsTabPage.Size = new System.Drawing.Size(671, 307);
    189189      this.resultsTabPage.TabIndex = 2;
    190190      this.resultsTabPage.Text = "Results";
     
    200200      this.resultsView.Location = new System.Drawing.Point(6, 6);
    201201      this.resultsView.Name = "resultsView";
    202       this.resultsView.Size = new System.Drawing.Size(470, 166);
     202      this.resultsView.Size = new System.Drawing.Size(659, 295);
    203203      this.resultsView.TabIndex = 0;
    204204      //
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r2882 r2916  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Windows.Forms;
    2425using HeuristicLab.Common;
     
    5556      : this() {
    5657      Content = content;
     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);
    5772    }
    5873
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs

    r2865 r2916  
    3333    protected override void Dispose(bool disposing) {
    3434      if (disposing) {
    35         if (engineTypeSelectorDialog != null) engineTypeSelectorDialog.Dispose();
    3635        if (components != null) components.Dispose();
    3736      }
     
    4746    private void InitializeComponent() {
    4847      this.engineLabel = new System.Windows.Forms.Label();
    49       this.engineTextBox = new System.Windows.Forms.TextBox();
    50       this.setEngineButton = new System.Windows.Forms.Button();
    5148      this.createUserDefinedAlgorithmButton = new System.Windows.Forms.Button();
     49      this.engineComboBox = new System.Windows.Forms.ComboBox();
     50      this.engineTabPage = new System.Windows.Forms.TabPage();
     51      this.engineViewHost = new HeuristicLab.Core.Views.ViewHost();
    5252      this.tabControl.SuspendLayout();
    5353      this.parametersTabPage.SuspendLayout();
    5454      this.problemTabPage.SuspendLayout();
     55      this.resultsTabPage.SuspendLayout();
    5556      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     57      this.engineTabPage.SuspendLayout();
    5658      this.SuspendLayout();
    5759      //
    5860      // tabControl
    5961      //
    60       this.tabControl.Location = new System.Drawing.Point(0, 149);
    61       this.tabControl.Size = new System.Drawing.Size(656, 278);
    62       this.tabControl.TabIndex = 7;
     62      this.tabControl.Controls.Add(this.engineTabPage);
     63      this.tabControl.Size = new System.Drawing.Size(713, 400);
     64      this.tabControl.Controls.SetChildIndex(this.resultsTabPage, 0);
     65      this.tabControl.Controls.SetChildIndex(this.engineTabPage, 0);
     66      this.tabControl.Controls.SetChildIndex(this.problemTabPage, 0);
     67      this.tabControl.Controls.SetChildIndex(this.parametersTabPage, 0);
    6368      //
    6469      // parametersTabPage
    6570      //
    66       this.parametersTabPage.Size = new System.Drawing.Size(648, 252);
     71      this.parametersTabPage.Size = new System.Drawing.Size(705, 374);
    6772      //
    6873      // problemTabPage
    6974      //
    70       this.problemTabPage.Size = new System.Drawing.Size(648, 252);
     75      this.problemTabPage.Size = new System.Drawing.Size(705, 374);
    7176      //
    7277      // parameterCollectionView
    7378      //
    74       this.parameterCollectionView.Size = new System.Drawing.Size(636, 240);
     79      this.parameterCollectionView.Size = new System.Drawing.Size(693, 362);
    7580      //
    7681      // problemViewHost
    7782      //
    78       this.problemViewHost.Size = new System.Drawing.Size(470, 106);
     83      this.problemViewHost.Size = new System.Drawing.Size(693, 332);
     84      //
     85      // newProblemButton
     86      //
     87      this.toolTip.SetToolTip(this.newProblemButton, "New Problem");
     88      //
     89      // saveProblemButton
     90      //
     91      this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");
     92      //
     93      // openProblemButton
     94      //
     95      this.toolTip.SetToolTip(this.openProblemButton, "Open Problem");
    7996      //
    8097      // startButton
    8198      //
    82       this.startButton.Location = new System.Drawing.Point(0, 433);
    83       this.startButton.TabIndex = 8;
     99      this.startButton.Location = new System.Drawing.Point(0, 525);
     100      this.toolTip.SetToolTip(this.startButton, "Start Algorithm");
    84101      //
    85102      // stopButton
    86103      //
    87       this.stopButton.Location = new System.Drawing.Point(30, 433);
    88       this.stopButton.TabIndex = 9;
     104      this.stopButton.Location = new System.Drawing.Point(30, 525);
     105      this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm");
    89106      //
    90107      // resetButton
    91108      //
    92       this.resetButton.Location = new System.Drawing.Point(60, 433);
    93       this.resetButton.TabIndex = 10;
     109      this.resetButton.Location = new System.Drawing.Point(60, 525);
     110      this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm");
    94111      //
    95112      // executionTimeLabel
    96113      //
    97       this.executionTimeLabel.Location = new System.Drawing.Point(430, 440);
    98       this.executionTimeLabel.TabIndex = 12;
     114      this.executionTimeLabel.Location = new System.Drawing.Point(487, 532);
     115      this.executionTimeLabel.TabIndex = 9;
    99116      //
    100117      // executionTimeTextBox
    101118      //
    102       this.executionTimeTextBox.Location = new System.Drawing.Point(519, 437);
    103       this.executionTimeTextBox.TabIndex = 13;
     119      this.executionTimeTextBox.Location = new System.Drawing.Point(576, 529);
     120      this.executionTimeTextBox.TabIndex = 10;
     121      //
     122      // resultsTabPage
     123      //
     124      this.resultsTabPage.Size = new System.Drawing.Size(705, 374);
     125      //
     126      // resultsView
     127      //
     128      this.resultsView.Size = new System.Drawing.Size(693, 362);
    104129      //
    105130      // nameTextBox
     
    107132      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    108133      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    109       this.nameTextBox.Size = new System.Drawing.Size(584, 20);
     134      this.nameTextBox.Size = new System.Drawing.Size(641, 20);
    110135      //
    111136      // descriptionTextBox
    112137      //
    113       this.descriptionTextBox.Size = new System.Drawing.Size(584, 87);
     138      this.descriptionTextBox.Size = new System.Drawing.Size(641, 87);
    114139      //
    115140      // engineLabel
    116141      //
    117142      this.engineLabel.AutoSize = true;
    118       this.engineLabel.Location = new System.Drawing.Point(3, 124);
     143      this.engineLabel.Location = new System.Drawing.Point(6, 9);
    119144      this.engineLabel.Name = "engineLabel";
    120145      this.engineLabel.Size = new System.Drawing.Size(43, 13);
    121       this.engineLabel.TabIndex = 4;
     146      this.engineLabel.TabIndex = 0;
    122147      this.engineLabel.Text = "&Engine:";
    123148      //
    124       // engineTextBox
    125       //
    126       this.engineTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    127                   | System.Windows.Forms.AnchorStyles.Right)));
    128       this.engineTextBox.Location = new System.Drawing.Point(72, 121);
    129       this.engineTextBox.Name = "engineTextBox";
    130       this.engineTextBox.ReadOnly = true;
    131       this.engineTextBox.Size = new System.Drawing.Size(554, 20);
    132       this.engineTextBox.TabIndex = 6;
    133       this.engineTextBox.DoubleClick += new System.EventHandler(this.engineTextBox_DoubleClick);
    134       //
    135       // setEngineButton
    136       //
    137       this.setEngineButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    138       this.setEngineButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Add;
    139       this.setEngineButton.Location = new System.Drawing.Point(632, 119);
    140       this.setEngineButton.Name = "setEngineButton";
    141       this.setEngineButton.Size = new System.Drawing.Size(24, 24);
    142       this.setEngineButton.TabIndex = 5;
    143       this.toolTip.SetToolTip(this.setEngineButton, "Set Engine");
    144       this.setEngineButton.UseVisualStyleBackColor = true;
    145       this.setEngineButton.Click += new System.EventHandler(this.setEngineButton_Click);
    146       //
    147149      // createUserDefinedAlgorithmButton
    148150      //
    149151      this.createUserDefinedAlgorithmButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    150       this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(90, 433);
     152      this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(90, 525);
    151153      this.createUserDefinedAlgorithmButton.Name = "createUserDefinedAlgorithmButton";
    152154      this.createUserDefinedAlgorithmButton.Size = new System.Drawing.Size(254, 24);
    153       this.createUserDefinedAlgorithmButton.TabIndex = 11;
     155      this.createUserDefinedAlgorithmButton.TabIndex = 8;
    154156      this.createUserDefinedAlgorithmButton.Text = "&Create User Defined Algorithm";
    155157      this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm");
     
    157159      this.createUserDefinedAlgorithmButton.Click += new System.EventHandler(this.createUserDefinedAlgorithmButton_Click);
    158160      //
     161      // engineComboBox
     162      //
     163      this.engineComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     164                  | System.Windows.Forms.AnchorStyles.Right)));
     165      this.engineComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     166      this.engineComboBox.FormattingEnabled = true;
     167      this.engineComboBox.Location = new System.Drawing.Point(55, 6);
     168      this.engineComboBox.Name = "engineComboBox";
     169      this.engineComboBox.Size = new System.Drawing.Size(644, 21);
     170      this.engineComboBox.TabIndex = 1;
     171      this.engineComboBox.SelectedIndexChanged += new System.EventHandler(this.engineComboBox_SelectedIndexChanged);
     172      //
     173      // engineTabPage
     174      //
     175      this.engineTabPage.Controls.Add(this.engineViewHost);
     176      this.engineTabPage.Controls.Add(this.engineComboBox);
     177      this.engineTabPage.Controls.Add(this.engineLabel);
     178      this.engineTabPage.Location = new System.Drawing.Point(4, 22);
     179      this.engineTabPage.Name = "engineTabPage";
     180      this.engineTabPage.Padding = new System.Windows.Forms.Padding(3);
     181      this.engineTabPage.Size = new System.Drawing.Size(705, 374);
     182      this.engineTabPage.TabIndex = 3;
     183      this.engineTabPage.Text = "Engine";
     184      this.engineTabPage.UseVisualStyleBackColor = true;
     185      //
     186      // engineViewHost
     187      //
     188      this.engineViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     189                  | System.Windows.Forms.AnchorStyles.Left)
     190                  | System.Windows.Forms.AnchorStyles.Right)));
     191      this.engineViewHost.Content = null;
     192      this.engineViewHost.Location = new System.Drawing.Point(6, 33);
     193      this.engineViewHost.Name = "engineViewHost";
     194      this.engineViewHost.Size = new System.Drawing.Size(693, 335);
     195      this.engineViewHost.TabIndex = 2;
     196      this.engineViewHost.ViewType = null;
     197      //
    159198      // EngineAlgorithmView
    160199      //
    161200      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    162201      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    163       this.Controls.Add(this.setEngineButton);
    164       this.Controls.Add(this.engineTextBox);
    165       this.Controls.Add(this.engineLabel);
    166202      this.Controls.Add(this.createUserDefinedAlgorithmButton);
    167203      this.Name = "EngineAlgorithmView";
    168       this.Size = new System.Drawing.Size(656, 457);
     204      this.Size = new System.Drawing.Size(713, 549);
    169205      this.Controls.SetChildIndex(this.createUserDefinedAlgorithmButton, 0);
    170       this.Controls.SetChildIndex(this.engineLabel, 0);
    171       this.Controls.SetChildIndex(this.engineTextBox, 0);
    172       this.Controls.SetChildIndex(this.setEngineButton, 0);
    173206      this.Controls.SetChildIndex(this.resetButton, 0);
    174207      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
     
    184217      this.parametersTabPage.ResumeLayout(false);
    185218      this.problemTabPage.ResumeLayout(false);
     219      this.resultsTabPage.ResumeLayout(false);
    186220      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     221      this.engineTabPage.ResumeLayout(false);
     222      this.engineTabPage.PerformLayout();
    187223      this.ResumeLayout(false);
    188224      this.PerformLayout();
     
    193229
    194230    protected System.Windows.Forms.Label engineLabel;
    195     protected System.Windows.Forms.TextBox engineTextBox;
    196     protected System.Windows.Forms.Button setEngineButton;
    197231    protected System.Windows.Forms.Button createUserDefinedAlgorithmButton;
    198 
     232    protected System.Windows.Forms.ComboBox engineComboBox;
     233    protected System.Windows.Forms.TabPage engineTabPage;
     234    protected HeuristicLab.Core.Views.ViewHost engineViewHost;
    199235
    200236  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r2864 r2916  
    2121
    2222using System;
    23 using System.Windows.Forms;
     23using System.Collections.Generic;
     24using System.Linq;
     25using HeuristicLab.Common;
    2426using HeuristicLab.Core;
    25 using HeuristicLab.Core.Views;
    2627using HeuristicLab.MainForm;
     28using HeuristicLab.PluginInfrastructure;
    2729
    2830namespace HeuristicLab.Optimization.Views {
     
    3234  [Content(typeof(EngineAlgorithm), true)]
    3335  public partial class EngineAlgorithmView : AlgorithmView {
    34     private TypeSelectorDialog engineTypeSelectorDialog;
     36    private List<Type> engineTypes;
    3537
    3638    public new EngineAlgorithm Content {
     
    4547      InitializeComponent();
    4648    }
     49
    4750    /// <summary>
    4851    /// Intializes a new instance of <see cref="ItemBaseView"/> with the given <paramref name="item"/>.
     
    6568    protected override void OnContentChanged() {
    6669      base.OnContentChanged();
     70
     71      if (engineTypes == null) {
     72        engineTypes = ApplicationManager.Manager.GetTypes(typeof(IEngine)).
     73                      OrderBy(x => {
     74                        string name = ItemAttribute.GetName(x);
     75                        if (name != null) return name;
     76                        else return x.GetPrettyName();
     77                      }).ToList();
     78        foreach (Type t in engineTypes) {
     79          string name = ItemAttribute.GetName(t);
     80          if (name == null) name = t.GetPrettyName();
     81          engineComboBox.Items.Add(name);
     82        }
     83        engineTypes.Insert(0, null);
     84        engineComboBox.Items.Insert(0, "-");
     85      }
     86
    6787      if (Content == null) {
    68         engineTextBox.Text = "-";
    69         engineTextBox.Enabled = false;
    70         setEngineButton.Enabled = false;
     88        engineComboBox.Enabled = false;
     89        engineViewHost.Content = null;
     90        engineViewHost.Enabled = false;
    7191      } else {
    72         engineTextBox.Text = Content.Engine == null ? "-" : Content.Engine.ToString();
    73         engineTextBox.Enabled = true;
    74         setEngineButton.Enabled = true;
     92        engineComboBox.Enabled = true;
     93        if (Content.Engine == null)
     94          engineComboBox.SelectedIndex = engineTypes.IndexOf(null);
     95        else
     96          engineComboBox.SelectedIndex = engineTypes.IndexOf(Content.Engine.GetType());
     97        engineViewHost.Enabled = true;
     98        engineViewHost.Content = Content.Engine;
    7599      }
    76100    }
     
    79103      if (InvokeRequired)
    80104        Invoke(new EventHandler(Content_EngineChanged), sender, e);
    81       else
    82         engineTextBox.Text = Content.Engine == null ? "-" : Content.Engine.ToString();
    83     }
    84 
    85     protected void setEngineButton_Click(object sender, System.EventArgs e) {
    86       if (engineTypeSelectorDialog == null) {
    87         engineTypeSelectorDialog = new TypeSelectorDialog();
    88         engineTypeSelectorDialog.Caption = "Select Engine";
    89         engineTypeSelectorDialog.TypeSelector.Configure(typeof(IEngine), false, false);
    90       }
    91       if (engineTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    92         Content.Engine = (IEngine)engineTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
     105      else {
     106        if (Content.Engine == null)
     107          engineComboBox.SelectedIndex = engineTypes.IndexOf(null);
     108        else
     109          engineComboBox.SelectedIndex = engineTypes.IndexOf(Content.Engine.GetType());
     110        engineViewHost.Content = Content.Engine;
    93111      }
    94112    }
    95113
    96     protected void engineTextBox_DoubleClick(object sender, System.EventArgs e) {
    97       if (Content.Engine != null)
    98         MainFormManager.CreateDefaultView(Content.Engine).Show();
     114    protected void engineComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     115      if (Content != null) {
     116        Type t = engineTypes[engineComboBox.SelectedIndex];
     117        if (t == null)
     118          Content.Engine = null;
     119        else
     120          Content.Engine = (IEngine)Activator.CreateInstance(t);
     121      }
    99122    }
    100123
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs

    r2882 r2916  
    5252      this.globalScopeTabPage = new System.Windows.Forms.TabPage();
    5353      this.globalScopeView = new HeuristicLab.Core.Views.ScopeView();
     54      this.engineTabPage.SuspendLayout();
    5455      this.tabControl.SuspendLayout();
    5556      this.parametersTabPage.SuspendLayout();
     
    6162      this.SuspendLayout();
    6263      //
    63       // setEngineButton
    64       //
    65       this.toolTip.SetToolTip(this.setEngineButton, "Set Engine");
    66       //
    6764      // createUserDefinedAlgorithmButton
    6865      //
     
    7370      this.tabControl.Controls.Add(this.operatorGraphTabPage);
    7471      this.tabControl.Controls.Add(this.globalScopeTabPage);
    75       this.tabControl.Controls.SetChildIndex(this.resultsTabPage, 0);
    7672      this.tabControl.Controls.SetChildIndex(this.globalScopeTabPage, 0);
    7773      this.tabControl.Controls.SetChildIndex(this.operatorGraphTabPage, 0);
     74      this.tabControl.Controls.SetChildIndex(this.resultsTabPage, 0);
     75      this.tabControl.Controls.SetChildIndex(this.engineTabPage, 0);
    7876      this.tabControl.Controls.SetChildIndex(this.problemTabPage, 0);
    7977      this.tabControl.Controls.SetChildIndex(this.parametersTabPage, 0);
     
    102100      //
    103101      this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm");
    104       //
    105       // resultsTabPage
    106       //
    107       this.resultsTabPage.Size = new System.Drawing.Size(648, 252);
    108       //
    109       // resultsView
    110       //
    111       this.resultsView.Size = new System.Drawing.Size(636, 240);
    112102      //
    113103      // nameTextBox
     
    124114      this.operatorGraphTabPage.Location = new System.Drawing.Point(4, 22);
    125115      this.operatorGraphTabPage.Name = "operatorGraphTabPage";
    126       this.operatorGraphTabPage.Size = new System.Drawing.Size(648, 252);
     116      this.operatorGraphTabPage.Size = new System.Drawing.Size(705, 374);
    127117      this.operatorGraphTabPage.TabIndex = 2;
    128118      this.operatorGraphTabPage.Text = "Operator Graph";
     
    170160      this.operatorGraphViewHost.Location = new System.Drawing.Point(3, 33);
    171161      this.operatorGraphViewHost.Name = "operatorGraphViewHost";
    172       this.operatorGraphViewHost.Size = new System.Drawing.Size(642, 216);
     162      this.operatorGraphViewHost.Size = new System.Drawing.Size(699, 338);
    173163      this.operatorGraphViewHost.TabIndex = 0;
    174164      this.operatorGraphViewHost.ViewType = null;
     
    179169      this.globalScopeTabPage.Location = new System.Drawing.Point(4, 22);
    180170      this.globalScopeTabPage.Name = "globalScopeTabPage";
    181       this.globalScopeTabPage.Size = new System.Drawing.Size(648, 252);
     171      this.globalScopeTabPage.Size = new System.Drawing.Size(705, 374);
    182172      this.globalScopeTabPage.TabIndex = 3;
    183173      this.globalScopeTabPage.Text = "Global Scope";
     
    193183      this.globalScopeView.Location = new System.Drawing.Point(3, 3);
    194184      this.globalScopeView.Name = "globalScopeView";
    195       this.globalScopeView.Size = new System.Drawing.Size(642, 246);
     185      this.globalScopeView.Size = new System.Drawing.Size(699, 368);
    196186      this.globalScopeView.TabIndex = 0;
    197187      //
     
    201191      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    202192      this.Name = "UserDefinedAlgorithmView";
     193      this.engineTabPage.ResumeLayout(false);
     194      this.engineTabPage.PerformLayout();
    203195      this.tabControl.ResumeLayout(false);
    204196      this.parametersTabPage.ResumeLayout(false);
  • trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs

    r2882 r2916  
    2121
    2222using System;
     23using System.Linq;
    2324using HeuristicLab.Collections;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.PluginInfrastructure;
    2729
    2830namespace HeuristicLab.Optimization {
     
    9799      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    98100      OperatorGraph = new OperatorGraph();
     101      InitializeEngine();
    99102    }
    100103    protected EngineAlgorithm(string name)
     
    103106      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    104107      OperatorGraph = new OperatorGraph();
     108      InitializeEngine();
    105109    }
    106110    protected EngineAlgorithm(string name, ParameterCollection parameters)
     
    109113      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    110114      OperatorGraph = new OperatorGraph();
     115      InitializeEngine();
    111116    }
    112117    protected EngineAlgorithm(string name, string description)
     
    115120      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    116121      OperatorGraph = new OperatorGraph();
     122      InitializeEngine();
    117123    }
    118124    protected EngineAlgorithm(string name, string description, ParameterCollection parameters)
     
    121127      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    122128      OperatorGraph = new OperatorGraph();
     129      InitializeEngine();
     130    }
     131
     132    private void InitializeEngine() {
     133      var types = ApplicationManager.Manager.GetTypes(typeof(IEngine));
     134      Type t = types.FirstOrDefault(x => x.Name.Equals("SequentialEngine"));
     135      if (t == null) t = types.FirstOrDefault();
     136      if (t != null) Engine = (IEngine)Activator.CreateInstance(t);
    123137    }
    124138
  • trunk/sources/HeuristicLab.PluginInfrastructure/Main.cs

    r2790 r2916  
    9999
    100100    private static string BuildErrorMessage(Exception ex) {
     101      string nl = Environment.NewLine;
    101102      StringBuilder sb = new StringBuilder();
    102       sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace);
     103      sb.Append("Sorry, but something went wrong!" +  nl + ex.Message + nl + ex.StackTrace);
    103104
    104105      while (ex.InnerException != null) {
    105106        ex = ex.InnerException;
    106         sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace);
     107        sb.Append(nl + "-----" + nl + ex.Message + nl + ex.StackTrace);
    107108      }
    108109      return sb.ToString();
Note: See TracChangeset for help on using the changeset viewer.