Changeset 10114 for branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching
- Timestamp:
- 11/07/13 16:30:39 (11 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3
- Files:
-
- 2 added
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/HeuristicLab.Analysis.SolutionCaching-3.3.csproj
r10111 r10114 38 38 </PropertyGroup> 39 39 <ItemGroup> 40 <Reference Include=" ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">40 <Reference Include="HeuristicLab.Clients.Hive-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 41 41 <SpecificVersion>False</SpecificVersion> 42 <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath> 43 <Private>False</Private> 44 </Reference> 45 <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 46 <SpecificVersion>False</SpecificVersion> 47 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.DataAnalysis-3.4.dll</HintPath> 48 <Private>False</Private> 49 </Reference> 50 <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 42 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Clients.Hive-3.3.dll</HintPath> 51 43 <Private>False</Private> 52 44 </Reference> … … 57 49 <Reference Include="HeuristicLab.Common-3.3"> 58 50 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 59 <Private>False</Private>60 </Reference>61 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">62 51 <Private>False</Private> 63 52 </Reference> … … 90 79 <Private>False</Private> 91 80 </Reference> 92 <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">93 <Private>False</Private>94 </Reference>95 <Reference Include="HeuristicLab.Optimization.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">96 <Private>False</Private>97 </Reference>98 81 <Reference Include="HeuristicLab.Parameters-3.3"> 99 82 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> … … 107 90 <Private>False</Private> 108 91 </Reference> 109 <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">110 <SpecificVersion>False</SpecificVersion>111 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>112 <Private>False</Private>113 </Reference>114 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">115 <SpecificVersion>False</SpecificVersion>116 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>117 <Private>False</Private>118 </Reference>119 92 <Reference Include="System" /> 120 93 <Reference Include="System.Core" /> 121 94 <Reference Include="System.Drawing" /> 122 <Reference Include="System.Windows.Forms" />123 <Reference Include="System.Xml.Linq" />124 <Reference Include="System.Data.DataSetExtensions" />125 <Reference Include="Microsoft.CSharp" />126 <Reference Include="System.Data" />127 <Reference Include="System.Xml" />128 95 </ItemGroup> 129 96 <ItemGroup> … … 154 121 <Compile Include="RealVectorEncoding\RealVectorSolutionCacheCollector.cs" /> 155 122 <Compile Include="RealVectorEncoding\RealVectorSolutionInformation.cs" /> 123 <Compile Include="RunCollectionModifiers\RunCollectionModifierExecutable.cs" /> 124 <Compile Include="RunCollectionModifiers\RunCollectionModifierHiveTask.cs" /> 156 125 <Compile Include="RunCollectionModifiers\RunCollectionModifierTask.cs" /> 157 126 <Compile Include="SolutionCache.cs" /> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/Plugin.cs.frame
r10023 r10114 26 26 [PluginFile("HeuristicLab.Analysis.SolutionCaching-3.3.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Collections", "3.3")] 28 [PluginDependency("HeuristicLab.Clients.Hive", "3.3")] 29 [PluginDependency("HeuristicLab.Hive", "3.3")] 28 30 [PluginDependency("HeuristicLab.Common", "3.3")] 29 [PluginDependency("HeuristicLab.Analysis", "3.3")]30 31 [PluginDependency("HeuristicLab.Core", "3.3")] 31 32 [PluginDependency("HeuristicLab.Data", "3.3")] … … 34 35 [PluginDependency("HeuristicLab.Operators", "3.3")] 35 36 [PluginDependency("HeuristicLab.Optimization", "3.3")] 36 [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]37 37 [PluginDependency("HeuristicLab.Parameters", "3.3")] 38 38 [PluginDependency("HeuristicLab.Persistence", "3.3")] -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RunCollectionModifiers/RunCollectionModifierExecutable.cs
r10113 r10114 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Text;26 25 using System.Threading; 27 26 using System.Threading.Tasks; 28 27 using HeuristicLab.Common; 29 28 using HeuristicLab.Core; 30 using HeuristicLab.Hive;31 29 using HeuristicLab.Optimization; 32 30 using HeuristicLab.Parameters; 33 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 34 32 35 namespace HeuristicLab.Analysis.SolutionCaching .RunCollectionModifiers{36 [Item("RunCollectionModifier Task", "An item that runs RunCollectionModifiers on RunCollections with Hive support.")]33 namespace HeuristicLab.Analysis.SolutionCaching { 34 [Item("RunCollectionModifierExecutable", "An executable that runs RunCollectionModifiers on RunCollections.")] 37 35 [StorableClass] 38 public class RunCollectionModifierTask : ParameterizedNamedItem, ITask { 39 public virtual bool IsParallelizable { 40 get { return false; } 41 } 42 43 public virtual bool ComputeInParallel { 44 get { return false; } 45 set { 46 throw new NotSupportedException("Parallelization is not supported for RunCollectionModifierTasks."); 47 } 48 } 49 36 public class RunCollectionModifierExecutable : ParameterizedNamedItem, IExecutable { 50 37 [Storable] 51 38 protected ExecutionState executionState; … … 101 88 102 89 #region Constructors and Cloning 103 public RunCollectionModifier Task() {90 public RunCollectionModifierExecutable() { 104 91 Parameters.Add(new ValueParameter<ItemList<IRunCollectionModifier>>("RunCollectionModifiers", "List of RunCollectionModifiers that are executed. ", new ItemList<IRunCollectionModifier>())); 105 92 executionStack = new Stack<IRunCollectionModifier>(); … … 108 95 } 109 96 [StorableConstructor] 110 protected RunCollectionModifier Task(bool deserializing) : base(deserializing) { }111 protected RunCollectionModifier Task(RunCollectionModifierTaskoriginal, Cloner cloner)97 protected RunCollectionModifierExecutable(bool deserializing) : base(deserializing) { } 98 protected RunCollectionModifierExecutable(RunCollectionModifierExecutable original, Cloner cloner) 112 99 : base(original, cloner) { 113 100 executionTime = original.executionTime; … … 121 108 } 122 109 public override IDeepCloneable Clone(Cloner cloner) { 123 return new RunCollectionModifier Task(this, cloner);110 return new RunCollectionModifierExecutable(this, cloner); 124 111 } 125 112 #endregion … … 134 121 executionStack.Push(runCollectionModifier); 135 122 } 136 137 executionState = ExecutionState.Prepared;138 123 } 139 124 … … 151 136 } 152 137 catch (AggregateException remaining) { 153 if (remaining.InnerExceptions.Count == 1) On TaskFailed(remaining.InnerExceptions[0]);154 else On TaskFailed(remaining);138 if (remaining.InnerExceptions.Count == 1) OnExceptionOccuted(remaining.InnerExceptions[0]); 139 else OnExceptionOccuted(remaining); 155 140 } 156 141 } … … 158 143 cancellationTokenSource = null; 159 144 if (stopPending) executionStack.Clear(); 160 if (executionStack.Count == 0) On TaskStopped();161 else On TaskPaused();145 if (executionStack.Count == 0) OnStopped(); 146 else OnPaused(); 162 147 }); 163 148 } … … 166 151 if (ExecutionState == ExecutionState.Paused) { 167 152 executionStack.Clear(); 168 On TaskStopped();153 OnStopped(); 169 154 } else { 170 155 stopPending = true; … … 179 164 protected virtual void RunModifiers(object state) { 180 165 CancellationToken ct = (CancellationToken)state; 181 On TaskStarted();166 OnStarted(); 182 167 183 168 IRunCollectionModifier next; … … 197 182 198 183 #region Events 199 public event EventHandler TaskStarted; 200 protected virtual void OnTaskStarted() { 184 public event EventHandler Prepared; 185 protected virtual void OnPrepared() { 186 ExecutionState = ExecutionState.Prepared; 187 EventHandler handler = Prepared; 188 if (handler != null) handler(this, EventArgs.Empty); 189 } 190 public event EventHandler Started; 191 protected virtual void OnStarted() { 201 192 executionState = ExecutionState.Started; 202 EventHandler handler = TaskStarted; 203 if (handler != null) handler(this, EventArgs.Empty); 204 } 205 206 public event EventHandler TaskStopped; 207 protected virtual void OnTaskStopped() { 193 EventHandler handler = Started; 194 if (handler != null) handler(this, EventArgs.Empty); 195 } 196 public event EventHandler Stopped; 197 protected virtual void OnStopped() { 208 198 executionState = ExecutionState.Stopped; 209 EventHandler handler = TaskStopped; 210 if (handler != null) handler(this, EventArgs.Empty); 211 } 212 213 public event EventHandler TaskPaused; 214 protected virtual void OnTaskPaused() { 199 EventHandler handler = Stopped; 200 if (handler != null) handler(this, EventArgs.Empty); 201 } 202 public event EventHandler Paused; 203 protected virtual void OnPaused() { 215 204 executionState = ExecutionState.Paused; 216 EventHandler handler = TaskPaused; 217 if (handler != null) handler(this, EventArgs.Empty); 218 } 219 220 public event EventHandler TaskFailed; 221 protected virtual void OnTaskFailed(Exception e) { 205 EventHandler handler = Paused; 206 if (handler != null) handler(this, EventArgs.Empty); 207 } 208 public event EventHandler<EventArgs<Exception>> ExceptionOccurred; 209 protected virtual void OnExceptionOccuted(Exception e) { 222 210 var eventArgs = new EventArgs<Exception>(e); 223 211 Log.LogException(e); 224 EventHandler handler = TaskFailed;212 EventHandler<EventArgs<Exception>> handler = ExceptionOccurred; 225 213 if (handler != null) handler(this, eventArgs); 226 214 } 227 228 215 public event EventHandler ExecutionTimeChanged; 229 216 protected virtual void OnExecutionTimeChanged() { … … 231 218 if (handler != null) handler(this, EventArgs.Empty); 232 219 } 233 234 220 public event EventHandler ExecutionStateChanged; 235 221 protected virtual void OnExecutionStateChanged() { … … 237 223 if (handler != null) handler(this, EventArgs.Empty); 238 224 } 239 240 public event EventHandler ComputeInParallelChanged; //not needed241 225 #endregion 242 226 }
Note: See TracChangeset
for help on using the changeset viewer.