Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10121


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
Files:
2 added
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching.Views/3.3/CreateRunCollectionModifierTasksMenuItem.cs

    r10113 r10121  
    4545    public override void Execute() {
    4646      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
    47       using (RunCollectionModifierTasksConfigurator configurator = new RunCollectionModifierTasksConfigurator()) {
    48         configurator.Content = activeView.Content as IOptimizer;
    49         configurator.ShowDialog();
    50       }
     47      IOptimizer opt = activeView.Content as IOptimizer;
     48      RunCollectionModifierExecutable runCollectionModifierExecutable = new RunCollectionModifierExecutable();
     49      runCollectionModifierExecutable.RunCollection.AddRange(opt.Runs);
     50      MainFormManager.MainForm.ShowContent(runCollectionModifierExecutable);
    5151    }
    5252  }
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching.Views/3.3/HeuristicLab.Analysis.SolutionCaching.Views-3.3.csproj

    r10115 r10121  
    136136  <ItemGroup>
    137137    <Compile Include="CreateRunCollectionModifierTasksMenuItem.cs" />
     138    <Compile Include="RunCollectionModifierExecutableView.cs">
     139      <SubType>UserControl</SubType>
     140    </Compile>
     141    <Compile Include="RunCollectionModifierExecutableView.Designer.cs">
     142      <DependentUpon>RunCollectionModifierExecutableView.cs</DependentUpon>
     143    </Compile>
    138144    <Compile Include="PermutationSolutionCacheView.cs">
    139145      <SubType>UserControl</SubType>
     
    141147    <Compile Include="RealVectorSolutionCacheView.cs">
    142148      <SubType>UserControl</SubType>
    143     </Compile>
    144     <Compile Include="RunCollectionModifierTasksConfigurator.cs">
    145       <SubType>Form</SubType>
    146     </Compile>
    147     <Compile Include="RunCollectionModifierTasksConfigurator.Designer.cs">
    148       <DependentUpon>RunCollectionModifierTasksConfigurator.cs</DependentUpon>
    149149    </Compile>
    150150    <Compile Include="SolutionCacheView.cs">
  • 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.