Changeset 1709


Ignore:
Timestamp:
04/29/09 23:08:05 (12 years ago)
Author:
abeham
Message:

Added operator for averaging numeric data

Location:
trunk/sources/HeuristicLab.SimOpt/3.2
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.SimOpt/3.2/HeuristicLab.SimOpt-3.2.csproj

    r1534 r1709  
    8989    </Compile>
    9090    <Compile Include="IntParameterBoundConstraint.cs" />
     91    <Compile Include="NumericDataAverageMultiCrossover.cs" />
    9192    <Compile Include="NumericDataRoundedAverageMultiCrossover.cs">
    9293      <SubType>Code</SubType>
  • trunk/sources/HeuristicLab.SimOpt/3.2/NumericDataRoundedAverageMultiCrossover.cs

    r1530 r1709  
    4545      double sum = 0.0;
    4646      IVariable var = null;
     47      string name = scope.TranslateName("VariableName");
    4748      for (int i = 0; i < parents.Length; i++) {
    48         var = parents[i].GetVariable(scope.TranslateName("VariableName"));
     49        var = parents[i].GetVariable(name);
    4950        if (var.Value is DoubleData) {
    5051          sum += ((DoubleData)var.Value).Data;
     
    6869        (varChild.Value as ConstrainedDoubleData).TrySetData(roundedAverage);
    6970      }
    70       scope.AddVariable(varChild);
     71      IVariable varScope = scope.GetVariable(name);
     72      if (varScope == null)
     73        scope.AddVariable(varChild);
     74      else varScope.Value = varChild.Value;
    7175    }
    7276  }
Note: See TracChangeset for help on using the changeset viewer.