Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2834


Ignore:
Timestamp:
02/19/10 06:19:16 (15 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on operators, engines, and optimization
Location:
trunk/sources
Files:
17 added
54 edited
6 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab 3.3.sln

    r2830 r2834  
    151151EndProject
    152152Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.SGA-3.3.Tests", "HeuristicLab.SGA\3.3\Tests\HeuristicLab.SGA-3.3.Tests.csproj", "{F42F3576-7233-4B28-90F7-36AE15F30F92}"
     153EndProject
     154Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Optimization-3.3", "HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj", "{14AB8D24-25BC-400C-A846-4627AA945192}"
     155EndProject
     156Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Optimization.Views-3.3", "HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj", "{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}"
    153157EndProject
    154158Global
     
    675679    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Release|x64.ActiveCfg = Release|Any CPU
    676680    {F42F3576-7233-4B28-90F7-36AE15F30F92}.Release|x86.ActiveCfg = Release|Any CPU
     681    {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     682    {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|Any CPU.Build.0 = Debug|Any CPU
     683    {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|x64.ActiveCfg = Debug|Any CPU
     684    {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|x86.ActiveCfg = Debug|Any CPU
     685    {14AB8D24-25BC-400C-A846-4627AA945192}.Release|Any CPU.ActiveCfg = Release|Any CPU
     686    {14AB8D24-25BC-400C-A846-4627AA945192}.Release|Any CPU.Build.0 = Release|Any CPU
     687    {14AB8D24-25BC-400C-A846-4627AA945192}.Release|x64.ActiveCfg = Release|Any CPU
     688    {14AB8D24-25BC-400C-A846-4627AA945192}.Release|x86.ActiveCfg = Release|Any CPU
     689    {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     690    {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
     691    {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|x64.ActiveCfg = Debug|Any CPU
     692    {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|x86.ActiveCfg = Debug|Any CPU
     693    {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
     694    {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|Any CPU.Build.0 = Release|Any CPU
     695    {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|x64.ActiveCfg = Release|Any CPU
     696    {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|x86.ActiveCfg = Release|Any CPU
    677697  EndGlobalSection
    678698  GlobalSection(SolutionProperties) = preSolution
  • trunk/sources/HeuristicLab 3.3/Files.txt

    r2805 r2834  
    2323HeuristicLab.Operators.Views.GraphVisualization\3.3:HeuristicLab.Operators.Views.GraphVisualization-3.3.dll
    2424HeuristicLab.Operators.Programmable\3.3:HeuristicLab.Operators.Programmable-3.3.dll
     25HeuristicLab.Optimization\3.3:HeuristicLab.Optimization-3.3.dll
     26HeuristicLab.Optimization.Views\3.3:HeuristicLab.Optimization.Views-3.3.dll
    2527HeuristicLab.Optimizer\3.3:HeuristicLab.Optimizer-3.3.dll
    2628HeuristicLab.Parameters\3.3:HeuristicLab.Parameters-3.3.dll
  • trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.Designer.cs

    r2826 r2834  
    5454      this.startButton = new System.Windows.Forms.Button();
    5555      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    56       this.newProblemButton = new System.Windows.Forms.Button();
    57       this.openProblemButton = new System.Windows.Forms.Button();
    58       this.saveProblemButton = new System.Windows.Forms.Button();
    5956      this.newOperatorGraphButton = new System.Windows.Forms.Button();
    6057      this.openOperatorGraphButton = new System.Windows.Forms.Button();
     
    6461      this.operatorGraphViewHost = new HeuristicLab.Core.Views.ViewHost();
    6562      this.globalScopeTabPage = new System.Windows.Forms.TabPage();
    66       this.problemTabPage = new System.Windows.Forms.TabPage();
    67       this.problemViewHost = new HeuristicLab.Core.Views.ViewHost();
    6863      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    6964      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
     
    7166      this.operatorGraphTabPage.SuspendLayout();
    7267      this.globalScopeTabPage.SuspendLayout();
    73       this.problemTabPage.SuspendLayout();
    7468      this.SuspendLayout();
    7569      //
     
    142136      this.startButton.Click += new System.EventHandler(this.startButton_Click);
    143137      //
    144       // newProblemButton
    145       //
    146       this.newProblemButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.NewDocument;
    147       this.newProblemButton.Location = new System.Drawing.Point(6, 6);
    148       this.newProblemButton.Name = "newProblemButton";
    149       this.newProblemButton.Size = new System.Drawing.Size(24, 24);
    150       this.newProblemButton.TabIndex = 0;
    151       this.toolTip.SetToolTip(this.newProblemButton, "Create New Problem");
    152       this.newProblemButton.UseVisualStyleBackColor = true;
    153       this.newProblemButton.Click += new System.EventHandler(this.newProblemButton_Click);
    154       //
    155       // openProblemButton
    156       //
    157       this.openProblemButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Open;
    158       this.openProblemButton.Location = new System.Drawing.Point(36, 6);
    159       this.openProblemButton.Name = "openProblemButton";
    160       this.openProblemButton.Size = new System.Drawing.Size(24, 24);
    161       this.openProblemButton.TabIndex = 1;
    162       this.toolTip.SetToolTip(this.openProblemButton, "Open Problem");
    163       this.openProblemButton.UseVisualStyleBackColor = true;
    164       this.openProblemButton.Click += new System.EventHandler(this.openProblemButton_Click);
    165       //
    166       // saveProblemButton
    167       //
    168       this.saveProblemButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
    169       this.saveProblemButton.Location = new System.Drawing.Point(66, 6);
    170       this.saveProblemButton.Name = "saveProblemButton";
    171       this.saveProblemButton.Size = new System.Drawing.Size(24, 24);
    172       this.saveProblemButton.TabIndex = 2;
    173       this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");
    174       this.saveProblemButton.UseVisualStyleBackColor = true;
    175       this.saveProblemButton.Click += new System.EventHandler(this.saveProblemButton_Click);
    176       //
    177138      // newOperatorGraphButton
    178139      //
     
    215176      this.tabControl.Controls.Add(this.operatorGraphTabPage);
    216177      this.tabControl.Controls.Add(this.globalScopeTabPage);
    217       this.tabControl.Controls.Add(this.problemTabPage);
    218178      this.tabControl.Location = new System.Drawing.Point(0, 0);
    219179      this.tabControl.Name = "tabControl";
     
    258218      this.globalScopeTabPage.Text = "Global Scope";
    259219      this.globalScopeTabPage.UseVisualStyleBackColor = true;
    260       //
    261       // problemTabPage
    262       //
    263       this.problemTabPage.Controls.Add(this.saveProblemButton);
    264       this.problemTabPage.Controls.Add(this.openProblemButton);
    265       this.problemTabPage.Controls.Add(this.newProblemButton);
    266       this.problemTabPage.Controls.Add(this.problemViewHost);
    267       this.problemTabPage.Location = new System.Drawing.Point(4, 22);
    268       this.problemTabPage.Name = "problemTabPage";
    269       this.problemTabPage.Padding = new System.Windows.Forms.Padding(3);
    270       this.problemTabPage.Size = new System.Drawing.Size(794, 584);
    271       this.problemTabPage.TabIndex = 2;
    272       this.problemTabPage.Text = "Problem";
    273       this.problemTabPage.UseVisualStyleBackColor = true;
    274       //
    275       // problemViewHost
    276       //
    277       this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    278                   | System.Windows.Forms.AnchorStyles.Left)
    279                   | System.Windows.Forms.AnchorStyles.Right)));
    280       this.problemViewHost.Content = null;
    281       this.problemViewHost.Location = new System.Drawing.Point(6, 36);
    282       this.problemViewHost.Name = "problemViewHost";
    283       this.problemViewHost.Size = new System.Drawing.Size(782, 542);
    284       this.problemViewHost.TabIndex = 3;
    285       this.problemViewHost.ViewType = null;
    286220      //
    287221      // openFileDialog
     
    315249      this.operatorGraphTabPage.ResumeLayout(false);
    316250      this.globalScopeTabPage.ResumeLayout(false);
    317       this.problemTabPage.ResumeLayout(false);
    318251      this.ResumeLayout(false);
    319252      this.PerformLayout();
     
    332265    protected System.Windows.Forms.TabControl tabControl;
    333266    protected System.Windows.Forms.TabPage globalScopeTabPage;
    334     protected System.Windows.Forms.TabPage problemTabPage;
    335     protected ViewHost problemViewHost;
    336     protected System.Windows.Forms.Button newProblemButton;
    337     protected System.Windows.Forms.Button saveProblemButton;
    338     protected System.Windows.Forms.Button openProblemButton;
    339267    protected System.Windows.Forms.OpenFileDialog openFileDialog;
    340268    protected System.Windows.Forms.SaveFileDialog saveFileDialog;
  • trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.cs

    r2826 r2834  
    6262    protected override void DeregisterContentEvents() {
    6363      Content.OperatorGraphChanged -= new EventHandler(Content_OperatorGraphChanged);
    64       Content.ProblemChanged -= new EventHandler(Content_ProblemChanged);
    6564      Content.Prepared -= new EventHandler(Content_Prepared);
    6665      Content.Started -= new EventHandler(Content_Started);
     
    7877      base.RegisterContentEvents();
    7978      Content.OperatorGraphChanged += new EventHandler(Content_OperatorGraphChanged);
    80       Content.ProblemChanged += new EventHandler(Content_ProblemChanged);
    8179      Content.Prepared += new EventHandler(Content_Prepared);
    8280      Content.Started += new EventHandler(Content_Started);
     
    9795        operatorGraphViewHost.Enabled = false;
    9896        scopeView.Enabled = false;
    99         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false;
    100         problemViewHost.Enabled = false;
    10197        startButton.Enabled = resetButton.Enabled = false;
    10298        executionTimeTextBox.Enabled = false;
     
    107103        scopeView.Content = Content.GlobalScope;
    108104        scopeView.Enabled = true;
    109         newProblemButton.Enabled = openProblemButton.Enabled = true;
    110         saveProblemButton.Enabled = Content.Problem != null;
    111         problemViewHost.Content = Content.Problem;
    112         problemViewHost.Enabled = true;
    113105        startButton.Enabled = !Content.Finished;
    114106        resetButton.Enabled = true;
     
    124116      else
    125117        operatorGraphViewHost.Content = Content.OperatorGraph;
    126     }
    127     protected void Content_ProblemChanged(object sender, EventArgs e) {
    128       if (InvokeRequired)
    129         Invoke(new EventHandler(Content_ProblemChanged), sender, e);
    130       else {
    131         saveProblemButton.Enabled = Content.Problem != null;
    132         problemViewHost.Content = Content.Problem;
    133       }
    134118    }
    135119    protected virtual void Content_Prepared(object sender, EventArgs e) {
     
    140124        operatorGraphViewHost.Enabled = true;
    141125        scopeView.Enabled = true;
    142         newProblemButton.Enabled = openProblemButton.Enabled = true;
    143         saveProblemButton.Enabled = Content.Problem != null;
    144         problemViewHost.Enabled = true;
    145126        startButton.Enabled = !Content.Finished;
    146127        stopButton.Enabled = false;
     
    157138        operatorGraphViewHost.Enabled = false;
    158139        scopeView.Enabled = false;
    159         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false;
    160         problemViewHost.Enabled = false;
    161140        startButton.Enabled = false;
    162141        stopButton.Enabled = true;
     
    172151        operatorGraphViewHost.Enabled = true;
    173152        scopeView.Enabled = true;
    174         newProblemButton.Enabled = openProblemButton.Enabled = true;
    175         saveProblemButton.Enabled = Content.Problem != null;
    176         problemViewHost.Enabled = true;
    177153        startButton.Enabled = !Content.Finished;
    178154        stopButton.Enabled = false;
     
    230206      }
    231207    }
    232     protected void newProblemButton_Click(object sender, EventArgs e) {
    233       if (typeSelectorDialog == null) {
    234         typeSelectorDialog = new TypeSelectorDialog();
    235       }
    236       typeSelectorDialog.Caption = "Select Problem";
    237       typeSelectorDialog.TypeSelector.Configure(typeof(IProblem), false, false);
    238 
    239       if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    240         Content.Problem = (IProblem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    241       }
    242     }
    243     protected void openProblemButton_Click(object sender, EventArgs e) {
    244       openFileDialog.Title = "Open Problem";
    245       if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    246         IProblem problem = null;
    247         try {
    248           problem = XmlParser.Deserialize(openFileDialog.FileName) as IProblem;
    249         }
    250         catch (Exception ex) {
    251           Auxiliary.ShowErrorMessageBox(ex);
    252         }
    253         if (problem == null)
    254           MessageBox.Show(this, "Selected file does not contain a problem.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);
    255         else
    256           Content.Problem = problem;
    257       }
    258     }
    259     protected void saveProblemButton_Click(object sender, EventArgs e) {
    260       saveFileDialog.Title = "Save Problem";
    261       if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
    262         try {
    263           if (saveFileDialog.FilterIndex == 1)
    264             XmlGenerator.Serialize(Content.Problem, saveFileDialog.FileName, 0);
    265           else
    266             XmlGenerator.Serialize(Content.Problem, saveFileDialog.FileName, 9);
    267         }
    268         catch (Exception ex) {
    269           Auxiliary.ShowErrorMessageBox(ex);
    270         }
    271       }
    272     }
    273208    protected virtual void startButton_Click(object sender, EventArgs e) {
    274209      Content.Start();
  • trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj

    r2805 r2834  
    131131      <DependentUpon>OperatorTreeView.cs</DependentUpon>
    132132    </Compile>
    133     <Compile Include="ProblemView.cs">
    134       <SubType>UserControl</SubType>
    135     </Compile>
    136     <Compile Include="ProblemView.Designer.cs">
    137       <DependentUpon>ProblemView.cs</DependentUpon>
    138     </Compile>
    139133    <Compile Include="TypeSelectorDialog.cs">
    140134      <SubType>Form</SubType>
  • trunk/sources/HeuristicLab.Core/3.3/Engine.cs

    r2796 r2834  
    7171
    7272    [Storable]
    73     private IProblem problem;
    74     /// <summary>
    75     /// Gets or sets the current problem.
    76     /// </summary>
    77     public IProblem Problem {
    78       get { return problem; }
    79       set {
    80         if (value == null) throw new ArgumentNullException();
    81         if (value != problem) {
    82           problem = value;
    83           OnProblemChanged();
    84           Prepare();
    85         }
    86       }
    87     }
    88 
    89     [Storable]
    9073    private TimeSpan executionTime;
    9174    /// <summary>
     
    10588    /// </summary>
    10689    [Storable]
    107     private Stack<IExecutionSequence> executionStack;
     90    private Stack<IOperation> executionStack;
    10891    /// <summary>
    10992    /// Gets the current execution stack.
    11093    /// </summary>
    111     protected Stack<IExecutionSequence> ExecutionStack {
     94    protected Stack<IOperation> ExecutionStack {
    11295      get { return executionStack; }
    11396    }
     
    146129    protected Engine() {
    147130      globalScope = new Scope("Global");
    148       problem = null;
    149       executionStack = new Stack<IExecutionSequence>();
     131      executionStack = new Stack<IOperation>();
    150132      OperatorGraph = new OperatorGraph();
    151133    }
     
    162144      clone.OperatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
    163145      clone.globalScope = (Scope)cloner.Clone(globalScope);
    164       clone.problem = (IProblem)cloner.Clone(problem);
    165146      clone.executionTime = executionTime;
    166       IExecutionSequence[] contexts = executionStack.ToArray();
     147      IOperation[] contexts = executionStack.ToArray();
    167148      for (int i = contexts.Length - 1; i >= 0; i--)
    168         clone.executionStack.Push((IExecutionSequence)cloner.Clone(contexts[i]));
     149        clone.executionStack.Push((IOperation)cloner.Clone(contexts[i]));
    169150      clone.running = running;
    170151      clone.canceled = canceled;
     
    172153    }
    173154
     155    public void Prepare(IOperation initialOperation) {
     156      canceled = false;
     157      running = false;
     158      globalScope.Clear();
     159      ExecutionTime = new TimeSpan();
     160      executionStack.Clear();
     161      if (initialOperation != null)
     162        executionStack.Push(initialOperation);
     163      OnPrepared();
     164    }
    174165    /// <inheritdoc/>
    175166    /// <remarks>Sets <c>myCanceled</c> and <c>myRunning</c> to <c>false</c>. The global scope is cleared,
     
    178169    /// Calls <see cref="OnPrepared"/>.</remarks>
    179170    public void Prepare() {
    180       canceled = false;
    181       running = false;
    182       globalScope.Clear();
    183       ExecutionTime = new TimeSpan();
    184       executionStack.Clear();
    185       if ((OperatorGraph.InitialOperator != null) && (Problem != null))
    186         executionStack.Push(new ExecutionContext(null, OperatorGraph.InitialOperator, GlobalScope, Problem));
    187       OnPrepared();
     171      if (OperatorGraph.InitialOperator != null)
     172        Prepare(new ExecutionContext(null, OperatorGraph.InitialOperator, GlobalScope));
    188173    }
    189174    /// <inheritdoc/>
     
    254239    }
    255240    /// <summary>
    256     /// Occurs when the problem was changed.
    257     /// </summary>
    258     public event EventHandler ProblemChanged;
    259     /// <summary>
    260     /// Fires a new <c>ProblemChanged</c> event.
    261     /// </summary>
    262     protected virtual void OnProblemChanged() {
    263       if (ProblemChanged != null)
    264         ProblemChanged(this, EventArgs.Empty);
    265     }
    266     /// <summary>
    267241    /// Occurs when the execution time changed.
    268242    /// </summary>
  • trunk/sources/HeuristicLab.Core/3.3/ExecutionContext.cs

    r2796 r2834  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
     23using HeuristicLab.Collections;
    2524using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2625
    2726namespace HeuristicLab.Core {
    28   public class ExecutionContext : DeepCloneable, IExecutionSequence {
     27  public class ExecutionContext : DeepCloneable, IExecutionContext, IAtomicOperation {
    2928    [Storable]
    30     private ExecutionContext parent;
    31     public ExecutionContext Parent {
     29    private IParameterizedItem parameterizedItem;
     30
     31    [Storable]
     32    private IExecutionContext parent;
     33    public IExecutionContext Parent {
    3234      get { return parent; }
    3335    }
    3436
    35     [Storable]
    36     private IOperator op;
     37    public IObservableKeyedCollection<string, IParameter> Parameters {
     38      get { return parameterizedItem.Parameters; }
     39    }
     40
    3741    public IOperator Operator {
    38       get { return op; }
     42      get { return parameterizedItem as IOperator; }
    3943    }
    4044
     
    4549    }
    4650
    47     [Storable]
    48     private IProblem problem;
    49     public IProblem Problem {
    50       get { return problem; }
    51     }
    52 
    5351    private ExecutionContext() {
    5452      parent = null;
    55       op = null;
     53      parameterizedItem = null;
    5654      scope = null;
    57       problem = null;
    5855    }
    59     public ExecutionContext(ExecutionContext parent, IOperator op, IScope scope, IProblem problem) {
    60       if ((op == null) || (scope == null) || (problem == null)) throw new ArgumentNullException();
     56    public ExecutionContext(IExecutionContext parent, IParameterizedItem parameterizedItem, IScope scope) {
     57      if ((parameterizedItem == null) || (scope == null)) throw new ArgumentNullException();
    6158      this.parent = parent;
    62       this.op = op;
     59      this.parameterizedItem = parameterizedItem;
    6360      this.scope = scope;
    64       this.problem = problem;
    6561    }
    6662
     
    6864      ExecutionContext clone = new ExecutionContext();
    6965      cloner.RegisterClonedObject(this, clone);
    70       clone.parent = (ExecutionContext)cloner.Clone(parent);
    71       clone.op = (IOperator)cloner.Clone(op);
     66      clone.parent = (IExecutionContext)cloner.Clone(parent);
     67      clone.parameterizedItem = (IParameterizedItem)cloner.Clone(parameterizedItem);
    7268      clone.scope = (IScope)cloner.Clone(scope);
    73       clone.problem = (IProblem)cloner.Clone(problem);
    7469      return clone;
    7570    }
    7671
    77     public ExecutionContext CreateContext(IOperator op) {
    78       return new ExecutionContext(parent, op, scope, problem);
     72    public IAtomicOperation CreateOperation(IOperator op) {
     73      return new ExecutionContext(parent, op, scope);
    7974    }
    80     public ExecutionContext CreateContext(IOperator op, IScope scope) {
    81       return new ExecutionContext(parent, op, scope, problem);
     75    public IAtomicOperation CreateOperation(IOperator op, IScope scope) {
     76      return new ExecutionContext(parent, op, scope);
    8277    }
    83     public ExecutionContext CreateChildContext(IOperator op) {
    84       return new ExecutionContext(this, op, scope, problem);
     78    public IAtomicOperation CreateChildOperation(IOperator op) {
     79      return new ExecutionContext(this, op, scope);
    8580    }
    86     public ExecutionContext CreateChildContext(IOperator op, IScope scope) {
    87       return new ExecutionContext(this, op, scope, problem);
     81    public IAtomicOperation CreateChildOperation(IOperator op, IScope scope) {
     82      return new ExecutionContext(this, op, scope);
    8883    }
    8984  }
  • trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj

    r2805 r2834  
    104104    <Compile Include="ChangedEventArgs.cs" />
    105105    <None Include="HeuristicLabCorePlugin.cs.frame" />
     106    <Compile Include="Interfaces\IParameterizedItem.cs" />
     107    <Compile Include="Interfaces\IAtomicOperation.cs" />
     108    <Compile Include="Interfaces\IExecutionContext.cs" />
     109    <Compile Include="Interfaces\IOperation.cs" />
     110    <Compile Include="OperationCollection.cs" />
    106111    <Compile Include="ValueParameterCollection.cs" />
    107     <Compile Include="Interfaces\IProblem.cs" />
    108     <Compile Include="Interfaces\IExecutionSequence.cs" />
    109112    <Compile Include="Interfaces\IValueLookupParameter.cs" />
    110113    <Compile Include="Interfaces\IValueParameter.cs" />
     
    117120    <Compile Include="Item.cs" />
    118121    <Compile Include="NamedItem.cs" />
    119     <Compile Include="Problem.cs" />
    120122    <Compile Include="OperatorGraph.cs" />
    121123    <Compile Include="Interfaces\IParameter.cs" />
     
    128130      <SubType>Code</SubType>
    129131    </Compile>
    130     <Compile Include="ExecutionContextCollection.cs" />
    131132    <Compile Include="ExecutionContext.cs" />
    132133    <Compile Include="OperatorList.cs" />
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IEngine.cs

    r2796 r2834  
    3838    /// </summary>
    3939    IScope GlobalScope { get; }
    40     /// <summary>
    41     /// Gets the problem of the current instance.
    42     /// </summary>
    43     IProblem Problem { get; set; }
    4440
    4541    /// <summary>
     
    6258    void Prepare();
    6359    /// <summary>
     60    /// Prepares the engine with a given initial operation.
     61    /// </summary>
     62    void Prepare(IOperation initialOperation);
     63    /// <summary>
    6464    /// Executes the whole run.
    6565    /// </summary>
     
    7878    /// </summary>
    7979    event EventHandler OperatorGraphChanged;
    80     /// <summary>
    81     /// Occurs when the problem was changed.
    82     /// </summary>
    83     event EventHandler ProblemChanged;
    8480    /// <summary>
    8581    /// Occurs when the execution time was changed.
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IOperation.cs

    r2829 r2834  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.ComponentModel;
    25 using System.Text;
    26 using System.Drawing;
    27 
    2822namespace HeuristicLab.Core {
    2923  /// <summary>
    30   /// Interface which represents an execution context.
     24  /// Interface which represents an operation.
    3125  /// </summary>
    32   public interface IExecutionSequence : IDeepCloneable { }
     26  public interface IOperation : IDeepCloneable { }
    3327}
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IOperator.cs

    r2790 r2834  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    25 using HeuristicLab.Common;
    26 using HeuristicLab.Collections;
    2723
    2824namespace HeuristicLab.Core {
     
    3127  /// a basic instruction of an algorithm.
    3228  /// </summary>
    33   public interface IOperator : INamedItem {
    34     IObservableKeyedCollection<string, IParameter> Parameters { get; }
    35 
     29  public interface IOperator : INamedItem, IParameterizedItem {
    3630    /// <summary>
    3731    /// Gets or sets a boolean value whether the engine should stop here during the run.
     
    4438    /// <param name="scope">The scope where to execute the current instance.</param>
    4539    /// <returns>The next operation.</returns>
    46     IExecutionSequence Execute(ExecutionContext context);
     40    IOperation Execute(IExecutionContext context);
    4741    /// <summary>
    4842    /// Aborts the current operator.
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IParameter.cs

    r2790 r2834  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    25 using System.Xml;
    26 using HeuristicLab.Common;
    2723
    2824namespace HeuristicLab.Core {
     
    3026    Type DataType { get; }
    3127    IItem ActualValue { get; set; }
    32     ExecutionContext ExecutionContext { get; set; }
     28    IExecutionContext ExecutionContext { get; set; }
    3329  }
    3430}
  • trunk/sources/HeuristicLab.Core/3.3/NamedItemCollection.cs

    r2833 r2834  
    2121
    2222using System;
    23 using System.Linq;
    2423using System.Collections.Generic;
    2524using System.Drawing;
     25using System.Linq;
    2626using HeuristicLab.Collections;
    2727using HeuristicLab.Common;
  • trunk/sources/HeuristicLab.Core/3.3/OperationCollection.cs

    r2829 r2834  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423using System.Linq;
    25 using System.Text;
    26 using System.Xml;
    2724using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2825
    2926namespace HeuristicLab.Core {
    30   public class ExecutionContextCollection : DeepCloneable, IList<IExecutionSequence>, IExecutionSequence {
     27  public class OperationCollection : DeepCloneable, IList<IOperation>, IOperation {
    3128    [Storable]
    32     private IList<IExecutionSequence> contexts;
     29    private IList<IOperation> operations;
    3330
    3431    [Storable]
     
    3936    }
    4037
    41     public ExecutionContextCollection() {
    42       contexts = new List<IExecutionSequence>();
     38    public OperationCollection() {
     39      operations = new List<IOperation>();
    4340      parallel = false;
    4441    }
    45     public ExecutionContextCollection(IEnumerable<IExecutionSequence> collection) {
    46       contexts = new List<IExecutionSequence>(collection.Where(e => e != null));
     42    public OperationCollection(IEnumerable<IOperation> collection) {
     43      operations = new List<IOperation>(collection.Where(e => e != null));
    4744      parallel = false;
    4845    }
    49     public ExecutionContextCollection(params IExecutionSequence[] list) {
    50       contexts = new List<IExecutionSequence>(list.Where(e => e != null));
     46    public OperationCollection(params IOperation[] list) {
     47      operations = new List<IOperation>(list.Where(e => e != null));
    5148      parallel = false;
    5249    }
    5350
    5451    public override IDeepCloneable Clone(Cloner cloner) {
    55       ExecutionContextCollection clone = new ExecutionContextCollection();
     52      OperationCollection clone = new OperationCollection(this.Select(x => (IOperation)cloner.Clone(x)));
    5653      cloner.RegisterClonedObject(this, clone);
    5754      clone.parallel = parallel;
    58       for (int i = 0; i < contexts.Count; i++)
    59         clone.contexts.Add((IExecutionSequence)cloner.Clone(contexts[i]));
    6055      return clone;
    6156    }
    6257
    63     #region IList<IExecutionContext> Members
    64     public int IndexOf(IExecutionSequence item) {
    65       return contexts.IndexOf(item);
     58    #region IList<IOperation> Members
     59    public int IndexOf(IOperation item) {
     60      return operations.IndexOf(item);
    6661    }
    67     public void Insert(int index, IExecutionSequence item) {
    68       if (item != null) contexts.Insert(index, item);
     62    public void Insert(int index, IOperation item) {
     63      if (item != null) operations.Insert(index, item);
    6964    }
    7065    public void RemoveAt(int index) {
    71       contexts.RemoveAt(index);
     66      operations.RemoveAt(index);
    7267    }
    73     public IExecutionSequence this[int index] {
    74       get { return contexts[index]; }
    75       set { if (value != null) contexts[index] = value; }
     68    public IOperation this[int index] {
     69      get { return operations[index]; }
     70      set { if (value != null) operations[index] = value; }
    7671    }
    7772    #endregion
    7873
    79     #region ICollection<IExecutionContext> Members
    80     public void Add(IExecutionSequence item) {
    81       if (item != null) contexts.Add(item);
     74    #region ICollection<IOperation> Members
     75    public void Add(IOperation item) {
     76      if (item != null) operations.Add(item);
    8277    }
    8378    public void Clear() {
    84       contexts.Clear();
     79      operations.Clear();
    8580    }
    86     public bool Contains(IExecutionSequence item) {
    87       return contexts.Contains(item);
     81    public bool Contains(IOperation item) {
     82      return operations.Contains(item);
    8883    }
    89     public void CopyTo(IExecutionSequence[] array, int arrayIndex) {
    90       contexts.CopyTo(array, arrayIndex);
     84    public void CopyTo(IOperation[] array, int arrayIndex) {
     85      operations.CopyTo(array, arrayIndex);
    9186    }
    9287    public int Count {
    93       get { return contexts.Count; }
     88      get { return operations.Count; }
    9489    }
    9590    public bool IsReadOnly {
    96       get { return contexts.IsReadOnly; }
     91      get { return operations.IsReadOnly; }
    9792    }
    98     public bool Remove(IExecutionSequence item) {
    99       return contexts.Remove(item);
     93    public bool Remove(IOperation item) {
     94      return operations.Remove(item);
    10095    }
    10196    #endregion
    10297
    103     #region IEnumerable<IExecutionContext> Members
    104     public IEnumerator<IExecutionSequence> GetEnumerator() {
    105       return contexts.GetEnumerator();
     98    #region IEnumerable<IOperation> Members
     99    public IEnumerator<IOperation> GetEnumerator() {
     100      return operations.GetEnumerator();
    106101    }
    107102    #endregion
     
    109104    #region IEnumerable Members
    110105    System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
    111       return contexts.GetEnumerator();
     106      return operations.GetEnumerator();
    112107    }
    113108    #endregion
  • trunk/sources/HeuristicLab.Evolutionary/3.3/ChildrenCreator.cs

    r2818 r2834  
    6060    }
    6161
    62     public override IExecutionSequence Apply() {
     62    public override IOperation Apply() {
    6363      int parentsPerChild = ParentsPerChildParameter.ActualValue.Value;
    6464      int parents = CurrentScope.SubScopes.Count;
  • trunk/sources/HeuristicLab.Evolutionary/3.3/PopulationCreator.cs

    r2830 r2834  
    5959    }
    6060
    61     public override IExecutionSequence Apply() {
     61    public override IOperation Apply() {
    6262      int size = PopulationSizeParameter.ActualValue.Value;
    6363      IOperator creator = SolutionCreatorParameter.ActualValue;
     
    6969        CurrentScope.SubScopes.Add(new Scope(i.ToString()));
    7070
    71       ExecutionContextCollection next = new ExecutionContextCollection();
     71      OperationCollection next = new OperationCollection();
    7272      for (int i = 0; i < CurrentScope.SubScopes.Count; i++) {
    73         if (creator != null) next.Add(ExecutionContext.CreateContext(creator, CurrentScope.SubScopes[i]));
    74         if (evaluator != null) next.Add(ExecutionContext.CreateContext(evaluator, CurrentScope.SubScopes[i]));
     73        if (creator != null) next.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[i]));
     74        if (evaluator != null) next.Add(ExecutionContext.CreateOperation(evaluator, CurrentScope.SubScopes[i]));
    7575      }
    7676      next.Add(base.Apply());
  • trunk/sources/HeuristicLab.Operators.Views/3.3/AlgorithmOperatorView.cs

    r2830 r2834  
    2828  /// The base class for visual representations of items.
    2929  /// </summary>
    30   [Content(typeof(CombinedOperator), true)]
     30  [Content(typeof(AlgorithmOperator), true)]
    3131  public partial class AlgorithmOperatorView : NamedItemView {
    3232    public new AlgorithmOperator Content {
  • trunk/sources/HeuristicLab.Operators/3.3/AlgorithmOperator.cs

    r2830 r2834  
    5050    }
    5151
    52     public override IExecutionSequence Apply() {
    53       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
     52    public override IOperation Apply() {
     53      OperationCollection next = new OperationCollection(base.Apply());
    5454      if (operatorGraph.InitialOperator != null)
    55         next.Insert(0, ExecutionContext.CreateChildContext(operatorGraph.InitialOperator));
     55        next.Insert(0, ExecutionContext.CreateChildOperation(operatorGraph.InitialOperator));
    5656      return next;
    5757    }
  • trunk/sources/HeuristicLab.Operators/3.3/Assigner.cs

    r2794 r2834  
    4545    }
    4646
    47     public override IExecutionSequence Apply() {
     47    public override IOperation Apply() {
    4848      LeftSideParameter.ActualValue = (IItem)RightSideParameter.ActualValue.Clone();
    4949      return base.Apply();
  • trunk/sources/HeuristicLab.Operators/3.3/CombinedOperator.cs

    r2830 r2834  
    2020#endregion
    2121
    22 using System.Drawing;
    2322using HeuristicLab.Collections;
    2423using HeuristicLab.Core;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2624
    2725namespace HeuristicLab.Operators {
     
    3129  [Item("CombinedOperator", "An operator which contains an operator graph.")]
    3230  [Creatable("Test")]
    33   public sealed class CombinedOperator : AlgorithmOperator, IOperator {
     31  public sealed class CombinedOperator : AlgorithmOperator, IParameterizedItem {
    3432    public new ParameterCollection Parameters {
    3533      get {
     
    3735      }
    3836    }
    39     IObservableKeyedCollection<string, IParameter> IOperator.Parameters {
     37    IObservableKeyedCollection<string, IParameter> IParameterizedItem.Parameters {
    4038      get { return Parameters; }
    4139    }
  • trunk/sources/HeuristicLab.Operators/3.3/Comparator.cs

    r2831 r2834  
    5959    }
    6060
    61     public override IExecutionSequence Apply() {
     61    public override IOperation Apply() {
    6262      IItem left = LeftSideParameter.ActualValue;
    6363      IItem right = RightSideParameter.ActualValue;
  • trunk/sources/HeuristicLab.Operators/3.3/ConditionalBranch.cs

    r2796 r2834  
    5858    }
    5959
    60     public override IExecutionSequence Apply() {
    61       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
     60    public override IOperation Apply() {
     61      OperationCollection next = new OperationCollection(base.Apply());
    6262      if (ConditionParameter.ActualValue.Value) {
    63         if (TrueBranch != null) next.Insert(0, ExecutionContext.CreateContext(TrueBranch));
     63        if (TrueBranch != null) next.Insert(0, ExecutionContext.CreateOperation(TrueBranch));
    6464      } else {
    65         if (FalseBranch != null) next.Insert(0, ExecutionContext.CreateContext(FalseBranch));
     65        if (FalseBranch != null) next.Insert(0, ExecutionContext.CreateOperation(FalseBranch));
    6666      }
    6767      return next;
  • trunk/sources/HeuristicLab.Operators/3.3/DoubleCounter.cs

    r2794 r2834  
    5050    }
    5151
    52     public override IExecutionSequence Apply() {
     52    public override IOperation Apply() {
    5353      if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new DoubleData();
    5454      ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value;
  • trunk/sources/HeuristicLab.Operators/3.3/IntCounter.cs

    r2794 r2834  
    5050    }
    5151
    52     public override IExecutionSequence Apply() {
     52    public override IOperation Apply() {
    5353      if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntData();
    5454      ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value;
  • trunk/sources/HeuristicLab.Operators/3.3/Operator.cs

    r2805 r2834  
    5151    }
    5252    private ReadOnlyObservableKeyedCollection<string, IParameter> readOnlyParameters;
    53     IObservableKeyedCollection<string, IParameter> IOperator.Parameters {
     53    IObservableKeyedCollection<string, IParameter> IParameterizedItem.Parameters {
    5454      get {
    5555        if (readOnlyParameters == null) readOnlyParameters = parameters.AsReadOnly();
     
    5959
    6060    [Storable]
    61     private ExecutionContext executionContext;
    62     protected ExecutionContext ExecutionContext {
     61    private IExecutionContext executionContext;
     62    protected IExecutionContext ExecutionContext {
    6363      get { return executionContext; }
    6464      private set {
     
    122122      clone.canceled = canceled;
    123123      clone.breakpoint = breakpoint;
    124       clone.executionContext = (ExecutionContext)cloner.Clone(executionContext);
     124      clone.executionContext = (IExecutionContext)cloner.Clone(executionContext);
    125125      return clone;
    126126    }
    127127
    128128    /// <inheritdoc/>
    129     public virtual IExecutionSequence Execute(ExecutionContext context) {
     129    public virtual IOperation Execute(IExecutionContext context) {
    130130      try {
    131131        Canceled = false;
     
    133133        foreach (IParameter param in Parameters)
    134134          param.ExecutionContext = context;
    135         IExecutionSequence next = Apply();
     135        IOperation next = Apply();
    136136        OnExecuted();
    137137        return next;
     
    153153    /// <param name="scope">The scope where to execute the operator</param>
    154154    /// <returns><c>null</c>.</returns>
    155     public abstract IExecutionSequence Apply();
     155    public abstract IOperation Apply();
    156156
    157157    protected virtual void OnExecutionContextChanged() { }
  • trunk/sources/HeuristicLab.Operators/3.3/ParallelSubScopesProcessor.cs

    r2830 r2834  
    3333    }
    3434
    35     public override IExecutionSequence Apply() {
    36       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
     35    public override IOperation Apply() {
     36      OperationCollection next = new OperationCollection(base.Apply());
    3737      if (Operators.Count > 0) {
    38         ExecutionContextCollection inner = new ExecutionContextCollection();
     38        OperationCollection inner = new OperationCollection();
    3939        inner.Parallel = true;
    4040        for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++)
    41           if (Operators[i] != null) inner.Add(ExecutionContext.CreateContext(Operators[i], ExecutionContext.Scope.SubScopes[i]));
     41          if (Operators[i] != null) inner.Add(ExecutionContext.CreateOperation(Operators[i], ExecutionContext.Scope.SubScopes[i]));
    4242        next.Insert(0, inner);
    4343      }
  • trunk/sources/HeuristicLab.Operators/3.3/Placeholder.cs

    r2796 r2834  
    4141    }
    4242
    43     public override IExecutionSequence Apply() {
    44       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
     43    public override IOperation Apply() {
     44      OperationCollection next = new OperationCollection(base.Apply());
    4545      IOperator op = OperatorParameter.ActualValue;
    4646      if (op != null)
    47         next.Insert(0, ExecutionContext.CreateContext(op));
     47        next.Insert(0, ExecutionContext.CreateOperation(op));
    4848      return next;
    4949    }
  • trunk/sources/HeuristicLab.Operators/3.3/ScopeCleaner.cs

    r2794 r2834  
    4444    }
    4545
    46     public override IExecutionSequence Apply() {
     46    public override IOperation Apply() {
    4747      CurrentScope.Variables.Clear();
    4848      CurrentScope.SubScopes.Clear();
  • trunk/sources/HeuristicLab.Operators/3.3/SequentialSubScopesProcessor.cs

    r2830 r2834  
    3333    }
    3434
    35     public override IExecutionSequence Apply() {
    36       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
     35    public override IOperation Apply() {
     36      OperationCollection next = new OperationCollection(base.Apply());
    3737      if (Operators.Count > 0) {
    38         ExecutionContextCollection inner = new ExecutionContextCollection();
     38        OperationCollection inner = new OperationCollection();
    3939        for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++)
    40           if (Operators[i] != null) inner.Add(ExecutionContext.CreateContext(Operators[i], ExecutionContext.Scope.SubScopes[i]));
     40          if (Operators[i] != null) inner.Add(ExecutionContext.CreateOperation(Operators[i], ExecutionContext.Scope.SubScopes[i]));
    4141        next.Insert(0, inner);
    4242      }
  • trunk/sources/HeuristicLab.Operators/3.3/SingleSuccessorOperator.cs

    r2796 r2834  
    4545    }
    4646
    47     public override IExecutionSequence Apply() {
     47    public override IOperation Apply() {
    4848      if (Successor != null)
    49         return ExecutionContext.CreateContext(Successor);
     49        return ExecutionContext.CreateOperation(Successor);
    5050      else
    5151        return null;
  • trunk/sources/HeuristicLab.Operators/3.3/StochasticBranch.cs

    r2796 r2834  
    6262    }
    6363
    64     public override IExecutionSequence Apply() {
    65       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
     64    public override IOperation Apply() {
     65      OperationCollection next = new OperationCollection(base.Apply());
    6666      if (RandomParameter.ActualValue.NextDouble() < ProbabilityParameter.ActualValue.Value) {
    67         if (FirstBranch != null) next.Insert(0, ExecutionContext.CreateContext(FirstBranch));
     67        if (FirstBranch != null) next.Insert(0, ExecutionContext.CreateOperation(FirstBranch));
    6868      } else {
    69         if (SecondBranch != null) next.Insert(0, ExecutionContext.CreateContext(SecondBranch));
     69        if (SecondBranch != null) next.Insert(0, ExecutionContext.CreateOperation(SecondBranch));
    7070      }
    7171      return next;
  • trunk/sources/HeuristicLab.Operators/3.3/SubScopesCreator.cs

    r2794 r2834  
    4949    }
    5050
    51     public override IExecutionSequence Apply() {
     51    public override IOperation Apply() {
    5252      int n = NumberOfSubScopesParameter.ActualValue.Value;
    5353      for (int i = 0; i < n; i++)
  • trunk/sources/HeuristicLab.Operators/3.3/SubScopesRemover.cs

    r2830 r2834  
    5858    }
    5959
    60     public override IExecutionSequence Apply() {
     60    public override IOperation Apply() {
    6161      if (RemoveAllSubScopes)
    6262        CurrentScope.SubScopes.Clear();
  • trunk/sources/HeuristicLab.Operators/3.3/SubScopesSorter.cs

    r2818 r2834  
    5656    }
    5757
    58     public override IExecutionSequence Apply() {
     58    public override IOperation Apply() {
    5959      descending = DescendingParameter.ActualValue.Value;
    6060      actualName = LookupParameter<ItemArray<DoubleData>>.TranslateName(ValueParameter.Name, ExecutionContext);
  • trunk/sources/HeuristicLab.Operators/3.3/UniformParallelSubScopesProcessor.cs

    r2818 r2834  
    4545    }
    4646
    47     public override IExecutionSequence Apply() {
    48       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
     47    public override IOperation Apply() {
     48      OperationCollection next = new OperationCollection(base.Apply());
    4949      if (Operator != null) {
    50         ExecutionContextCollection inner = new ExecutionContextCollection();
     50        OperationCollection inner = new OperationCollection();
    5151        inner.Parallel = true;
    5252        for (int i = 0; i < ExecutionContext.Scope.SubScopes.Count; i++)
    53           inner.Add(ExecutionContext.CreateContext(Operator, ExecutionContext.Scope.SubScopes[i]));
     53          inner.Add(ExecutionContext.CreateOperation(Operator, ExecutionContext.Scope.SubScopes[i]));
    5454        next.Insert(0, inner);
    5555      }
  • trunk/sources/HeuristicLab.Operators/3.3/UniformSequentialSubScopesProcessor.cs

    r2818 r2834  
    4545    }
    4646
    47     public override IExecutionSequence Apply() {
    48       ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
     47    public override IOperation Apply() {
     48      OperationCollection next = new OperationCollection(base.Apply());
    4949      if (Operator != null) {
    50         ExecutionContextCollection inner = new ExecutionContextCollection();
     50        OperationCollection inner = new OperationCollection();
    5151        for (int i = 0; i < ExecutionContext.Scope.SubScopes.Count; i++)
    52           inner.Add(ExecutionContext.CreateContext(Operator, ExecutionContext.Scope.SubScopes[i]));
     52          inner.Add(ExecutionContext.CreateOperation(Operator, ExecutionContext.Scope.SubScopes[i]));
    5353        next.Insert(0, inner);
    5454      }
  • trunk/sources/HeuristicLab.Operators/3.3/VariableCreator.cs

    r2794 r2834  
    4444    }
    4545
    46     public override IExecutionSequence Apply() {
     46    public override IOperation Apply() {
    4747      IVariable var;
    4848      foreach (IParameter param in CollectedValues) {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ProblemView.Designer.cs

    r2829 r2834  
    2020#endregion
    2121
    22 namespace HeuristicLab.Core.Views {
     22namespace HeuristicLab.Optimization.Views {
    2323  partial class ProblemView {
    2424    /// <summary>
     
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.valueParameterCollectionView = new HeuristicLab.Core.Views.ValueParameterCollectionView();
     47      this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
    4848      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    4949      this.SuspendLayout();
     
    6161      this.descriptionTextBox.Size = new System.Drawing.Size(418, 87);
    6262      //
    63       // valueParameterCollectionView
     63      // parameterCollectionView
    6464      //
    65       this.valueParameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     65      this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    6666                  | System.Windows.Forms.AnchorStyles.Left)
    6767                  | System.Windows.Forms.AnchorStyles.Right)));
    68       this.valueParameterCollectionView.Caption = "ValueParameterCollection";
    69       this.valueParameterCollectionView.Content = null;
    70       this.valueParameterCollectionView.Location = new System.Drawing.Point(0, 119);
    71       this.valueParameterCollectionView.Name = "valueParameterCollectionView";
    72       this.valueParameterCollectionView.Size = new System.Drawing.Size(490, 234);
    73       this.valueParameterCollectionView.TabIndex = 4;
     68      this.parameterCollectionView.Caption = "ParameterCollection";
     69      this.parameterCollectionView.Content = null;
     70      this.parameterCollectionView.Location = new System.Drawing.Point(0, 119);
     71      this.parameterCollectionView.Name = "parameterCollectionView";
     72      this.parameterCollectionView.Size = new System.Drawing.Size(490, 234);
     73      this.parameterCollectionView.TabIndex = 4;
    7474      //
    7575      // ProblemView
     
    7777      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    7878      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    79       this.Controls.Add(this.valueParameterCollectionView);
     79      this.Controls.Add(this.parameterCollectionView);
    8080      this.Name = "ProblemView";
    8181      this.Size = new System.Drawing.Size(490, 353);
    82       this.Controls.SetChildIndex(this.valueParameterCollectionView, 0);
     82      this.Controls.SetChildIndex(this.parameterCollectionView, 0);
    8383      this.Controls.SetChildIndex(this.nameLabel, 0);
    8484      this.Controls.SetChildIndex(this.descriptionLabel, 0);
     
    9393    #endregion
    9494
    95     protected ValueParameterCollectionView valueParameterCollectionView;
     95    protected HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
    9696
    9797  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ProblemView.cs

    r2829 r2834  
    2020#endregion
    2121
     22using HeuristicLab.Core.Views;
    2223using HeuristicLab.MainForm;
    2324
    24 namespace HeuristicLab.Core.Views {
     25namespace HeuristicLab.Optimization.Views {
    2526  /// <summary>
    2627  /// The base class for visual representations of items.
     
    5253      base.OnContentChanged();
    5354      if (Content == null)
    54         valueParameterCollectionView.Content = null;
     55        parameterCollectionView.Content = null;
    5556      else
    56         valueParameterCollectionView.Content = ((IProblem)Content).Parameters;
     57        parameterCollectionView.Content = ((IProblem)Content).Parameters;
    5758    }
    5859  }
  • trunk/sources/HeuristicLab.Optimization/3.3/IProblem.cs

    r2829 r2834  
    2020#endregion
    2121
    22 using HeuristicLab.Collections;
     22using HeuristicLab.Core;
    2323
    24 namespace HeuristicLab.Core {
     24namespace HeuristicLab.Optimization {
    2525  /// <summary>
    2626  /// Interface to represent a problem.
    2727  /// </summary>
    28   public interface IProblem : INamedItem {
    29     IObservableKeyedCollection<string, IValueParameter> Parameters { get; }
    30   }
     28  public interface IProblem : INamedItem, IParameterizedItem { }
    3129}
  • trunk/sources/HeuristicLab.Optimization/3.3/Problem.cs

    r2829 r2834  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626
    27 namespace HeuristicLab.Core {
     27namespace HeuristicLab.Optimization {
    2828  /// <summary>
    2929  /// The base class for all problems.
     
    3535    }
    3636
    37     private ValueParameterCollection parameters;
     37    private ParameterCollection parameters;
    3838    [Storable]
    39     protected ValueParameterCollection Parameters {
     39    protected ParameterCollection Parameters {
    4040      get { return parameters;}
    4141      private set {
     
    4646      }
    4747    }
    48     private ReadOnlyObservableKeyedCollection<string, IValueParameter> readOnlyParameters;
    49     IObservableKeyedCollection<string, IValueParameter> IProblem.Parameters {
     48    private ReadOnlyObservableKeyedCollection<string, IParameter> readOnlyParameters;
     49    IObservableKeyedCollection<string, IParameter> IParameterizedItem.Parameters {
    5050      get {
    5151        if (readOnlyParameters == null) readOnlyParameters = parameters.AsReadOnly();
     
    5656    protected Problem() {
    5757      Name = ItemName;
    58       Parameters = new ValueParameterCollection();
     58      Parameters = new ParameterCollection();
    5959      readOnlyParameters = null;
    6060    }
     
    6262    public override IDeepCloneable Clone(Cloner cloner) {
    6363      Problem clone = (Problem)base.Clone(cloner);
    64       clone.Parameters = (ValueParameterCollection)cloner.Clone(parameters);
     64      clone.Parameters = (ParameterCollection)cloner.Clone(parameters);
    6565      return clone;
    6666    }
  • trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs

    r2818 r2834  
    7474      IValueParameter valueParam = this as IValueParameter;
    7575      ILookupParameter lookupParam = this as ILookupParameter;
    76       ExecutionContext current = ExecutionContext;
     76      IExecutionContext current = ExecutionContext;
    7777
    7878      name = Name;
     
    8282
    8383        current = current.Parent;
    84         while ((current != null) && !current.Operator.Parameters.ContainsKey(name))
     84        while ((current != null) && !current.Parameters.ContainsKey(name))
    8585          current = current.Parent;
    8686
    8787        if (current != null) {
    88           valueParam = current.Operator.Parameters[name] as IValueParameter;
    89           lookupParam = current.Operator.Parameters[name] as ILookupParameter;
     88          valueParam = current.Parameters[name] as IValueParameter;
     89          lookupParam = current.Parameters[name] as ILookupParameter;
    9090          if ((valueParam == null) && (lookupParam == null))
    9191            throw new InvalidOperationException(
     
    108108      return scope != null ? scope.Variables[actualName] : null;
    109109    }
    110     private IValueParameter GetProblemParameter(string name) {
    111       IValueParameter param = null;
    112       if (ExecutionContext.Problem.Parameters.ContainsKey(name)) {
    113         param = ExecutionContext.Problem.Parameters[name] as IValueParameter;
    114         if (param == null)
    115           throw new InvalidOperationException(
    116             string.Format("Parameter look-up chain broken. Parameter \"{0}\" is not an \"{1}\".",
    117                           name,
    118                           typeof(IValueParameter).GetPrettyName())
    119           );
    120       }
    121       return param;
    122     }
     110    //private IValueParameter GetProblemParameter(string name) {
     111    //  IValueParameter param = null;
     112    //  if (ExecutionContext.Problem.Parameters.ContainsKey(name)) {
     113    //    param = ExecutionContext.Problem.Parameters[name] as IValueParameter;
     114    //    if (param == null)
     115    //      throw new InvalidOperationException(
     116    //        string.Format("Parameter look-up chain broken. Parameter \"{0}\" is not an \"{1}\".",
     117    //                      name,
     118    //                      typeof(IValueParameter).GetPrettyName())
     119    //      );
     120    //  }
     121    //  return param;
     122    //}
    123123    protected override IItem GetActualValue() {
    124124      string name;
     
    141141
    142142      // try to get value from problem
    143       IValueParameter problemParam = GetProblemParameter(name);
    144       if (problemParam != null) return problemParam.Value;
     143      //IValueParameter problemParam = GetProblemParameter(name);
     144      //if (problemParam != null) return problemParam.Value;
    145145
    146146      return null;
     
    169169
    170170      // try to set value in problem
    171       IValueParameter problemParam = GetProblemParameter(name);
    172       if (problemParam != null) {
    173         problemParam.Value = val;
    174         return;
    175       }
     171      //IValueParameter problemParam = GetProblemParameter(name);
     172      //if (problemParam != null) {
     173      //  problemParam.Value = val;
     174      //  return;
     175      //}
    176176
    177177      // create new variable
     
    186186    }
    187187
    188     public static string TranslateName(string name, ExecutionContext context) {
     188    public static string TranslateName(string name, IExecutionContext context) {
    189189      string currentName = name;
    190       ExecutionContext currentContext = context;
     190      IExecutionContext currentContext = context;
    191191      IParameter param;
    192192      ILookupParameter lookupParam;
    193193
    194194      while (currentContext != null) {
    195         currentContext.Operator.Parameters.TryGetValue(currentName, out param);
     195        currentContext.Parameters.TryGetValue(currentName, out param);
    196196        if (param != null) {
    197197          lookupParam = param as ILookupParameter;
  • trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs

    r2818 r2834  
    4848    }
    4949    [Storable]
    50     private ExecutionContext executionContext;
    51     public ExecutionContext ExecutionContext {
     50    private IExecutionContext executionContext;
     51    public IExecutionContext ExecutionContext {
    5252      get { return executionContext; }
    5353      set {
     
    7777      Parameter clone = (Parameter)base.Clone(cloner);
    7878      clone.dataType = dataType;
    79       clone.executionContext = (ExecutionContext)cloner.Clone(executionContext);
     79      clone.executionContext = (IExecutionContext)cloner.Clone(executionContext);
    8080      return clone;
    8181    }
  • trunk/sources/HeuristicLab.Permutation/3.3/PermutationCrossover.cs

    r2794 r2834  
    4949    }
    5050
    51     public sealed override IExecutionSequence Apply() {
     51    public sealed override IOperation Apply() {
    5252      ChildParameter.ActualValue = Cross(RandomParameter.ActualValue, ParentsParameter.ActualValue);
    5353      return base.Apply();
  • trunk/sources/HeuristicLab.Permutation/3.3/PermutationManipulator.cs

    r2830 r2834  
    4545    }
    4646
    47     public sealed override IExecutionSequence Apply() {
     47    public sealed override IOperation Apply() {
    4848      Manipulate(RandomParameter.ActualValue, PermutationParameter.ActualValue);
    4949      return base.Apply();
  • trunk/sources/HeuristicLab.Permutation/3.3/RandomPermutationCreator.cs

    r2794 r2834  
    5151    }
    5252
    53     public override IExecutionSequence Apply() {
     53    public override IOperation Apply() {
    5454      PermutationParameter.ActualValue = new Permutation(LengthParameter.ActualValue.Value, RandomParameter.ActualValue);
    5555      return base.Apply();
  • trunk/sources/HeuristicLab.Random/3.3/RandomCreator.cs

    r2818 r2834  
    5959    }
    6060
    61     public override IExecutionSequence Apply() {
     61    public override IOperation Apply() {
    6262      if (SetSeedRandomlyParameter.ActualValue == null) SetSeedRandomlyParameter.ActualValue = new BoolData(true);
    6363      bool setSeedRandomly = SetSeedRandomlyParameter.ActualValue.Value;
  • trunk/sources/HeuristicLab.Routing.TSP.Views/3.3/HeuristicLab.Routing.TSP.Views-3.3.csproj

    r2805 r2834  
    8686      <Name>HeuristicLab.MainForm-3.2</Name>
    8787    </ProjectReference>
     88    <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">
     89      <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project>
     90      <Name>HeuristicLab.Optimization.Views-3.3</Name>
     91    </ProjectReference>
     92    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     93      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     94      <Name>HeuristicLab.Optimization-3.3</Name>
     95    </ProjectReference>
    8896    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
    8997      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
  • trunk/sources/HeuristicLab.Routing.TSP.Views/3.3/HeuristicLabRoutingTSPViewsPlugin.cs.frame

    r2805 r2834  
    3333  [PluginDependency("HeuristicLab.MainForm", "3.2")]
    3434  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.2")]
     35  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     36  [PluginDependency("HeuristicLab.Optimization.Views", "3.3")]
    3537  [PluginDependency("HeuristicLab.Routing.TSP", "3.3")]
    3638  public class HeuristicLabRoutingTSPViewsPlugin : PluginBase {
  • trunk/sources/HeuristicLab.Routing.TSP.Views/3.3/TSPView.Designer.cs

    r2805 r2834  
    5050      this.SuspendLayout();
    5151      //
    52       // valueParameterCollectionView
     52      // parameterCollectionView
    5353      //
    54       this.valueParameterCollectionView.Size = new System.Drawing.Size(490, 205);
     54      this.parameterCollectionView.Size = new System.Drawing.Size(490, 205);
    5555      //
    5656      // nameTextBox
     
    8585      this.Name = "TSPView";
    8686      this.Controls.SetChildIndex(this.importButton, 0);
    87       this.Controls.SetChildIndex(this.valueParameterCollectionView, 0);
     87      this.Controls.SetChildIndex(this.parameterCollectionView, 0);
    8888      this.Controls.SetChildIndex(this.nameLabel, 0);
    8989      this.Controls.SetChildIndex(this.descriptionLabel, 0);
  • trunk/sources/HeuristicLab.Routing.TSP.Views/3.3/TSPView.cs

    r2805 r2834  
    2424using HeuristicLab.Core.Views;
    2525using HeuristicLab.MainForm;
     26using HeuristicLab.Optimization.Views;
    2627
    2728namespace HeuristicLab.Routing.TSP.Views {
  • trunk/sources/HeuristicLab.Routing.TSP/3.3/HeuristicLab.Routing.TSP-3.3.csproj

    r2830 r2834  
    109109      <Name>HeuristicLab.Operators-3.3</Name>
    110110    </ProjectReference>
     111    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     112      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     113      <Name>HeuristicLab.Optimization-3.3</Name>
     114    </ProjectReference>
    111115    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    112116      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
  • trunk/sources/HeuristicLab.Routing.TSP/3.3/HeuristicLabRoutingTSPPlugin.cs.frame

    r2805 r2834  
    3232  [PluginDependency("HeuristicLab.Data", "3.3")]
    3333  [PluginDependency("HeuristicLab.Operators", "3.3")]
     34  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    3435  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3536  [PluginDependency("HeuristicLab.Permutation", "3.3")]
  • trunk/sources/HeuristicLab.Routing.TSP/3.3/TSP.cs

    r2830 r2834  
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Data;
     24using HeuristicLab.Optimization;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Permutation;
  • trunk/sources/HeuristicLab.Routing.TSP/3.3/TSPDistanceMatrixPathEvaluator.cs

    r2805 r2834  
    5151    }
    5252
    53     public override IExecutionSequence Apply() {
     53    public override IOperation Apply() {
    5454      DoubleMatrixData distanceMatrix = DistanceMatrixParameter.ActualValue;
    5555      Permutation.Permutation permutation = PermutationParameter.ActualValue;
  • trunk/sources/HeuristicLab.Routing.TSP/3.3/TSPPathEvaluator.cs

    r2805 r2834  
    5050    }
    5151
    52     public override IExecutionSequence Apply() {
     52    public override IOperation Apply() {
    5353      DoubleMatrixData coordinates = CoordinatesParameter.ActualValue;
    5454      Permutation.Permutation permutation = PermutationParameter.ActualValue;
  • trunk/sources/HeuristicLab.SGA/3.3/SGAOperator.cs

    r2830 r2834  
    193193    }
    194194
    195     public override IExecutionSequence Apply() {
     195    public override IOperation Apply() {
    196196      int populationSize = CurrentScope.SubScopes.Count;
    197197      // dynamically set the number of parents which are selected for reproduction
  • trunk/sources/HeuristicLab.Selection/3.3/Reducer.cs

    r2830 r2834  
    4646    }
    4747
    48     public sealed override IExecutionSequence Apply() {
     48    public sealed override IOperation Apply() {
    4949      List<IScope> scopes = new List<IScope>(CurrentScope.SubScopes);
    5050      List<IScope> reduced = Reduce(scopes);
  • trunk/sources/HeuristicLab.Selection/3.3/Selector.cs

    r2830 r2834  
    5959    }
    6060
    61     public sealed override IExecutionSequence Apply() {
     61    public sealed override IOperation Apply() {
    6262      List<IScope> scopes = new List<IScope>(CurrentScope.SubScopes);
    6363      IScope[] selected = Select(scopes);
  • trunk/sources/HeuristicLab.SequentialEngine/3.3/SequentialEngine.cs

    r2818 r2834  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    2523using HeuristicLab.Core;
    2624using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    5755    protected override void ProcessNextOperator() {
    5856      currentOperator = null;
    59       IExecutionSequence next = ExecutionStack.Pop();
    60       ExecutionContextCollection coll = next as ExecutionContextCollection;
     57      IOperation next = ExecutionStack.Pop();
     58      OperationCollection coll = next as OperationCollection;
    6159      while (coll != null) {
    6260        for (int i = coll.Count - 1; i >= 0; i--)
    6361          ExecutionStack.Push(coll[i]);
    6462        next = ExecutionStack.Count > 0 ? ExecutionStack.Pop() : null;
    65         coll = next as ExecutionContextCollection;
     63        coll = next as OperationCollection;
    6664      }
    67       ExecutionContext context = next as ExecutionContext;
    68       if (context != null) {
     65      IAtomicOperation operation = next as IAtomicOperation;
     66      if (operation != null) {
    6967        try {
    70           currentOperator = context.Operator;
    71           ExecutionStack.Push(context.Operator.Execute(context));
     68          currentOperator = operation.Operator;
     69          ExecutionStack.Push(operation.Operator.Execute((IExecutionContext)operation));
    7270          currentOperator = null;
    7371        }
    7472        catch (Exception ex) {
    75           ExecutionStack.Push(context);
     73          ExecutionStack.Push(operation);
    7674          Stop();
    7775          OnExceptionOccurred(ex);
    7876        }
    79         if (context.Operator.Breakpoint)
     77        if (operation.Operator.Breakpoint)
    8078          Stop();
    8179      }
Note: See TracChangeset for help on using the changeset viewer.