Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12364


Ignore:
Timestamp:
04/29/15 16:34:33 (10 years ago)
Author:
pfleck
Message:

#2027 Changed a few things to better show single value criteria.

Location:
branches/TerminationCriteria
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r12356 r12364  
    351351      UpdateAnalyzers();
    352352
    353       maximumGenerationsTerminationCriterion = new ComparisonTerminationCriterion<IntValue>("Generations", "MaximumGenerations", ComparisonType.GreaterOrEqual) { Name = "Maximum Generations" };
     353      maximumGenerationsTerminationCriterion = new ComparisonTerminationCriterion<IntValue>("Generations", new IntValue(50), ComparisonType.GreaterOrEqual) { Name = "Maximum Generations" };
    354354      maximumEvaluatedSolutionsTerminationCriterion = new ComparisonTerminationCriterion<IntValue>("EvaluatedSolutions", "MaximumEvaluatedSolutions", ComparisonType.GreaterOrEqual) { Name = "Maximum Evaluations" };
    355355      maximumSelectionPressureTerminationCriterion = new ComparisonTerminationCriterion<DoubleValue>("SelectionPressure", "MaximumSelectionPressure", ComparisonType.GreaterOrEqual) { Name = "Maximum Selection Pressure" };
  • branches/TerminationCriteria/HeuristicLab.Termination/3.3/ComparisonTerminationCriterion.cs

    r12328 r12364  
    4848    [StorableConstructor]
    4949    protected ComparisonTerminationCriterion(bool deserializing) : base(deserializing) { }
     50    [StorableHook(HookType.AfterDeserialization)]
     51    private void AfterDeserialization() {
     52      Initialize();
     53    }
    5054    protected ComparisonTerminationCriterion(ComparisonTerminationCriterion<T> original, Cloner cloner)
    5155      : base(original, cloner) {
     56      Initialize();
    5257    }
    5358    public override IDeepCloneable Clone(Cloner cloner) {
     
    5964      Parameters.Add(new ValueLookupParameter<T>("RightSide", "The right side of the comparison."));
    6065      Parameters.Add(new ValueParameter<Comparison>("Comparison", "The type of comparison.", new Comparison(ComparisonType.GreaterOrEqual)) { Hidden = true });
     66
     67      Initialize();
    6168    }
    6269    public ComparisonTerminationCriterion(string leftSideActualName, string rightSideActualName, ComparisonType comparison = ComparisonType.GreaterOrEqual)
     
    7178      RightSideParameter.Value = rightSideValue;
    7279      Comparison.Value = comparison;
     80    }
     81
     82    private void Initialize() {
     83      RightSideParameter.ToStringChanged += (s, a) => OnToStringChanged();
    7384    }
    7485
     
    95106      }
    96107    }
     108
     109    public override string ToString() {
     110      if (RightSideParameter.Value == null) return Name;
     111      else return Name + ": " + RightSideParameter.Value;
     112    }
    97113  }
    98114}
  • branches/TerminationCriteria/HeuristicLab.Termination/3.3/Views/ComparisonTerminationCriterionView.cs

    r12362 r12364  
    4444      viewHost.Content = null;
    4545      if (Content != null) {
    46         viewHost.Content = Content.RightSideParameter;
     46        if (Content.RightSideParameter.Value != null)
     47          viewHost.Content = Content.RightSideParameter.Value;
     48        else
     49          viewHost.Content = Content.RightSideParameter;
    4750      }
    4851    }
Note: See TracChangeset for help on using the changeset viewer.