Changeset 2834
- Timestamp:
- 02/19/10 06:19:16 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 17 added
- 54 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab 3.3.sln
r2830 r2834 151 151 EndProject 152 152 Project("{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}" 153 EndProject 154 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Optimization-3.3", "HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj", "{14AB8D24-25BC-400C-A846-4627AA945192}" 155 EndProject 156 Project("{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}" 153 157 EndProject 154 158 Global … … 675 679 {F42F3576-7233-4B28-90F7-36AE15F30F92}.Release|x64.ActiveCfg = Release|Any CPU 676 680 {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 677 697 EndGlobalSection 678 698 GlobalSection(SolutionProperties) = preSolution -
trunk/sources/HeuristicLab 3.3/Files.txt
r2805 r2834 23 23 HeuristicLab.Operators.Views.GraphVisualization\3.3:HeuristicLab.Operators.Views.GraphVisualization-3.3.dll 24 24 HeuristicLab.Operators.Programmable\3.3:HeuristicLab.Operators.Programmable-3.3.dll 25 HeuristicLab.Optimization\3.3:HeuristicLab.Optimization-3.3.dll 26 HeuristicLab.Optimization.Views\3.3:HeuristicLab.Optimization.Views-3.3.dll 25 27 HeuristicLab.Optimizer\3.3:HeuristicLab.Optimizer-3.3.dll 26 28 HeuristicLab.Parameters\3.3:HeuristicLab.Parameters-3.3.dll -
trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.Designer.cs
r2826 r2834 54 54 this.startButton = new System.Windows.Forms.Button(); 55 55 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();59 56 this.newOperatorGraphButton = new System.Windows.Forms.Button(); 60 57 this.openOperatorGraphButton = new System.Windows.Forms.Button(); … … 64 61 this.operatorGraphViewHost = new HeuristicLab.Core.Views.ViewHost(); 65 62 this.globalScopeTabPage = new System.Windows.Forms.TabPage(); 66 this.problemTabPage = new System.Windows.Forms.TabPage();67 this.problemViewHost = new HeuristicLab.Core.Views.ViewHost();68 63 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 69 64 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); … … 71 66 this.operatorGraphTabPage.SuspendLayout(); 72 67 this.globalScopeTabPage.SuspendLayout(); 73 this.problemTabPage.SuspendLayout();74 68 this.SuspendLayout(); 75 69 // … … 142 136 this.startButton.Click += new System.EventHandler(this.startButton_Click); 143 137 // 144 // newProblemButton145 //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 // openProblemButton156 //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 // saveProblemButton167 //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 //177 138 // newOperatorGraphButton 178 139 // … … 215 176 this.tabControl.Controls.Add(this.operatorGraphTabPage); 216 177 this.tabControl.Controls.Add(this.globalScopeTabPage); 217 this.tabControl.Controls.Add(this.problemTabPage);218 178 this.tabControl.Location = new System.Drawing.Point(0, 0); 219 179 this.tabControl.Name = "tabControl"; … … 258 218 this.globalScopeTabPage.Text = "Global Scope"; 259 219 this.globalScopeTabPage.UseVisualStyleBackColor = true; 260 //261 // problemTabPage262 //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 // problemViewHost276 //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;286 220 // 287 221 // openFileDialog … … 315 249 this.operatorGraphTabPage.ResumeLayout(false); 316 250 this.globalScopeTabPage.ResumeLayout(false); 317 this.problemTabPage.ResumeLayout(false);318 251 this.ResumeLayout(false); 319 252 this.PerformLayout(); … … 332 265 protected System.Windows.Forms.TabControl tabControl; 333 266 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;339 267 protected System.Windows.Forms.OpenFileDialog openFileDialog; 340 268 protected System.Windows.Forms.SaveFileDialog saveFileDialog; -
trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.cs
r2826 r2834 62 62 protected override void DeregisterContentEvents() { 63 63 Content.OperatorGraphChanged -= new EventHandler(Content_OperatorGraphChanged); 64 Content.ProblemChanged -= new EventHandler(Content_ProblemChanged);65 64 Content.Prepared -= new EventHandler(Content_Prepared); 66 65 Content.Started -= new EventHandler(Content_Started); … … 78 77 base.RegisterContentEvents(); 79 78 Content.OperatorGraphChanged += new EventHandler(Content_OperatorGraphChanged); 80 Content.ProblemChanged += new EventHandler(Content_ProblemChanged);81 79 Content.Prepared += new EventHandler(Content_Prepared); 82 80 Content.Started += new EventHandler(Content_Started); … … 97 95 operatorGraphViewHost.Enabled = false; 98 96 scopeView.Enabled = false; 99 newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false;100 problemViewHost.Enabled = false;101 97 startButton.Enabled = resetButton.Enabled = false; 102 98 executionTimeTextBox.Enabled = false; … … 107 103 scopeView.Content = Content.GlobalScope; 108 104 scopeView.Enabled = true; 109 newProblemButton.Enabled = openProblemButton.Enabled = true;110 saveProblemButton.Enabled = Content.Problem != null;111 problemViewHost.Content = Content.Problem;112 problemViewHost.Enabled = true;113 105 startButton.Enabled = !Content.Finished; 114 106 resetButton.Enabled = true; … … 124 116 else 125 117 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 }134 118 } 135 119 protected virtual void Content_Prepared(object sender, EventArgs e) { … … 140 124 operatorGraphViewHost.Enabled = true; 141 125 scopeView.Enabled = true; 142 newProblemButton.Enabled = openProblemButton.Enabled = true;143 saveProblemButton.Enabled = Content.Problem != null;144 problemViewHost.Enabled = true;145 126 startButton.Enabled = !Content.Finished; 146 127 stopButton.Enabled = false; … … 157 138 operatorGraphViewHost.Enabled = false; 158 139 scopeView.Enabled = false; 159 newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false;160 problemViewHost.Enabled = false;161 140 startButton.Enabled = false; 162 141 stopButton.Enabled = true; … … 172 151 operatorGraphViewHost.Enabled = true; 173 152 scopeView.Enabled = true; 174 newProblemButton.Enabled = openProblemButton.Enabled = true;175 saveProblemButton.Enabled = Content.Problem != null;176 problemViewHost.Enabled = true;177 153 startButton.Enabled = !Content.Finished; 178 154 stopButton.Enabled = false; … … 230 206 } 231 207 } 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 else256 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 else266 XmlGenerator.Serialize(Content.Problem, saveFileDialog.FileName, 9);267 }268 catch (Exception ex) {269 Auxiliary.ShowErrorMessageBox(ex);270 }271 }272 }273 208 protected virtual void startButton_Click(object sender, EventArgs e) { 274 209 Content.Start(); -
trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj
r2805 r2834 131 131 <DependentUpon>OperatorTreeView.cs</DependentUpon> 132 132 </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>139 133 <Compile Include="TypeSelectorDialog.cs"> 140 134 <SubType>Form</SubType> -
trunk/sources/HeuristicLab.Core/3.3/Engine.cs
r2796 r2834 71 71 72 72 [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]90 73 private TimeSpan executionTime; 91 74 /// <summary> … … 105 88 /// </summary> 106 89 [Storable] 107 private Stack<I ExecutionSequence> executionStack;90 private Stack<IOperation> executionStack; 108 91 /// <summary> 109 92 /// Gets the current execution stack. 110 93 /// </summary> 111 protected Stack<I ExecutionSequence> ExecutionStack {94 protected Stack<IOperation> ExecutionStack { 112 95 get { return executionStack; } 113 96 } … … 146 129 protected Engine() { 147 130 globalScope = new Scope("Global"); 148 problem = null; 149 executionStack = new Stack<IExecutionSequence>(); 131 executionStack = new Stack<IOperation>(); 150 132 OperatorGraph = new OperatorGraph(); 151 133 } … … 162 144 clone.OperatorGraph = (OperatorGraph)cloner.Clone(operatorGraph); 163 145 clone.globalScope = (Scope)cloner.Clone(globalScope); 164 clone.problem = (IProblem)cloner.Clone(problem);165 146 clone.executionTime = executionTime; 166 I ExecutionSequence[] contexts = executionStack.ToArray();147 IOperation[] contexts = executionStack.ToArray(); 167 148 for (int i = contexts.Length - 1; i >= 0; i--) 168 clone.executionStack.Push((I ExecutionSequence)cloner.Clone(contexts[i]));149 clone.executionStack.Push((IOperation)cloner.Clone(contexts[i])); 169 150 clone.running = running; 170 151 clone.canceled = canceled; … … 172 153 } 173 154 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 } 174 165 /// <inheritdoc/> 175 166 /// <remarks>Sets <c>myCanceled</c> and <c>myRunning</c> to <c>false</c>. The global scope is cleared, … … 178 169 /// Calls <see cref="OnPrepared"/>.</remarks> 179 170 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)); 188 173 } 189 174 /// <inheritdoc/> … … 254 239 } 255 240 /// <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>267 241 /// Occurs when the execution time changed. 268 242 /// </summary> -
trunk/sources/HeuristicLab.Core/3.3/ExecutionContext.cs
r2796 r2834 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 23 using HeuristicLab.Collections; 25 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 25 27 26 namespace HeuristicLab.Core { 28 public class ExecutionContext : DeepCloneable, IExecution Sequence{27 public class ExecutionContext : DeepCloneable, IExecutionContext, IAtomicOperation { 29 28 [Storable] 30 private ExecutionContext parent; 31 public ExecutionContext Parent { 29 private IParameterizedItem parameterizedItem; 30 31 [Storable] 32 private IExecutionContext parent; 33 public IExecutionContext Parent { 32 34 get { return parent; } 33 35 } 34 36 35 [Storable] 36 private IOperator op; 37 public IObservableKeyedCollection<string, IParameter> Parameters { 38 get { return parameterizedItem.Parameters; } 39 } 40 37 41 public IOperator Operator { 38 get { return op; }42 get { return parameterizedItem as IOperator; } 39 43 } 40 44 … … 45 49 } 46 50 47 [Storable]48 private IProblem problem;49 public IProblem Problem {50 get { return problem; }51 }52 53 51 private ExecutionContext() { 54 52 parent = null; 55 op= null;53 parameterizedItem = null; 56 54 scope = null; 57 problem = null;58 55 } 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(); 61 58 this.parent = parent; 62 this. op = op;59 this.parameterizedItem = parameterizedItem; 63 60 this.scope = scope; 64 this.problem = problem;65 61 } 66 62 … … 68 64 ExecutionContext clone = new ExecutionContext(); 69 65 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); 72 68 clone.scope = (IScope)cloner.Clone(scope); 73 clone.problem = (IProblem)cloner.Clone(problem);74 69 return clone; 75 70 } 76 71 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); 79 74 } 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); 82 77 } 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); 85 80 } 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); 88 83 } 89 84 } -
trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj
r2805 r2834 104 104 <Compile Include="ChangedEventArgs.cs" /> 105 105 <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" /> 106 111 <Compile Include="ValueParameterCollection.cs" /> 107 <Compile Include="Interfaces\IProblem.cs" />108 <Compile Include="Interfaces\IExecutionSequence.cs" />109 112 <Compile Include="Interfaces\IValueLookupParameter.cs" /> 110 113 <Compile Include="Interfaces\IValueParameter.cs" /> … … 117 120 <Compile Include="Item.cs" /> 118 121 <Compile Include="NamedItem.cs" /> 119 <Compile Include="Problem.cs" />120 122 <Compile Include="OperatorGraph.cs" /> 121 123 <Compile Include="Interfaces\IParameter.cs" /> … … 128 130 <SubType>Code</SubType> 129 131 </Compile> 130 <Compile Include="ExecutionContextCollection.cs" />131 132 <Compile Include="ExecutionContext.cs" /> 132 133 <Compile Include="OperatorList.cs" /> -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IEngine.cs
r2796 r2834 38 38 /// </summary> 39 39 IScope GlobalScope { get; } 40 /// <summary>41 /// Gets the problem of the current instance.42 /// </summary>43 IProblem Problem { get; set; }44 40 45 41 /// <summary> … … 62 58 void Prepare(); 63 59 /// <summary> 60 /// Prepares the engine with a given initial operation. 61 /// </summary> 62 void Prepare(IOperation initialOperation); 63 /// <summary> 64 64 /// Executes the whole run. 65 65 /// </summary> … … 78 78 /// </summary> 79 79 event EventHandler OperatorGraphChanged; 80 /// <summary>81 /// Occurs when the problem was changed.82 /// </summary>83 event EventHandler ProblemChanged;84 80 /// <summary> 85 81 /// Occurs when the execution time was changed. -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IOperation.cs
r2829 r2834 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.ComponentModel;25 using System.Text;26 using System.Drawing;27 28 22 namespace HeuristicLab.Core { 29 23 /// <summary> 30 /// Interface which represents an execution context.24 /// Interface which represents an operation. 31 25 /// </summary> 32 public interface I ExecutionSequence: IDeepCloneable { }26 public interface IOperation : IDeepCloneable { } 33 27 } -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IOperator.cs
r2790 r2834 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 using HeuristicLab.Common;26 using HeuristicLab.Collections;27 23 28 24 namespace HeuristicLab.Core { … … 31 27 /// a basic instruction of an algorithm. 32 28 /// </summary> 33 public interface IOperator : INamedItem { 34 IObservableKeyedCollection<string, IParameter> Parameters { get; } 35 29 public interface IOperator : INamedItem, IParameterizedItem { 36 30 /// <summary> 37 31 /// Gets or sets a boolean value whether the engine should stop here during the run. … … 44 38 /// <param name="scope">The scope where to execute the current instance.</param> 45 39 /// <returns>The next operation.</returns> 46 I ExecutionSequence Execute(ExecutionContext context);40 IOperation Execute(IExecutionContext context); 47 41 /// <summary> 48 42 /// Aborts the current operator. -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IParameter.cs
r2790 r2834 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 using HeuristicLab.Common;27 23 28 24 namespace HeuristicLab.Core { … … 30 26 Type DataType { get; } 31 27 IItem ActualValue { get; set; } 32 ExecutionContext ExecutionContext { get; set; }28 IExecutionContext ExecutionContext { get; set; } 33 29 } 34 30 } -
trunk/sources/HeuristicLab.Core/3.3/NamedItemCollection.cs
r2833 r2834 21 21 22 22 using System; 23 using System.Linq;24 23 using System.Collections.Generic; 25 24 using System.Drawing; 25 using System.Linq; 26 26 using HeuristicLab.Collections; 27 27 using HeuristicLab.Common; -
trunk/sources/HeuristicLab.Core/3.3/OperationCollection.cs
r2829 r2834 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Linq; 25 using System.Text;26 using System.Xml;27 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 25 29 26 namespace HeuristicLab.Core { 30 public class ExecutionContextCollection : DeepCloneable, IList<IExecutionSequence>, IExecutionSequence{27 public class OperationCollection : DeepCloneable, IList<IOperation>, IOperation { 31 28 [Storable] 32 private IList<I ExecutionSequence> contexts;29 private IList<IOperation> operations; 33 30 34 31 [Storable] … … 39 36 } 40 37 41 public ExecutionContextCollection() {42 contexts = new List<IExecutionSequence>();38 public OperationCollection() { 39 operations = new List<IOperation>(); 43 40 parallel = false; 44 41 } 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)); 47 44 parallel = false; 48 45 } 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)); 51 48 parallel = false; 52 49 } 53 50 54 51 public override IDeepCloneable Clone(Cloner cloner) { 55 ExecutionContextCollection clone = new ExecutionContextCollection();52 OperationCollection clone = new OperationCollection(this.Select(x => (IOperation)cloner.Clone(x))); 56 53 cloner.RegisterClonedObject(this, clone); 57 54 clone.parallel = parallel; 58 for (int i = 0; i < contexts.Count; i++)59 clone.contexts.Add((IExecutionSequence)cloner.Clone(contexts[i]));60 55 return clone; 61 56 } 62 57 63 #region IList<I ExecutionContext> Members64 public int IndexOf(I ExecutionSequenceitem) {65 return contexts.IndexOf(item);58 #region IList<IOperation> Members 59 public int IndexOf(IOperation item) { 60 return operations.IndexOf(item); 66 61 } 67 public void Insert(int index, I ExecutionSequenceitem) {68 if (item != null) contexts.Insert(index, item);62 public void Insert(int index, IOperation item) { 63 if (item != null) operations.Insert(index, item); 69 64 } 70 65 public void RemoveAt(int index) { 71 contexts.RemoveAt(index);66 operations.RemoveAt(index); 72 67 } 73 public I ExecutionSequencethis[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; } 76 71 } 77 72 #endregion 78 73 79 #region ICollection<I ExecutionContext> Members80 public void Add(I ExecutionSequenceitem) {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); 82 77 } 83 78 public void Clear() { 84 contexts.Clear();79 operations.Clear(); 85 80 } 86 public bool Contains(I ExecutionSequenceitem) {87 return contexts.Contains(item);81 public bool Contains(IOperation item) { 82 return operations.Contains(item); 88 83 } 89 public void CopyTo(I ExecutionSequence[] array, int arrayIndex) {90 contexts.CopyTo(array, arrayIndex);84 public void CopyTo(IOperation[] array, int arrayIndex) { 85 operations.CopyTo(array, arrayIndex); 91 86 } 92 87 public int Count { 93 get { return contexts.Count; }88 get { return operations.Count; } 94 89 } 95 90 public bool IsReadOnly { 96 get { return contexts.IsReadOnly; }91 get { return operations.IsReadOnly; } 97 92 } 98 public bool Remove(I ExecutionSequenceitem) {99 return contexts.Remove(item);93 public bool Remove(IOperation item) { 94 return operations.Remove(item); 100 95 } 101 96 #endregion 102 97 103 #region IEnumerable<I ExecutionContext> Members104 public IEnumerator<I ExecutionSequence> GetEnumerator() {105 return contexts.GetEnumerator();98 #region IEnumerable<IOperation> Members 99 public IEnumerator<IOperation> GetEnumerator() { 100 return operations.GetEnumerator(); 106 101 } 107 102 #endregion … … 109 104 #region IEnumerable Members 110 105 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { 111 return contexts.GetEnumerator();106 return operations.GetEnumerator(); 112 107 } 113 108 #endregion -
trunk/sources/HeuristicLab.Evolutionary/3.3/ChildrenCreator.cs
r2818 r2834 60 60 } 61 61 62 public override I ExecutionSequenceApply() {62 public override IOperation Apply() { 63 63 int parentsPerChild = ParentsPerChildParameter.ActualValue.Value; 64 64 int parents = CurrentScope.SubScopes.Count; -
trunk/sources/HeuristicLab.Evolutionary/3.3/PopulationCreator.cs
r2830 r2834 59 59 } 60 60 61 public override I ExecutionSequenceApply() {61 public override IOperation Apply() { 62 62 int size = PopulationSizeParameter.ActualValue.Value; 63 63 IOperator creator = SolutionCreatorParameter.ActualValue; … … 69 69 CurrentScope.SubScopes.Add(new Scope(i.ToString())); 70 70 71 ExecutionContextCollection next = new ExecutionContextCollection();71 OperationCollection next = new OperationCollection(); 72 72 for (int i = 0; i < CurrentScope.SubScopes.Count; i++) { 73 if (creator != null) next.Add(ExecutionContext.Create Context(creator, CurrentScope.SubScopes[i]));74 if (evaluator != null) next.Add(ExecutionContext.Create Context(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])); 75 75 } 76 76 next.Add(base.Apply()); -
trunk/sources/HeuristicLab.Operators.Views/3.3/AlgorithmOperatorView.cs
r2830 r2834 28 28 /// The base class for visual representations of items. 29 29 /// </summary> 30 [Content(typeof( CombinedOperator), true)]30 [Content(typeof(AlgorithmOperator), true)] 31 31 public partial class AlgorithmOperatorView : NamedItemView { 32 32 public new AlgorithmOperator Content { -
trunk/sources/HeuristicLab.Operators/3.3/AlgorithmOperator.cs
r2830 r2834 50 50 } 51 51 52 public override I ExecutionSequenceApply() {53 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());52 public override IOperation Apply() { 53 OperationCollection next = new OperationCollection(base.Apply()); 54 54 if (operatorGraph.InitialOperator != null) 55 next.Insert(0, ExecutionContext.CreateChild Context(operatorGraph.InitialOperator));55 next.Insert(0, ExecutionContext.CreateChildOperation(operatorGraph.InitialOperator)); 56 56 return next; 57 57 } -
trunk/sources/HeuristicLab.Operators/3.3/Assigner.cs
r2794 r2834 45 45 } 46 46 47 public override I ExecutionSequenceApply() {47 public override IOperation Apply() { 48 48 LeftSideParameter.ActualValue = (IItem)RightSideParameter.ActualValue.Clone(); 49 49 return base.Apply(); -
trunk/sources/HeuristicLab.Operators/3.3/CombinedOperator.cs
r2830 r2834 20 20 #endregion 21 21 22 using System.Drawing;23 22 using HeuristicLab.Collections; 24 23 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;26 24 27 25 namespace HeuristicLab.Operators { … … 31 29 [Item("CombinedOperator", "An operator which contains an operator graph.")] 32 30 [Creatable("Test")] 33 public sealed class CombinedOperator : AlgorithmOperator, I Operator{31 public sealed class CombinedOperator : AlgorithmOperator, IParameterizedItem { 34 32 public new ParameterCollection Parameters { 35 33 get { … … 37 35 } 38 36 } 39 IObservableKeyedCollection<string, IParameter> I Operator.Parameters {37 IObservableKeyedCollection<string, IParameter> IParameterizedItem.Parameters { 40 38 get { return Parameters; } 41 39 } -
trunk/sources/HeuristicLab.Operators/3.3/Comparator.cs
r2831 r2834 59 59 } 60 60 61 public override I ExecutionSequenceApply() {61 public override IOperation Apply() { 62 62 IItem left = LeftSideParameter.ActualValue; 63 63 IItem right = RightSideParameter.ActualValue; -
trunk/sources/HeuristicLab.Operators/3.3/ConditionalBranch.cs
r2796 r2834 58 58 } 59 59 60 public override I ExecutionSequenceApply() {61 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());60 public override IOperation Apply() { 61 OperationCollection next = new OperationCollection(base.Apply()); 62 62 if (ConditionParameter.ActualValue.Value) { 63 if (TrueBranch != null) next.Insert(0, ExecutionContext.Create Context(TrueBranch));63 if (TrueBranch != null) next.Insert(0, ExecutionContext.CreateOperation(TrueBranch)); 64 64 } else { 65 if (FalseBranch != null) next.Insert(0, ExecutionContext.Create Context(FalseBranch));65 if (FalseBranch != null) next.Insert(0, ExecutionContext.CreateOperation(FalseBranch)); 66 66 } 67 67 return next; -
trunk/sources/HeuristicLab.Operators/3.3/DoubleCounter.cs
r2794 r2834 50 50 } 51 51 52 public override I ExecutionSequenceApply() {52 public override IOperation Apply() { 53 53 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new DoubleData(); 54 54 ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value; -
trunk/sources/HeuristicLab.Operators/3.3/IntCounter.cs
r2794 r2834 50 50 } 51 51 52 public override I ExecutionSequenceApply() {52 public override IOperation Apply() { 53 53 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntData(); 54 54 ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value; -
trunk/sources/HeuristicLab.Operators/3.3/Operator.cs
r2805 r2834 51 51 } 52 52 private ReadOnlyObservableKeyedCollection<string, IParameter> readOnlyParameters; 53 IObservableKeyedCollection<string, IParameter> I Operator.Parameters {53 IObservableKeyedCollection<string, IParameter> IParameterizedItem.Parameters { 54 54 get { 55 55 if (readOnlyParameters == null) readOnlyParameters = parameters.AsReadOnly(); … … 59 59 60 60 [Storable] 61 private ExecutionContext executionContext;62 protected ExecutionContext ExecutionContext {61 private IExecutionContext executionContext; 62 protected IExecutionContext ExecutionContext { 63 63 get { return executionContext; } 64 64 private set { … … 122 122 clone.canceled = canceled; 123 123 clone.breakpoint = breakpoint; 124 clone.executionContext = ( ExecutionContext)cloner.Clone(executionContext);124 clone.executionContext = (IExecutionContext)cloner.Clone(executionContext); 125 125 return clone; 126 126 } 127 127 128 128 /// <inheritdoc/> 129 public virtual I ExecutionSequence Execute(ExecutionContext context) {129 public virtual IOperation Execute(IExecutionContext context) { 130 130 try { 131 131 Canceled = false; … … 133 133 foreach (IParameter param in Parameters) 134 134 param.ExecutionContext = context; 135 I ExecutionSequencenext = Apply();135 IOperation next = Apply(); 136 136 OnExecuted(); 137 137 return next; … … 153 153 /// <param name="scope">The scope where to execute the operator</param> 154 154 /// <returns><c>null</c>.</returns> 155 public abstract I ExecutionSequenceApply();155 public abstract IOperation Apply(); 156 156 157 157 protected virtual void OnExecutionContextChanged() { } -
trunk/sources/HeuristicLab.Operators/3.3/ParallelSubScopesProcessor.cs
r2830 r2834 33 33 } 34 34 35 public override I ExecutionSequenceApply() {36 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());35 public override IOperation Apply() { 36 OperationCollection next = new OperationCollection(base.Apply()); 37 37 if (Operators.Count > 0) { 38 ExecutionContextCollection inner = new ExecutionContextCollection();38 OperationCollection inner = new OperationCollection(); 39 39 inner.Parallel = true; 40 40 for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++) 41 if (Operators[i] != null) inner.Add(ExecutionContext.Create Context(Operators[i], ExecutionContext.Scope.SubScopes[i]));41 if (Operators[i] != null) inner.Add(ExecutionContext.CreateOperation(Operators[i], ExecutionContext.Scope.SubScopes[i])); 42 42 next.Insert(0, inner); 43 43 } -
trunk/sources/HeuristicLab.Operators/3.3/Placeholder.cs
r2796 r2834 41 41 } 42 42 43 public override I ExecutionSequenceApply() {44 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());43 public override IOperation Apply() { 44 OperationCollection next = new OperationCollection(base.Apply()); 45 45 IOperator op = OperatorParameter.ActualValue; 46 46 if (op != null) 47 next.Insert(0, ExecutionContext.Create Context(op));47 next.Insert(0, ExecutionContext.CreateOperation(op)); 48 48 return next; 49 49 } -
trunk/sources/HeuristicLab.Operators/3.3/ScopeCleaner.cs
r2794 r2834 44 44 } 45 45 46 public override I ExecutionSequenceApply() {46 public override IOperation Apply() { 47 47 CurrentScope.Variables.Clear(); 48 48 CurrentScope.SubScopes.Clear(); -
trunk/sources/HeuristicLab.Operators/3.3/SequentialSubScopesProcessor.cs
r2830 r2834 33 33 } 34 34 35 public override I ExecutionSequenceApply() {36 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());35 public override IOperation Apply() { 36 OperationCollection next = new OperationCollection(base.Apply()); 37 37 if (Operators.Count > 0) { 38 ExecutionContextCollection inner = new ExecutionContextCollection();38 OperationCollection inner = new OperationCollection(); 39 39 for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++) 40 if (Operators[i] != null) inner.Add(ExecutionContext.Create Context(Operators[i], ExecutionContext.Scope.SubScopes[i]));40 if (Operators[i] != null) inner.Add(ExecutionContext.CreateOperation(Operators[i], ExecutionContext.Scope.SubScopes[i])); 41 41 next.Insert(0, inner); 42 42 } -
trunk/sources/HeuristicLab.Operators/3.3/SingleSuccessorOperator.cs
r2796 r2834 45 45 } 46 46 47 public override I ExecutionSequenceApply() {47 public override IOperation Apply() { 48 48 if (Successor != null) 49 return ExecutionContext.Create Context(Successor);49 return ExecutionContext.CreateOperation(Successor); 50 50 else 51 51 return null; -
trunk/sources/HeuristicLab.Operators/3.3/StochasticBranch.cs
r2796 r2834 62 62 } 63 63 64 public override I ExecutionSequenceApply() {65 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());64 public override IOperation Apply() { 65 OperationCollection next = new OperationCollection(base.Apply()); 66 66 if (RandomParameter.ActualValue.NextDouble() < ProbabilityParameter.ActualValue.Value) { 67 if (FirstBranch != null) next.Insert(0, ExecutionContext.Create Context(FirstBranch));67 if (FirstBranch != null) next.Insert(0, ExecutionContext.CreateOperation(FirstBranch)); 68 68 } else { 69 if (SecondBranch != null) next.Insert(0, ExecutionContext.Create Context(SecondBranch));69 if (SecondBranch != null) next.Insert(0, ExecutionContext.CreateOperation(SecondBranch)); 70 70 } 71 71 return next; -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesCreator.cs
r2794 r2834 49 49 } 50 50 51 public override I ExecutionSequenceApply() {51 public override IOperation Apply() { 52 52 int n = NumberOfSubScopesParameter.ActualValue.Value; 53 53 for (int i = 0; i < n; i++) -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesRemover.cs
r2830 r2834 58 58 } 59 59 60 public override I ExecutionSequenceApply() {60 public override IOperation Apply() { 61 61 if (RemoveAllSubScopes) 62 62 CurrentScope.SubScopes.Clear(); -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesSorter.cs
r2818 r2834 56 56 } 57 57 58 public override I ExecutionSequenceApply() {58 public override IOperation Apply() { 59 59 descending = DescendingParameter.ActualValue.Value; 60 60 actualName = LookupParameter<ItemArray<DoubleData>>.TranslateName(ValueParameter.Name, ExecutionContext); -
trunk/sources/HeuristicLab.Operators/3.3/UniformParallelSubScopesProcessor.cs
r2818 r2834 45 45 } 46 46 47 public override I ExecutionSequenceApply() {48 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());47 public override IOperation Apply() { 48 OperationCollection next = new OperationCollection(base.Apply()); 49 49 if (Operator != null) { 50 ExecutionContextCollection inner = new ExecutionContextCollection();50 OperationCollection inner = new OperationCollection(); 51 51 inner.Parallel = true; 52 52 for (int i = 0; i < ExecutionContext.Scope.SubScopes.Count; i++) 53 inner.Add(ExecutionContext.Create Context(Operator, ExecutionContext.Scope.SubScopes[i]));53 inner.Add(ExecutionContext.CreateOperation(Operator, ExecutionContext.Scope.SubScopes[i])); 54 54 next.Insert(0, inner); 55 55 } -
trunk/sources/HeuristicLab.Operators/3.3/UniformSequentialSubScopesProcessor.cs
r2818 r2834 45 45 } 46 46 47 public override I ExecutionSequenceApply() {48 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());47 public override IOperation Apply() { 48 OperationCollection next = new OperationCollection(base.Apply()); 49 49 if (Operator != null) { 50 ExecutionContextCollection inner = new ExecutionContextCollection();50 OperationCollection inner = new OperationCollection(); 51 51 for (int i = 0; i < ExecutionContext.Scope.SubScopes.Count; i++) 52 inner.Add(ExecutionContext.Create Context(Operator, ExecutionContext.Scope.SubScopes[i]));52 inner.Add(ExecutionContext.CreateOperation(Operator, ExecutionContext.Scope.SubScopes[i])); 53 53 next.Insert(0, inner); 54 54 } -
trunk/sources/HeuristicLab.Operators/3.3/VariableCreator.cs
r2794 r2834 44 44 } 45 45 46 public override I ExecutionSequenceApply() {46 public override IOperation Apply() { 47 47 IVariable var; 48 48 foreach (IParameter param in CollectedValues) { -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ProblemView.Designer.cs
r2829 r2834 20 20 #endregion 21 21 22 namespace HeuristicLab. Core.Views {22 namespace HeuristicLab.Optimization.Views { 23 23 partial class ProblemView { 24 24 /// <summary> … … 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this. valueParameterCollectionView = new HeuristicLab.Core.Views.ValueParameterCollectionView();47 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 48 48 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 49 49 this.SuspendLayout(); … … 61 61 this.descriptionTextBox.Size = new System.Drawing.Size(418, 87); 62 62 // 63 // valueParameterCollectionView63 // parameterCollectionView 64 64 // 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) 66 66 | System.Windows.Forms.AnchorStyles.Left) 67 67 | 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; 74 74 // 75 75 // ProblemView … … 77 77 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 78 78 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 79 this.Controls.Add(this. valueParameterCollectionView);79 this.Controls.Add(this.parameterCollectionView); 80 80 this.Name = "ProblemView"; 81 81 this.Size = new System.Drawing.Size(490, 353); 82 this.Controls.SetChildIndex(this. valueParameterCollectionView, 0);82 this.Controls.SetChildIndex(this.parameterCollectionView, 0); 83 83 this.Controls.SetChildIndex(this.nameLabel, 0); 84 84 this.Controls.SetChildIndex(this.descriptionLabel, 0); … … 93 93 #endregion 94 94 95 protected ValueParameterCollectionView valueParameterCollectionView;95 protected HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView; 96 96 97 97 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ProblemView.cs
r2829 r2834 20 20 #endregion 21 21 22 using HeuristicLab.Core.Views; 22 23 using HeuristicLab.MainForm; 23 24 24 namespace HeuristicLab. Core.Views {25 namespace HeuristicLab.Optimization.Views { 25 26 /// <summary> 26 27 /// The base class for visual representations of items. … … 52 53 base.OnContentChanged(); 53 54 if (Content == null) 54 valueParameterCollectionView.Content = null;55 parameterCollectionView.Content = null; 55 56 else 56 valueParameterCollectionView.Content = ((IProblem)Content).Parameters;57 parameterCollectionView.Content = ((IProblem)Content).Parameters; 57 58 } 58 59 } -
trunk/sources/HeuristicLab.Optimization/3.3/IProblem.cs
r2829 r2834 20 20 #endregion 21 21 22 using HeuristicLab.Co llections;22 using HeuristicLab.Core; 23 23 24 namespace HeuristicLab. Core{24 namespace HeuristicLab.Optimization { 25 25 /// <summary> 26 26 /// Interface to represent a problem. 27 27 /// </summary> 28 public interface IProblem : INamedItem { 29 IObservableKeyedCollection<string, IValueParameter> Parameters { get; } 30 } 28 public interface IProblem : INamedItem, IParameterizedItem { } 31 29 } -
trunk/sources/HeuristicLab.Optimization/3.3/Problem.cs
r2829 r2834 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab. Core{27 namespace HeuristicLab.Optimization { 28 28 /// <summary> 29 29 /// The base class for all problems. … … 35 35 } 36 36 37 private ValueParameterCollection parameters;37 private ParameterCollection parameters; 38 38 [Storable] 39 protected ValueParameterCollection Parameters {39 protected ParameterCollection Parameters { 40 40 get { return parameters;} 41 41 private set { … … 46 46 } 47 47 } 48 private ReadOnlyObservableKeyedCollection<string, I ValueParameter> readOnlyParameters;49 IObservableKeyedCollection<string, I ValueParameter> IProblem.Parameters {48 private ReadOnlyObservableKeyedCollection<string, IParameter> readOnlyParameters; 49 IObservableKeyedCollection<string, IParameter> IParameterizedItem.Parameters { 50 50 get { 51 51 if (readOnlyParameters == null) readOnlyParameters = parameters.AsReadOnly(); … … 56 56 protected Problem() { 57 57 Name = ItemName; 58 Parameters = new ValueParameterCollection();58 Parameters = new ParameterCollection(); 59 59 readOnlyParameters = null; 60 60 } … … 62 62 public override IDeepCloneable Clone(Cloner cloner) { 63 63 Problem clone = (Problem)base.Clone(cloner); 64 clone.Parameters = ( ValueParameterCollection)cloner.Clone(parameters);64 clone.Parameters = (ParameterCollection)cloner.Clone(parameters); 65 65 return clone; 66 66 } -
trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs
r2818 r2834 74 74 IValueParameter valueParam = this as IValueParameter; 75 75 ILookupParameter lookupParam = this as ILookupParameter; 76 ExecutionContext current = ExecutionContext;76 IExecutionContext current = ExecutionContext; 77 77 78 78 name = Name; … … 82 82 83 83 current = current.Parent; 84 while ((current != null) && !current. Operator.Parameters.ContainsKey(name))84 while ((current != null) && !current.Parameters.ContainsKey(name)) 85 85 current = current.Parent; 86 86 87 87 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; 90 90 if ((valueParam == null) && (lookupParam == null)) 91 91 throw new InvalidOperationException( … … 108 108 return scope != null ? scope.Variables[actualName] : null; 109 109 } 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 //} 123 123 protected override IItem GetActualValue() { 124 124 string name; … … 141 141 142 142 // 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; 145 145 146 146 return null; … … 169 169 170 170 // 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 //} 176 176 177 177 // create new variable … … 186 186 } 187 187 188 public static string TranslateName(string name, ExecutionContext context) {188 public static string TranslateName(string name, IExecutionContext context) { 189 189 string currentName = name; 190 ExecutionContext currentContext = context;190 IExecutionContext currentContext = context; 191 191 IParameter param; 192 192 ILookupParameter lookupParam; 193 193 194 194 while (currentContext != null) { 195 currentContext. Operator.Parameters.TryGetValue(currentName, out param);195 currentContext.Parameters.TryGetValue(currentName, out param); 196 196 if (param != null) { 197 197 lookupParam = param as ILookupParameter; -
trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs
r2818 r2834 48 48 } 49 49 [Storable] 50 private ExecutionContext executionContext;51 public ExecutionContext ExecutionContext {50 private IExecutionContext executionContext; 51 public IExecutionContext ExecutionContext { 52 52 get { return executionContext; } 53 53 set { … … 77 77 Parameter clone = (Parameter)base.Clone(cloner); 78 78 clone.dataType = dataType; 79 clone.executionContext = ( ExecutionContext)cloner.Clone(executionContext);79 clone.executionContext = (IExecutionContext)cloner.Clone(executionContext); 80 80 return clone; 81 81 } -
trunk/sources/HeuristicLab.Permutation/3.3/PermutationCrossover.cs
r2794 r2834 49 49 } 50 50 51 public sealed override I ExecutionSequenceApply() {51 public sealed override IOperation Apply() { 52 52 ChildParameter.ActualValue = Cross(RandomParameter.ActualValue, ParentsParameter.ActualValue); 53 53 return base.Apply(); -
trunk/sources/HeuristicLab.Permutation/3.3/PermutationManipulator.cs
r2830 r2834 45 45 } 46 46 47 public sealed override I ExecutionSequenceApply() {47 public sealed override IOperation Apply() { 48 48 Manipulate(RandomParameter.ActualValue, PermutationParameter.ActualValue); 49 49 return base.Apply(); -
trunk/sources/HeuristicLab.Permutation/3.3/RandomPermutationCreator.cs
r2794 r2834 51 51 } 52 52 53 public override I ExecutionSequenceApply() {53 public override IOperation Apply() { 54 54 PermutationParameter.ActualValue = new Permutation(LengthParameter.ActualValue.Value, RandomParameter.ActualValue); 55 55 return base.Apply(); -
trunk/sources/HeuristicLab.Random/3.3/RandomCreator.cs
r2818 r2834 59 59 } 60 60 61 public override I ExecutionSequenceApply() {61 public override IOperation Apply() { 62 62 if (SetSeedRandomlyParameter.ActualValue == null) SetSeedRandomlyParameter.ActualValue = new BoolData(true); 63 63 bool setSeedRandomly = SetSeedRandomlyParameter.ActualValue.Value; -
trunk/sources/HeuristicLab.Routing.TSP.Views/3.3/HeuristicLab.Routing.TSP.Views-3.3.csproj
r2805 r2834 86 86 <Name>HeuristicLab.MainForm-3.2</Name> 87 87 </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> 88 96 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj"> 89 97 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> -
trunk/sources/HeuristicLab.Routing.TSP.Views/3.3/HeuristicLabRoutingTSPViewsPlugin.cs.frame
r2805 r2834 33 33 [PluginDependency("HeuristicLab.MainForm", "3.2")] 34 34 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.2")] 35 [PluginDependency("HeuristicLab.Optimization", "3.3")] 36 [PluginDependency("HeuristicLab.Optimization.Views", "3.3")] 35 37 [PluginDependency("HeuristicLab.Routing.TSP", "3.3")] 36 38 public class HeuristicLabRoutingTSPViewsPlugin : PluginBase { -
trunk/sources/HeuristicLab.Routing.TSP.Views/3.3/TSPView.Designer.cs
r2805 r2834 50 50 this.SuspendLayout(); 51 51 // 52 // valueParameterCollectionView52 // parameterCollectionView 53 53 // 54 this. valueParameterCollectionView.Size = new System.Drawing.Size(490, 205);54 this.parameterCollectionView.Size = new System.Drawing.Size(490, 205); 55 55 // 56 56 // nameTextBox … … 85 85 this.Name = "TSPView"; 86 86 this.Controls.SetChildIndex(this.importButton, 0); 87 this.Controls.SetChildIndex(this. valueParameterCollectionView, 0);87 this.Controls.SetChildIndex(this.parameterCollectionView, 0); 88 88 this.Controls.SetChildIndex(this.nameLabel, 0); 89 89 this.Controls.SetChildIndex(this.descriptionLabel, 0); -
trunk/sources/HeuristicLab.Routing.TSP.Views/3.3/TSPView.cs
r2805 r2834 24 24 using HeuristicLab.Core.Views; 25 25 using HeuristicLab.MainForm; 26 using HeuristicLab.Optimization.Views; 26 27 27 28 namespace HeuristicLab.Routing.TSP.Views { -
trunk/sources/HeuristicLab.Routing.TSP/3.3/HeuristicLab.Routing.TSP-3.3.csproj
r2830 r2834 109 109 <Name>HeuristicLab.Operators-3.3</Name> 110 110 </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> 111 115 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 112 116 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> -
trunk/sources/HeuristicLab.Routing.TSP/3.3/HeuristicLabRoutingTSPPlugin.cs.frame
r2805 r2834 32 32 [PluginDependency("HeuristicLab.Data", "3.3")] 33 33 [PluginDependency("HeuristicLab.Operators", "3.3")] 34 [PluginDependency("HeuristicLab.Optimization", "3.3")] 34 35 [PluginDependency("HeuristicLab.Parameters", "3.3")] 35 36 [PluginDependency("HeuristicLab.Permutation", "3.3")] -
trunk/sources/HeuristicLab.Routing.TSP/3.3/TSP.cs
r2830 r2834 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Data; 24 using HeuristicLab.Optimization; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Permutation; -
trunk/sources/HeuristicLab.Routing.TSP/3.3/TSPDistanceMatrixPathEvaluator.cs
r2805 r2834 51 51 } 52 52 53 public override I ExecutionSequenceApply() {53 public override IOperation Apply() { 54 54 DoubleMatrixData distanceMatrix = DistanceMatrixParameter.ActualValue; 55 55 Permutation.Permutation permutation = PermutationParameter.ActualValue; -
trunk/sources/HeuristicLab.Routing.TSP/3.3/TSPPathEvaluator.cs
r2805 r2834 50 50 } 51 51 52 public override I ExecutionSequenceApply() {52 public override IOperation Apply() { 53 53 DoubleMatrixData coordinates = CoordinatesParameter.ActualValue; 54 54 Permutation.Permutation permutation = PermutationParameter.ActualValue; -
trunk/sources/HeuristicLab.SGA/3.3/SGAOperator.cs
r2830 r2834 193 193 } 194 194 195 public override I ExecutionSequenceApply() {195 public override IOperation Apply() { 196 196 int populationSize = CurrentScope.SubScopes.Count; 197 197 // dynamically set the number of parents which are selected for reproduction -
trunk/sources/HeuristicLab.Selection/3.3/Reducer.cs
r2830 r2834 46 46 } 47 47 48 public sealed override I ExecutionSequenceApply() {48 public sealed override IOperation Apply() { 49 49 List<IScope> scopes = new List<IScope>(CurrentScope.SubScopes); 50 50 List<IScope> reduced = Reduce(scopes); -
trunk/sources/HeuristicLab.Selection/3.3/Selector.cs
r2830 r2834 59 59 } 60 60 61 public sealed override I ExecutionSequenceApply() {61 public sealed override IOperation Apply() { 62 62 List<IScope> scopes = new List<IScope>(CurrentScope.SubScopes); 63 63 IScope[] selected = Select(scopes); -
trunk/sources/HeuristicLab.SequentialEngine/3.3/SequentialEngine.cs
r2818 r2834 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 57 55 protected override void ProcessNextOperator() { 58 56 currentOperator = null; 59 I ExecutionSequencenext = ExecutionStack.Pop();60 ExecutionContextCollection coll = next as ExecutionContextCollection;57 IOperation next = ExecutionStack.Pop(); 58 OperationCollection coll = next as OperationCollection; 61 59 while (coll != null) { 62 60 for (int i = coll.Count - 1; i >= 0; i--) 63 61 ExecutionStack.Push(coll[i]); 64 62 next = ExecutionStack.Count > 0 ? ExecutionStack.Pop() : null; 65 coll = next as ExecutionContextCollection;63 coll = next as OperationCollection; 66 64 } 67 ExecutionContext context = next as ExecutionContext;68 if ( context!= null) {65 IAtomicOperation operation = next as IAtomicOperation; 66 if (operation != null) { 69 67 try { 70 currentOperator = context.Operator;71 ExecutionStack.Push( context.Operator.Execute(context));68 currentOperator = operation.Operator; 69 ExecutionStack.Push(operation.Operator.Execute((IExecutionContext)operation)); 72 70 currentOperator = null; 73 71 } 74 72 catch (Exception ex) { 75 ExecutionStack.Push( context);73 ExecutionStack.Push(operation); 76 74 Stop(); 77 75 OnExceptionOccurred(ex); 78 76 } 79 if ( context.Operator.Breakpoint)77 if (operation.Operator.Breakpoint) 80 78 Stop(); 81 79 }
Note: See TracChangeset
for help on using the changeset viewer.