Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/28/10 04:11:23 (15 years ago)
Author:
swagner
Message:

Implemented first version of algorithm batch processing (#947).

Location:
trunk/sources/HeuristicLab.Optimization/3.3
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs

    r3107 r3226  
    6666    }
    6767
    68     public abstract IObservableKeyedCollection<string, IVariable> Results { get; }
     68    public abstract ResultCollection Results { get; }
    6969
    7070    public abstract TimeSpan ExecutionTime { get; }
     
    7373    public bool Running {
    7474      get { return running; }
     75      protected set {
     76        if (running != value) {
     77          running = value;
     78          OnRunningChanged();
     79        }
     80      }
    7581    }
    7682
     
    98104      clone.Problem = (IProblem)cloner.Clone(problem);
    99105      clone.running = running;
    100       clone.Canceled = canceled;
     106      clone.canceled = canceled;
    101107      return clone;
    102108    }
    103109
    104110    public void Prepare() {
    105       running = false;
    106       Canceled = false;
    107111      OnPrepared();
    108112    }
    109113    public void Start() {
    110       running = true;
     114      Running = true;
    111115      Canceled = false;
    112116      OnStarted();
     
    127131        ExecutionTimeChanged(this, EventArgs.Empty);
    128132    }
     133    public event EventHandler RunningChanged;
     134    protected virtual void OnRunningChanged() {
     135      if (RunningChanged != null)
     136        RunningChanged(this, EventArgs.Empty);
     137    }
    129138    public event EventHandler Prepared;
    130139    protected virtual void OnPrepared() {
     
    141150      if (Stopped != null)
    142151        Stopped(this, EventArgs.Empty);
     152      Canceled = false;
     153      Running = false;
    143154    }
    144155    protected virtual void OnCanceledChanged() { }
  • trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs

    r3017 r3226  
    8888    }
    8989
    90     private ReadOnlyObservableKeyedCollection<string, IVariable> readOnlyResults;
    91     public override IObservableKeyedCollection<string, IVariable> Results {
     90    public override ResultCollection Results {
    9291      get {
    93         if (readOnlyResults == null)
    94           readOnlyResults = ((VariableCollection)globalScope.Variables["Results"].Value).AsReadOnly();
    95         return readOnlyResults;
     92        return (ResultCollection)globalScope.Variables["Results"].Value;
    9693      }
    9794    }
     
    114111      : base() {
    115112      globalScope = new Scope("Global Scope");
    116       globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
     113      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    117114      OperatorGraph = new OperatorGraph();
    118115      InitializeEngine();
     
    121118      : base(name) {
    122119      globalScope = new Scope("Global Scope");
    123       globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
     120      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    124121      OperatorGraph = new OperatorGraph();
    125122      InitializeEngine();
     
    128125      : base(name, parameters) {
    129126      globalScope = new Scope("Global Scope");
    130       globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
     127      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    131128      OperatorGraph = new OperatorGraph();
    132129      InitializeEngine();
     
    135132      : base(name, description) {
    136133      globalScope = new Scope("Global Scope");
    137       globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
     134      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    138135      OperatorGraph = new OperatorGraph();
    139136      InitializeEngine();
     
    142139      : base(name, description, parameters) {
    143140      globalScope = new Scope("Global Scope");
    144       globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
     141      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    145142      OperatorGraph = new OperatorGraph();
    146143      InitializeEngine();
     
    181178    protected override void OnPrepared() {
    182179      globalScope.Clear();
    183       globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    184       readOnlyResults = null;
     180      globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
    185181
    186182      if (engine != null) {
  • trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r3107 r3226  
    8686    <None Include="HeuristicLabOptimizationPlugin.cs.frame" />
    8787    <Compile Include="Algorithm.cs" />
     88    <Compile Include="BatchRun.cs" />
     89    <Compile Include="ResultCollectionList.cs" />
    8890    <Compile Include="Interfaces\IMultiObjectiveSolutionsVisualizer.cs" />
     91    <Compile Include="Interfaces\IResult.cs" />
    8992    <Compile Include="Interfaces\ISingleObjectiveSolutionsVisualizer.cs" />
    9093    <Compile Include="Interfaces\ISolutionsVisualizer.cs" />
     
    114117    <Compile Include="Interfaces\ITabuMoveEvaluator.cs" />
    115118    <Compile Include="Interfaces\ITabuMoveMaker.cs" />
     119    <Compile Include="Result.cs" />
    116120    <Compile Include="TabuMoveMaker.cs" />
    117121    <Compile Include="UserDefinedAlgorithm.cs" />
     
    119123    <Compile Include="HeuristicLabOptimizationPlugin.cs" />
    120124    <Compile Include="Properties\AssemblyInfo.cs" />
     125    <Compile Include="ResultCollection.cs" />
    121126  </ItemGroup>
    122127  <ItemGroup>
  • trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IAlgorithm.cs

    r2882 r3226  
    3232    Type ProblemType { get; }
    3333    IProblem Problem { get; set; }
    34     IObservableKeyedCollection<string, IVariable> Results { get; }
     34    ResultCollection Results { get; }
    3535    TimeSpan ExecutionTime { get; }
    3636    bool Running { get; }
     
    4343    event EventHandler ProblemChanged;
    4444    event EventHandler ExecutionTimeChanged;
     45    event EventHandler RunningChanged;
    4546    event EventHandler Prepared;
    4647    event EventHandler Started;
Note: See TracChangeset for help on using the changeset viewer.