Changeset 3226
- Timestamp:
- 03/28/10 04:11:23 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 13 added
- 15 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearchMainLoop.cs
r3195 r3226 24 24 using HeuristicLab.Data; 25 25 using HeuristicLab.Operators; 26 using HeuristicLab.Optimization.Operators; 26 27 using HeuristicLab.Parameters; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; -
trunk/sources/HeuristicLab.Core/3.3/Engine.cs
r3017 r3226 75 75 public bool Running { 76 76 get { return running; } 77 private set { 78 if (running != value) { 79 running = value; 80 OnRunningChanged(); 81 } 82 } 77 83 } 78 84 … … 126 132 127 133 public void Prepare(IOperation initialOperation) { 128 Canceled = false;129 running = false;130 134 ExecutionTime = new TimeSpan(); 131 135 executionStack.Clear(); … … 138 142 /// of class <see cref="ThreadPool"/>.</remarks> 139 143 public void Start() { 140 running = true;144 Running = true; 141 145 Canceled = false; 142 146 ThreadPool.QueueUserWorkItem(new WaitCallback(Run), null); … … 146 150 /// of class <see cref="ThreadPool"/>.</remarks> 147 151 public void Step() { 148 running = true;152 Running = true; 149 153 Canceled = false; 150 154 ThreadPool.QueueUserWorkItem(new WaitCallback(RunStep), null); … … 167 171 } 168 172 ExecutionTime += DateTime.Now - start; 169 running = false;170 173 OnStopped(); 171 174 } … … 176 179 ProcessNextOperator(); 177 180 ExecutionTime += DateTime.Now - start; 178 running = false;179 181 OnStopped(); 180 182 } … … 197 199 } 198 200 /// <summary> 201 /// Occurs when the running flag changed. 202 /// </summary> 203 public event EventHandler RunningChanged; 204 /// <summary> 205 /// Fires a new <c>RunningChanged</c> event. 206 /// </summary> 207 protected virtual void OnRunningChanged() { 208 if (RunningChanged != null) 209 RunningChanged(this, EventArgs.Empty); 210 } 211 /// <summary> 199 212 /// Occurs when the execution is prepared for a new run. 200 213 /// </summary> … … 228 241 if (Stopped != null) 229 242 Stopped(this, EventArgs.Empty); 243 Canceled = false; 244 Running = false; 230 245 } 231 246 protected virtual void OnCanceledChanged() { } -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IEngine.cs
r2916 r3226 66 66 event EventHandler ExecutionTimeChanged; 67 67 /// <summary> 68 /// Occurs when the running flag was changed. 69 /// </summary> 70 event EventHandler RunningChanged; 71 /// <summary> 68 72 /// Occurs when the engine is prepared for a new run. 69 73 /// </summary> -
trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj
r3193 r3226 91 91 <Compile Include="Assigner.cs" /> 92 92 <Compile Include="AlgorithmOperator.cs" /> 93 <Compile Include="ResultsCollector.cs" />94 93 <Compile Include="MultipleCallsOperator.cs" /> 95 94 <Compile Include="Operator.cs" /> -
trunk/sources/HeuristicLab.Optimization.Operators/3.3/HeuristicLab.Optimization.Operators-3.3.csproj
r3094 r3226 82 82 <ItemGroup> 83 83 <Compile Include="ProbabilisticQualityComparator.cs" /> 84 <Compile Include="ResultsCollector.cs" /> 84 85 <Compile Include="SquareRootDiscreteDoubleValueModifier.cs" /> 85 86 <Compile Include="DiscreteDoubleValueModifier.cs" /> -
trunk/sources/HeuristicLab.Optimization.Operators/3.3/ResultsCollector.cs
r3225 r3226 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Operators; 23 24 using HeuristicLab.Parameters; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 26 namespace HeuristicLab.Op erators {27 namespace HeuristicLab.Optimization.Operators { 27 28 /// <summary> 28 /// An operator which collects the actual values of parameters and adds them to a collection of variables.29 /// An operator which collects the actual values of parameters and adds them to a collection of results. 29 30 /// </summary> 30 [Item("ResultsCollector", "An operator which collects the actual values of parameters and adds them to a collection of variables.")]31 [Item("ResultsCollector", "An operator which collects the actual values of parameters and adds them to a collection of results.")] 31 32 [StorableClass] 32 33 public class ResultsCollector : ValuesCollector { 33 public ValueLookupParameter< VariableCollection> ResultsParameter {34 get { return (ValueLookupParameter< VariableCollection>)Parameters["Results"]; }34 public ValueLookupParameter<ResultCollection> ResultsParameter { 35 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } 35 36 } 36 37 37 38 public ResultsCollector() 38 39 : base() { 39 Parameters.Add(new ValueLookupParameter< VariableCollection>("Results", "The variablecollection where the collected values should be stored."));40 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the collected values should be stored.")); 40 41 } 41 42 42 43 public override IOperation Apply() { 43 VariableCollection results = ResultsParameter.ActualValue;44 I Variable var;44 ResultCollection results = ResultsParameter.ActualValue; 45 IResult result; 45 46 foreach (IParameter param in CollectedValues) { 46 47 IItem value = param.ActualValue; 47 48 if (value != null) { 48 results.TryGetValue(param.Name, out var);49 if ( var!= null)50 var.Value = value;49 results.TryGetValue(param.Name, out result); 50 if (result != null) 51 result.Value = value; 51 52 else 52 results.Add(new Variable(param.Name, param.Description, value));53 results.Add(new Result(param.Name, param.Description, value)); 53 54 } 54 55 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs
r3225 r3226 55 55 this.problemViewHost = new HeuristicLab.Core.Views.ViewHost(); 56 56 this.resultsTabPage = new System.Windows.Forms.TabPage(); 57 this.resultsView = new HeuristicLab. Core.Views.VariableCollectionView();57 this.resultsView = new HeuristicLab.Optimization.Views.ResultCollectionView(); 58 58 this.startButton = new System.Windows.Forms.Button(); 59 59 this.stopButton = new System.Windows.Forms.Button(); … … 192 192 | System.Windows.Forms.AnchorStyles.Left) 193 193 | System.Windows.Forms.AnchorStyles.Right))); 194 this.resultsView.Caption = " VariableCollection";194 this.resultsView.Caption = "ResultsCollection"; 195 195 this.resultsView.Content = null; 196 196 this.resultsView.Location = new System.Drawing.Point(6, 6); … … 319 319 protected System.Windows.Forms.SaveFileDialog saveFileDialog; 320 320 protected System.Windows.Forms.TabPage resultsTabPage; 321 protected HeuristicLab. Core.Views.VariableCollectionView resultsView;321 protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView; 322 322 323 323 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r3177 r3226 108 108 problemViewHost.ViewType = null; 109 109 problemViewHost.Content = Content.Problem; 110 resultsView.Content = Content.Results ;110 resultsView.Content = Content.Results.AsReadOnly(); 111 111 tabControl.Enabled = true; 112 112 startButton.Enabled = !Content.Finished; … … 127 127 Invoke(new EventHandler(Content_Prepared), sender, e); 128 128 else { 129 resultsView.Content = Content.Results ;129 resultsView.Content = Content.Results.AsReadOnly(); 130 130 startButton.Enabled = !Content.Finished; 131 131 UpdateExecutionTimeTextBox(); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj
r2900 r3226 92 92 <DependentUpon>AlgorithmView.cs</DependentUpon> 93 93 </Compile> 94 <Compile Include="BatchRunView.cs"> 95 <SubType>UserControl</SubType> 96 </Compile> 97 <Compile Include="BatchRunView.Designer.cs"> 98 <DependentUpon>BatchRunView.cs</DependentUpon> 99 </Compile> 100 <Compile Include="ResultCollectionListView.cs"> 101 <SubType>UserControl</SubType> 102 </Compile> 103 <Compile Include="ResultCollectionListView.Designer.cs"> 104 <DependentUpon>ResultCollectionListView.cs</DependentUpon> 105 </Compile> 94 106 <Compile Include="UserDefinedAlgorithmView.cs"> 95 107 <SubType>UserControl</SubType> … … 112 124 </Compile> 113 125 <Compile Include="Properties\AssemblyInfo.cs" /> 126 <Compile Include="ResultCollectionView.cs"> 127 <SubType>UserControl</SubType> 128 </Compile> 129 <Compile Include="ResultCollectionView.Designer.cs"> 130 <DependentUpon>ResultCollectionView.cs</DependentUpon> 131 </Compile> 132 <Compile Include="ResultView.cs"> 133 <SubType>UserControl</SubType> 134 </Compile> 135 <Compile Include="ResultView.Designer.cs"> 136 <DependentUpon>ResultView.cs</DependentUpon> 137 </Compile> 114 138 </ItemGroup> 115 139 <ItemGroup> -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs
r3107 r3226 66 66 } 67 67 68 public abstract IObservableKeyedCollection<string, IVariable>Results { get; }68 public abstract ResultCollection Results { get; } 69 69 70 70 public abstract TimeSpan ExecutionTime { get; } … … 73 73 public bool Running { 74 74 get { return running; } 75 protected set { 76 if (running != value) { 77 running = value; 78 OnRunningChanged(); 79 } 80 } 75 81 } 76 82 … … 98 104 clone.Problem = (IProblem)cloner.Clone(problem); 99 105 clone.running = running; 100 clone. Canceled = canceled;106 clone.canceled = canceled; 101 107 return clone; 102 108 } 103 109 104 110 public void Prepare() { 105 running = false;106 Canceled = false;107 111 OnPrepared(); 108 112 } 109 113 public void Start() { 110 running = true;114 Running = true; 111 115 Canceled = false; 112 116 OnStarted(); … … 127 131 ExecutionTimeChanged(this, EventArgs.Empty); 128 132 } 133 public event EventHandler RunningChanged; 134 protected virtual void OnRunningChanged() { 135 if (RunningChanged != null) 136 RunningChanged(this, EventArgs.Empty); 137 } 129 138 public event EventHandler Prepared; 130 139 protected virtual void OnPrepared() { … … 141 150 if (Stopped != null) 142 151 Stopped(this, EventArgs.Empty); 152 Canceled = false; 153 Running = false; 143 154 } 144 155 protected virtual void OnCanceledChanged() { } -
trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs
r3017 r3226 88 88 } 89 89 90 private ReadOnlyObservableKeyedCollection<string, IVariable> readOnlyResults; 91 public override IObservableKeyedCollection<string, IVariable> Results { 90 public override ResultCollection Results { 92 91 get { 93 if (readOnlyResults == null) 94 readOnlyResults = ((VariableCollection)globalScope.Variables["Results"].Value).AsReadOnly(); 95 return readOnlyResults; 92 return (ResultCollection)globalScope.Variables["Results"].Value; 96 93 } 97 94 } … … 114 111 : base() { 115 112 globalScope = new Scope("Global Scope"); 116 globalScope.Variables.Add(new Variable("Results", new VariableCollection()));113 globalScope.Variables.Add(new Variable("Results", new ResultCollection())); 117 114 OperatorGraph = new OperatorGraph(); 118 115 InitializeEngine(); … … 121 118 : base(name) { 122 119 globalScope = new Scope("Global Scope"); 123 globalScope.Variables.Add(new Variable("Results", new VariableCollection()));120 globalScope.Variables.Add(new Variable("Results", new ResultCollection())); 124 121 OperatorGraph = new OperatorGraph(); 125 122 InitializeEngine(); … … 128 125 : base(name, parameters) { 129 126 globalScope = new Scope("Global Scope"); 130 globalScope.Variables.Add(new Variable("Results", new VariableCollection()));127 globalScope.Variables.Add(new Variable("Results", new ResultCollection())); 131 128 OperatorGraph = new OperatorGraph(); 132 129 InitializeEngine(); … … 135 132 : base(name, description) { 136 133 globalScope = new Scope("Global Scope"); 137 globalScope.Variables.Add(new Variable("Results", new VariableCollection()));134 globalScope.Variables.Add(new Variable("Results", new ResultCollection())); 138 135 OperatorGraph = new OperatorGraph(); 139 136 InitializeEngine(); … … 142 139 : base(name, description, parameters) { 143 140 globalScope = new Scope("Global Scope"); 144 globalScope.Variables.Add(new Variable("Results", new VariableCollection()));141 globalScope.Variables.Add(new Variable("Results", new ResultCollection())); 145 142 OperatorGraph = new OperatorGraph(); 146 143 InitializeEngine(); … … 181 178 protected override void OnPrepared() { 182 179 globalScope.Clear(); 183 globalScope.Variables.Add(new Variable("Results", new VariableCollection())); 184 readOnlyResults = null; 180 globalScope.Variables.Add(new Variable("Results", new ResultCollection())); 185 181 186 182 if (engine != null) { -
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r3107 r3226 86 86 <None Include="HeuristicLabOptimizationPlugin.cs.frame" /> 87 87 <Compile Include="Algorithm.cs" /> 88 <Compile Include="BatchRun.cs" /> 89 <Compile Include="ResultCollectionList.cs" /> 88 90 <Compile Include="Interfaces\IMultiObjectiveSolutionsVisualizer.cs" /> 91 <Compile Include="Interfaces\IResult.cs" /> 89 92 <Compile Include="Interfaces\ISingleObjectiveSolutionsVisualizer.cs" /> 90 93 <Compile Include="Interfaces\ISolutionsVisualizer.cs" /> … … 114 117 <Compile Include="Interfaces\ITabuMoveEvaluator.cs" /> 115 118 <Compile Include="Interfaces\ITabuMoveMaker.cs" /> 119 <Compile Include="Result.cs" /> 116 120 <Compile Include="TabuMoveMaker.cs" /> 117 121 <Compile Include="UserDefinedAlgorithm.cs" /> … … 119 123 <Compile Include="HeuristicLabOptimizationPlugin.cs" /> 120 124 <Compile Include="Properties\AssemblyInfo.cs" /> 125 <Compile Include="ResultCollection.cs" /> 121 126 </ItemGroup> 122 127 <ItemGroup> -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IAlgorithm.cs
r2882 r3226 32 32 Type ProblemType { get; } 33 33 IProblem Problem { get; set; } 34 IObservableKeyedCollection<string, IVariable>Results { get; }34 ResultCollection Results { get; } 35 35 TimeSpan ExecutionTime { get; } 36 36 bool Running { get; } … … 43 43 event EventHandler ProblemChanged; 44 44 event EventHandler ExecutionTimeChanged; 45 event EventHandler RunningChanged; 45 46 event EventHandler Prepared; 46 47 event EventHandler Started; -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r3202 r3226 137 137 <None Include="app.config" /> 138 138 <EmbeddedResource Include="Documents\FirstSteps.rtf" /> 139 <EmbeddedResource Include="Documents\GA_TSP.hl" />140 <EmbeddedResource Include="Documents\LS_OneMax.hl" />141 <EmbeddedResource Include="Documents\SA_Rastrigin.hl" />142 139 <None Include="HeuristicLab.snk" /> 143 140 <None Include="Properties\AssemblyInfo.frame" /> … … 178 175 </ItemGroup> 179 176 <ItemGroup> 177 <EmbeddedResource Include="Documents\GA_TSP.hl" /> 180 178 <EmbeddedResource Include="Properties\Resources.resx"> 181 179 <Generator>ResXFileCodeGenerator</Generator> -
trunk/sources/HeuristicLab.SequentialEngine/3.3/SequentialEngine.cs
r3017 r3226 60 60 catch (Exception ex) { 61 61 ExecutionStack.Push(operation); 62 OnExceptionOccurred(ex); 62 63 Stop(); 63 OnExceptionOccurred(ex);64 64 } 65 65 if (operation.Operator.Breakpoint)
Note: See TracChangeset
for help on using the changeset viewer.