Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12414


Ignore:
Timestamp:
06/02/15 16:21:17 (9 years ago)
Author:
pfleck
Message:

#2027 Changed Terminator base class to SingleSuccessorOperator and omit some values while collecting parameter values to reduce the amount of collected values for all terminators.

Location:
branches/TerminationCriteria/HeuristicLab.Termination/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/TerminationCriteria/HeuristicLab.Termination/3.3/MultiTerminator.cs

    r12405 r12414  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Drawing;
    2425using System.Linq;
     
    6667      return next;
    6768    }
     69
     70    public override void CollectParameterValues(IDictionary<string, IItem> values) {
     71      foreach (var opParam in OperatorParameters) {
     72        var op = opParam.Value;
     73        var @checked = Operators.ItemChecked(op);
     74        if (!@checked) continue;
     75        var children = GetCollectedValues(opParam);
     76        foreach (var c in children) {
     77          if (String.IsNullOrEmpty(c.Key))
     78            values.Add(opParam.Name, new StringValue(opParam.Value.ToString()));
     79          else values.Add(opParam.Name + "." + c.Key, c.Value);
     80        }
     81      }
     82    }
    6883  }
    6984}
  • branches/TerminationCriteria/HeuristicLab.Termination/3.3/Terminator.cs

    r12413 r12414  
    3232  [Item("Terminator", "A base class for all termination criteria.")]
    3333  [StorableClass]
    34   public abstract class Terminator : InstrumentedOperator, ITerminator {
     34  public abstract class Terminator : SingleSuccessorOperator, ITerminator {
    3535    public static new Image StaticItemImage {
    3636      get { return HeuristicLab.Common.Resources.VSImageLibrary.FlagRed; }
     
    5050    }
    5151
    52     public sealed override IOperation InstrumentedApply() {
     52    public sealed override IOperation Apply() {
    5353      if (!TerminateParameter.ActualValue.Value) { // If terminate flag is already set, no need to check further termination criteria.
    5454        bool terminate = !CheckContinueCriterion();
    5555        TerminateParameter.ActualValue = new BoolValue(terminate);
    5656      }
    57       return base.InstrumentedApply();
     57      return base.Apply();
    5858    }
    5959
     
    6262    public override void CollectParameterValues(IDictionary<string, IItem> values) {
    6363      base.CollectParameterValues(values);
    64       values["Description"] = new StringValue(ToString());
    6564      values["Type"] = new StringValue(GetType().GetPrettyName(false));
    6665    }
Note: See TracChangeset for help on using the changeset viewer.