- Timestamp:
- 05/28/15 09:47:23 (9 years ago)
- Location:
- branches/TerminationCriteria/HeuristicLab.Termination/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/TerminationCriteria/HeuristicLab.Termination/3.3/ComparisonTerminator.cs
r12405 r12407 57 57 return new ComparisonTerminator<T>(this, cloner); 58 58 } 59 public ComparisonTerminator(T threshold = default(T))59 public ComparisonTerminator(T threshold) 60 60 : base(threshold) { 61 61 Parameters.Add(new LookupParameter<T>("ComparisonValue", "The left side value of the comparison.") { Hidden = false }); … … 63 63 Initialize(); 64 64 } 65 public ComparisonTerminator(string comparisonValueActualName, ComparisonType comparison = default(ComparisonType), T threshold = default(T))65 public ComparisonTerminator(string comparisonValueActualName, ComparisonType comparison, T threshold) 66 66 : this(threshold) { 67 67 ComparisonValueParameter.ActualName = comparisonValueActualName; … … 73 73 } 74 74 75 protected override bool Check Termination() {75 protected override bool CheckContinueCriterion() { 76 76 IComparable lhs = ComparisonValueParameter.ActualValue; 77 77 IComparable rhs = ThresholdParameter.Value; -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/ExecutionTimeTerminator.cs
r12405 r12407 51 51 } 52 52 53 protected override bool Check Termination() {53 protected override bool CheckContinueCriterion() { 54 54 var max = ThresholdParameter.Value.Value; 55 55 56 return executable.ExecutionTime >max;56 return executable.ExecutionTime < max; 57 57 } 58 58 59 59 public override string ToString() { 60 60 if (Threshold == null) return Name; 61 else return string.Format("{0} {1} {2}", Name, " >", ThresholdParameter.Value);61 else return string.Format("{0} {1} {2}", Name, "<", ThresholdParameter.Value); 62 62 } 63 63 } -
branches/TerminationCriteria/HeuristicLab.Termination/3.3/Terminator.cs
r12405 r12407 51 51 public sealed override IOperation InstrumentedApply() { 52 52 if (!TerminateParameter.ActualValue.Value) { // If terminate flag is already set, no need to check further termination criteria. 53 bool terminate = CheckTermination();53 bool terminate = !CheckContinueCriterion(); 54 54 TerminateParameter.ActualValue = new BoolValue(terminate); 55 55 } … … 57 57 } 58 58 59 protected abstract bool Check Termination();59 protected abstract bool CheckContinueCriterion(); 60 60 } 61 61 }
Note: See TracChangeset
for help on using the changeset viewer.