Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/07/13 16:30:39 (11 years ago)
Author:
ascheibe
Message:

#1886 added tasks and hive tasks for RunCollectionModifiers

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  
    3838  </PropertyGroup>
    3939  <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">
    4141      <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>
    5143      <Private>False</Private>
    5244    </Reference>
     
    5749    <Reference Include="HeuristicLab.Common-3.3">
    5850      <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">
    6251      <Private>False</Private>
    6352    </Reference>
     
    9079      <Private>False</Private>
    9180    </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>
    9881    <Reference Include="HeuristicLab.Parameters-3.3">
    9982      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     
    10790      <Private>False</Private>
    10891    </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>
    11992    <Reference Include="System" />
    12093    <Reference Include="System.Core" />
    12194    <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" />
    12895  </ItemGroup>
    12996  <ItemGroup>
     
    154121    <Compile Include="RealVectorEncoding\RealVectorSolutionCacheCollector.cs" />
    155122    <Compile Include="RealVectorEncoding\RealVectorSolutionInformation.cs" />
     123    <Compile Include="RunCollectionModifiers\RunCollectionModifierExecutable.cs" />
     124    <Compile Include="RunCollectionModifiers\RunCollectionModifierHiveTask.cs" />
    156125    <Compile Include="RunCollectionModifiers\RunCollectionModifierTask.cs" />
    157126    <Compile Include="SolutionCache.cs" />
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/Plugin.cs.frame

    r10023 r10114  
    2626  [PluginFile("HeuristicLab.Analysis.SolutionCaching-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
     28  [PluginDependency("HeuristicLab.Clients.Hive", "3.3")]
     29  [PluginDependency("HeuristicLab.Hive", "3.3")]
    2830  [PluginDependency("HeuristicLab.Common", "3.3")]
    29   [PluginDependency("HeuristicLab.Analysis", "3.3")]
    3031  [PluginDependency("HeuristicLab.Core", "3.3")]
    3132  [PluginDependency("HeuristicLab.Data", "3.3")]
     
    3435  [PluginDependency("HeuristicLab.Operators", "3.3")]
    3536  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    36   [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
    3737  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3838  [PluginDependency("HeuristicLab.Persistence", "3.3")]
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RunCollectionModifiers/RunCollectionModifierExecutable.cs

    r10113 r10114  
    2323using System.Collections.Generic;
    2424using System.Linq;
    25 using System.Text;
    2625using System.Threading;
    2726using System.Threading.Tasks;
    2827using HeuristicLab.Common;
    2928using HeuristicLab.Core;
    30 using HeuristicLab.Hive;
    3129using HeuristicLab.Optimization;
    3230using HeuristicLab.Parameters;
    3331using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3432
    35 namespace HeuristicLab.Analysis.SolutionCaching.RunCollectionModifiers {
    36   [Item("RunCollectionModifierTask", "An item that runs RunCollectionModifiers on RunCollections with Hive support.")]
     33namespace HeuristicLab.Analysis.SolutionCaching {
     34  [Item("RunCollectionModifierExecutable", "An executable that runs RunCollectionModifiers on RunCollections.")]
    3735  [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 {
    5037    [Storable]
    5138    protected ExecutionState executionState;
     
    10188
    10289    #region Constructors and Cloning
    103     public RunCollectionModifierTask() {
     90    public RunCollectionModifierExecutable() {
    10491      Parameters.Add(new ValueParameter<ItemList<IRunCollectionModifier>>("RunCollectionModifiers", "List of RunCollectionModifiers that are executed. ", new ItemList<IRunCollectionModifier>()));
    10592      executionStack = new Stack<IRunCollectionModifier>();
     
    10895    }
    10996    [StorableConstructor]
    110     protected RunCollectionModifierTask(bool deserializing) : base(deserializing) { }
    111     protected RunCollectionModifierTask(RunCollectionModifierTask original, Cloner cloner)
     97    protected RunCollectionModifierExecutable(bool deserializing) : base(deserializing) { }
     98    protected RunCollectionModifierExecutable(RunCollectionModifierExecutable original, Cloner cloner)
    11299      : base(original, cloner) {
    113100      executionTime = original.executionTime;
     
    121108    }
    122109    public override IDeepCloneable Clone(Cloner cloner) {
    123       return new RunCollectionModifierTask(this, cloner);
     110      return new RunCollectionModifierExecutable(this, cloner);
    124111    }
    125112    #endregion
     
    134121        executionStack.Push(runCollectionModifier);
    135122      }
    136 
    137       executionState = ExecutionState.Prepared;
    138123    }
    139124
     
    151136          }
    152137          catch (AggregateException remaining) {
    153             if (remaining.InnerExceptions.Count == 1) OnTaskFailed(remaining.InnerExceptions[0]);
    154             else OnTaskFailed(remaining);
     138            if (remaining.InnerExceptions.Count == 1) OnExceptionOccuted(remaining.InnerExceptions[0]);
     139            else OnExceptionOccuted(remaining);
    155140          }
    156141        }
     
    158143        cancellationTokenSource = null;
    159144        if (stopPending) executionStack.Clear();
    160         if (executionStack.Count == 0) OnTaskStopped();
    161         else OnTaskPaused();
     145        if (executionStack.Count == 0) OnStopped();
     146        else OnPaused();
    162147      });
    163148    }
     
    166151      if (ExecutionState == ExecutionState.Paused) {
    167152        executionStack.Clear();
    168         OnTaskStopped();
     153        OnStopped();
    169154      } else {
    170155        stopPending = true;
     
    179164    protected virtual void RunModifiers(object state) {
    180165      CancellationToken ct = (CancellationToken)state;
    181       OnTaskStarted();
     166      OnStarted();
    182167
    183168      IRunCollectionModifier next;
     
    197182
    198183    #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() {
    201192      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() {
    208198      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() {
    215204      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) {
    222210      var eventArgs = new EventArgs<Exception>(e);
    223211      Log.LogException(e);
    224       EventHandler handler = TaskFailed;
     212      EventHandler<EventArgs<Exception>> handler = ExceptionOccurred;
    225213      if (handler != null) handler(this, eventArgs);
    226214    }
    227 
    228215    public event EventHandler ExecutionTimeChanged;
    229216    protected virtual void OnExecutionTimeChanged() {
     
    231218      if (handler != null) handler(this, EventArgs.Empty);
    232219    }
    233 
    234220    public event EventHandler ExecutionStateChanged;
    235221    protected virtual void OnExecutionStateChanged() {
     
    237223      if (handler != null) handler(this, EventArgs.Empty);
    238224    }
    239 
    240     public event EventHandler ComputeInParallelChanged; //not needed
    241225    #endregion
    242226  }
Note: See TracChangeset for help on using the changeset viewer.