Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/21/15 17:42:18 (9 years ago)
Author:
pfleck
Message:

#2269

  • Changed the age type from int to double.
  • Changed EldersSelector to make use of a ScopeTreeLookupParameter.
  • Removed unused operators in LayerUpdator.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/WeightingReducer.cs

    r12997 r13046  
    3434  public sealed class WeightingReducer : SingleSuccessorOperator {
    3535
    36     public ScopeTreeLookupParameter<IntValue> ParameterToReduce {
    37       get { return (ScopeTreeLookupParameter<IntValue>)Parameters["ParameterToReduce"]; }
     36    public IScopeTreeLookupParameter<DoubleValue> ParameterToReduce {
     37      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["ParameterToReduce"]; }
    3838    }
    39     public LookupParameter<IntValue> TargetParameter {
    40       get { return (LookupParameter<IntValue>)Parameters["TargetParameter"]; }
     39    public ILookupParameter<DoubleValue> TargetParameter {
     40      get { return (ILookupParameter<DoubleValue>)Parameters["TargetParameter"]; }
    4141    }
    4242    public IValueLookupParameter<DoubleValue> WeightParameter {
     
    5454    public WeightingReducer()
    5555      : base() {
    56       Parameters.Add(new ScopeTreeLookupParameter<IntValue>("ParameterToReduce", "The parameter on which the weighting should be applied."));
    57       Parameters.Add(new LookupParameter<IntValue>("TargetParameter", "The target variable in which the weighted value should be stored."));
     56      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("ParameterToReduce", "The parameter on which the weighting should be applied."));
     57      Parameters.Add(new LookupParameter<DoubleValue>("TargetParameter", "The target variable in which the weighted value should be stored."));
    5858      Parameters.Add(new ValueLookupParameter<DoubleValue>("Weight", "Weight of the two values (0.0 for the smaller, 1.0 for the larger)."));
    5959    }
     
    6464        throw new InvalidOperationException("Weighting between values can only done for two values.");
    6565
    66       var weight = WeightParameter.ActualValue.Value;
     66      double weight = WeightParameter.ActualValue.Value;
    6767
    68       var max = values.Max(v => v.Value);
    69       var min = values.Min(v => v.Value);
     68      double max = values.Max(v => v.Value);
     69      double min = values.Min(v => v.Value);
    7070
    71       int result = (int)(max * weight + min * (1 - weight));
     71      double result = max * weight + min * (1 - weight);
    7272
    7373      if (TargetParameter.ActualValue == null)
    74         TargetParameter.ActualValue = new IntValue(result);
     74        TargetParameter.ActualValue = new DoubleValue(result);
    7575      else TargetParameter.ActualValue.Value = result;
    7676
Note: See TracChangeset for help on using the changeset viewer.