Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/18/08 16:00:00 (16 years ago)
Author:
swagner
Message:

Fixed ticket #67

  • adapted accessing of variables in operators due to changes of variable lookup and the new name aliasing mechanism (actual/formal name translations should not be done directly anymore; instead the new method Scope.TranslateName should be used)
Location:
trunk/sources/HeuristicLab.BitVector
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.BitVector/BitVectorCrossoverBase.cs

    r2 r77  
    3636    protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) {
    3737      IVariableInfo bitVectorInfo = GetVariableInfo("BitVector");
    38       BoolArrayData vector1 = parent1.GetVariableValue<BoolArrayData>(bitVectorInfo.ActualName, false);
    39       BoolArrayData vector2 = parent2.GetVariableValue<BoolArrayData>(bitVectorInfo.ActualName, false);
     38      BoolArrayData vector1 = parent1.GetVariableValue<BoolArrayData>(bitVectorInfo.FormalName, false);
     39      BoolArrayData vector2 = parent2.GetVariableValue<BoolArrayData>(bitVectorInfo.FormalName, false);
    4040
    4141      if (vector1.Data.Length != vector2.Data.Length) throw new InvalidOperationException("Cannot apply crossover to bit vectors of different length.");
    4242
    4343      bool[] result = Cross(scope, random, vector1.Data, vector2.Data);
    44       child.AddVariable(new Variable(bitVectorInfo.ActualName, new BoolArrayData(result)));
     44      child.AddVariable(new Variable(child.TranslateName(bitVectorInfo.FormalName), new BoolArrayData(result)));
    4545    }
    4646
  • trunk/sources/HeuristicLab.BitVector/RandomBitVectorGenerator.cs

    r2 r77  
    5656
    5757            bool[] vector = Apply(random, length);
    58             scope.AddVariable(new Variable(GetVariableInfo("BitVector").ActualName, new BoolArrayData(vector)));
     58            scope.AddVariable(new Variable(scope.TranslateName("BitVector"), new BoolArrayData(vector)));
    5959
    6060            return null;
Note: See TracChangeset for help on using the changeset viewer.