Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/11/13 15:51:16 (11 years ago)
Author:
ascheibe
Message:

#1886 improved RunCollectionModifierExecutable and added a new view for it

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/HeuristicLab.Analysis.SolutionCaching-3.3.csproj

    r10117 r10121  
    6969      <SpecificVersion>False</SpecificVersion>
    7070      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Hive-3.3.dll</HintPath>
     71      <Private>False</Private>
     72    </Reference>
     73    <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     74      <SpecificVersion>False</SpecificVersion>
     75      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
    7176      <Private>False</Private>
    7277    </Reference>
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/Plugin.cs.frame

    r10114 r10121  
    2929  [PluginDependency("HeuristicLab.Hive", "3.3")]
    3030  [PluginDependency("HeuristicLab.Common", "3.3")]
     31  [PluginDependency("HeuristicLab.MainForm", "3.3")]
    3132  [PluginDependency("HeuristicLab.Core", "3.3")]
    3233  [PluginDependency("HeuristicLab.Data", "3.3")]
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RunCollectionModifiers/RunCollectionModifierExecutable.cs

    r10120 r10121  
    2727using HeuristicLab.Common;
    2828using HeuristicLab.Core;
     29using HeuristicLab.MainForm;
    2930using HeuristicLab.Optimization;
    3031using HeuristicLab.Parameters;
     
    5960    }
    6061
     62    [Storable]
     63    protected Stack<IRunCollectionModifier> executionStack;
     64    protected Stack<IRunCollectionModifier> ExecutionStack {
     65      get { return executionStack; }
     66    }
     67
     68    [Storable]
     69    protected ILog log;
     70    public ILog Log {
     71      get { return log; }
     72    }
     73
     74    protected CancellationTokenSource cancellationTokenSource;
     75    protected bool stopPending;
     76    public IProgress Progress { get; set; }
     77
    6178    public ValueParameter<ItemList<IRunCollectionModifier>> RunCollectionModifiersParameter {
    6279      get { return (ValueParameter<ItemList<IRunCollectionModifier>>)Parameters["RunCollectionModifiers"]; }
     
    7289      get { return RunCollectionModifiersParameter.Value; }
    7390    }
    74 
    75     [Storable]
    76     protected Stack<IRunCollectionModifier> executionStack;
    77     protected Stack<IRunCollectionModifier> ExecutionStack {
    78       get { return executionStack; }
    79     }
    80 
    81     [Storable]
    82     protected ILog log;
    83     public ILog Log {
    84       get { return log; }
    85     }
    86 
    87     protected CancellationTokenSource cancellationTokenSource;
    88     protected bool stopPending;
    8991
    9092    #region Constructors and Cloning
     
    9496      executionStack = new Stack<IRunCollectionModifier>();
    9597      log = new Log();
     98      executionState = ExecutionState.Stopped;
    9699    }
    97100    [StorableConstructor]
     
    112115    #endregion
    113116
     117    protected virtual void ReportProgress(double progress) {
     118      if (Progress != null) {
     119        Progress.ProgressValue = progress;
     120      }
     121    }
     122
     123    protected virtual void FinishProgress() {
     124      if (Progress != null) {
     125        Progress.Finish();
     126      }
     127    }
     128
    114129    public void Pause() {
    115130      cancellationTokenSource.Cancel();
     
    121136        executionStack.Push(RunCollectionModifiers[i]);
    122137      }
     138      OnPrepared();
    123139    }
    124140
     
    140156          }
    141157        }
     158        FinishProgress();
    142159        cancellationTokenSource.Dispose();
    143160        cancellationTokenSource = null;
     
    150167    public void Stop() {
    151168      if (ExecutionState == ExecutionState.Paused) {
    152         executionStack.Clear();
    153169        OnStopped();
    154170      } else {
     
    173189          ct.ThrowIfCancellationRequested();
    174190          next.Modify(runs);
     191          if (executionStack.Count > 0) {
     192            ReportProgress(((double)RunCollectionModifiers.Count) / executionStack.Count());
     193          } else {
     194            ReportProgress(1.0);
     195          }
    175196        }
    176197        catch (Exception ex) {
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RunCollectionModifiers/RunCollectionModifierHiveTask.cs

    r10117 r10121  
    9797              var rcmHiveTask = new RunCollectionModifierHiveTask(exec);
    9898              rcmHiveTask.Task.Priority = Task.Priority;
     99              rcmHiveTask.ItemTask.IsParallelizable = false;
    99100              childHiveTasks.Add(rcmHiveTask);
    100101            }
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RunCollectionModifiers/RunCollectionModifierTask.cs

    r10119 r10121  
    3535    }
    3636
     37    [Storable]
     38    private bool isParallelizable;
     39    public override bool IsParallelizable {
     40      get { return isParallelizable; }
     41      set { isParallelizable = value; }
     42    }
     43
    3744    #region Constructors and Cloning
    3845    public RunCollectionModifierTask(RunCollectionModifierExecutable executable)
    3946      : base() {
    4047      Item = executable;
     48      isParallelizable = true;
    4149    }
    4250    [StorableConstructor]
     
    4452    protected RunCollectionModifierTask(RunCollectionModifierTask original, Cloner cloner)
    4553      : base(original, cloner) {
     54      isParallelizable = original.isParallelizable;
    4655    }
    4756    public override IDeepCloneable Clone(Cloner cloner) {
Note: See TracChangeset for help on using the changeset viewer.