[2] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Text;
|
---|
[1815] | 25 | using System.Threading;
|
---|
[2474] | 26 | using HeuristicLab.Common;
|
---|
[2] | 27 |
|
---|
| 28 | namespace HeuristicLab.Core {
|
---|
[776] | 29 | /// <summary>
|
---|
| 30 | /// Interface to represent one run. (An engine is an interpreter, holding the code,
|
---|
| 31 | /// the data and the actual state, which is the runtime stack and a pointer onto the next operation.).
|
---|
| 32 | /// It is responsible for operator execution and able to deal with parallelism.
|
---|
| 33 | /// </summary>
|
---|
[2] | 34 | public interface IEngine : IItem {
|
---|
[776] | 35 | /// <summary>
|
---|
| 36 | /// Gets the operator graph of the current instance.
|
---|
| 37 | /// </summary>
|
---|
[2] | 38 | IOperatorGraph OperatorGraph { get; }
|
---|
[776] | 39 | /// <summary>
|
---|
| 40 | /// Gets the global scope of the current instance.
|
---|
| 41 | /// </summary>
|
---|
[2] | 42 | IScope GlobalScope { get; }
|
---|
| 43 |
|
---|
[776] | 44 | /// <summary>
|
---|
| 45 | /// Gets the execution time of the current instance.
|
---|
| 46 | /// </summary>
|
---|
[2] | 47 | TimeSpan ExecutionTime { get; }
|
---|
[1815] | 48 | /// <summary>
|
---|
| 49 | /// Gets or sets the thread priority of the worker thread.
|
---|
| 50 | /// </summary>
|
---|
| 51 | ThreadPriority Priority { get; set; }
|
---|
[2] | 52 |
|
---|
[776] | 53 | /// <summary>
|
---|
| 54 | /// Gets information whether the engine is currently running.
|
---|
| 55 | /// </summary>
|
---|
[2] | 56 | bool Running { get; }
|
---|
[776] | 57 | /// <summary>
|
---|
| 58 | /// Gets information whether the engine is canceled.
|
---|
| 59 | /// </summary>
|
---|
[2] | 60 | bool Canceled { get; }
|
---|
[776] | 61 | /// <summary>
|
---|
| 62 | /// Gets information whether the engine has already terminated.
|
---|
| 63 | /// </summary>
|
---|
[2] | 64 | bool Terminated { get; }
|
---|
| 65 |
|
---|
[776] | 66 | /// <summary>
|
---|
| 67 | /// Executes the whole run.
|
---|
| 68 | /// </summary>
|
---|
[2] | 69 | void Execute();
|
---|
[776] | 70 | /// <summary>
|
---|
| 71 | /// Executes one step (one operation).
|
---|
| 72 | /// </summary>
|
---|
[2] | 73 | void ExecuteStep();
|
---|
[776] | 74 | /// <summary>
|
---|
| 75 | /// Executes the given number of steps.
|
---|
| 76 | /// </summary>
|
---|
| 77 | /// <param name="steps">The number of steps to execute.</param>
|
---|
[2] | 78 | void ExecuteSteps(int steps);
|
---|
[776] | 79 | /// <summary>
|
---|
| 80 | /// Aborts the engine run.
|
---|
| 81 | /// </summary>
|
---|
[2] | 82 | void Abort();
|
---|
[776] | 83 | /// <summary>
|
---|
| 84 | /// Resets the current instance.
|
---|
| 85 | /// </summary>
|
---|
[2] | 86 | void Reset();
|
---|
| 87 |
|
---|
[776] | 88 | /// <summary>
|
---|
| 89 | /// Occurs when the current instance is initialized.
|
---|
| 90 | /// </summary>
|
---|
[2] | 91 | event EventHandler Initialized;
|
---|
[776] | 92 | /// <summary>
|
---|
| 93 | /// Occurs when an operation is executed.
|
---|
| 94 | /// </summary>
|
---|
[2474] | 95 | event EventHandler<EventArgs<IOperation>> OperationExecuted;
|
---|
[776] | 96 | /// <summary>
|
---|
| 97 | /// Occurs when an exception was thrown.
|
---|
| 98 | /// </summary>
|
---|
[2474] | 99 | event EventHandler<EventArgs<Exception>> ExceptionOccurred;
|
---|
[776] | 100 | /// <summary>
|
---|
| 101 | /// Occurs when the execution time was changed.
|
---|
| 102 | /// </summary>
|
---|
[2] | 103 | event EventHandler ExecutionTimeChanged;
|
---|
[776] | 104 | /// <summary>
|
---|
| 105 | /// Occurs when the engine is finished.
|
---|
| 106 | /// </summary>
|
---|
[2] | 107 | event EventHandler Finished;
|
---|
| 108 | }
|
---|
| 109 | }
|
---|