Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1851 for trunk/sources


Ignore:
Timestamp:
05/19/09 13:18:46 (15 years ago)
Author:
gkronber
Message:

Reverted r1847 after discussion with swagner. Instead each operator should decide independently what happens after abort and adapt the returned next operation accordingly. #633 (Engines do not handle abortion of operators correctly)

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.2/Interfaces/IOperator.cs

    r1847 r1851  
    6060    /// </summary>
    6161    ICollection<IVariable> Variables { get; }
    62     /// <summary>
    63     /// Gets information whether abortion of the operator is supported.
    64     /// </summary>
    65     bool SupportsAbort { get; }
     62
    6663    /// <summary>
    6764    /// Adds the given sub operator to the current instance.
  • trunk/sources/HeuristicLab.Core/3.2/OperatorBase.cs

    r1847 r1851  
    8989    public virtual ICollection<IVariable> Variables {
    9090      get { return myVariables.Values; }
    91     }
    92     /// <inheritdoc/>
    93     /// The default is false.
    94     public virtual bool SupportsAbort {
    95       get { return false; }
    9691    }
    9792
  • trunk/sources/HeuristicLab.SequentialEngine/3.2/SequentialEngine.cs

    r1847 r1851  
    3333  public class SequentialEngine : EngineBase, IEditable {
    3434    private IOperator currentOperator;
    35     private IOperation currentOperation;
    3635
    3736    /// <summary>
     
    5857    public override void Abort() {
    5958      base.Abort();
    60       if (currentOperator != null && currentOperator.SupportsAbort) {
     59      if (currentOperator != null)
    6160        currentOperator.Abort();
    62         myExecutionStack.Push(currentOperation);
    63       }
    6461    }
    6562
     
    7269    /// If the execution was successful <see cref="EngineBase.OnOperationExecuted"/> is called.</remarks>
    7370    protected override void ProcessNextOperation() {
    74       currentOperation = myExecutionStack.Pop();
    75       if (currentOperation is AtomicOperation) {
    76         AtomicOperation atomicOperation = (AtomicOperation)currentOperation;
     71      IOperation operation = myExecutionStack.Pop();
     72      if (operation is AtomicOperation) {
     73        AtomicOperation atomicOperation = (AtomicOperation)operation;
    7774        IOperation next = null;
    7875        try {
     
    9087        OnOperationExecuted(atomicOperation);
    9188        if (atomicOperation.Operator.Breakpoint) Abort();
    92       } else if (currentOperation is CompositeOperation) {
    93         CompositeOperation compositeOperation = (CompositeOperation)currentOperation;
     89      } else if (operation is CompositeOperation) {
     90        CompositeOperation compositeOperation = (CompositeOperation)operation;
    9491        for (int i = compositeOperation.Operations.Count - 1; i >= 0; i--)
    9592          myExecutionStack.Push(compositeOperation.Operations[i]);
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorCreator.cs

    r1848 r1851  
    3434    private object locker = new object();
    3535    private bool abortRequested = false;
    36 
    37     public override bool SupportsAbort {
    38       get {
    39         return true;
    40       }
    41     }
    4236
    4337    public SupportVectorCreator()
     
    10397        rangeTransformData.Data = rangeTransform;
    10498        scope.AddVariable(new Variable(scope.TranslateName("SVMRangeTransform"), rangeTransformData));
     99        return null;
     100      } else {
     101        return new AtomicOperation(this, scope);
    105102      }
    106       return null;
    107103    }
    108104
Note: See TracChangeset for help on using the changeset viewer.