Changeset 77 for trunk/sources/HeuristicLab.BitVector
- Timestamp:
- 03/18/08 16:00:00 (17 years ago)
- Location:
- trunk/sources/HeuristicLab.BitVector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.BitVector/BitVectorCrossoverBase.cs
r2 r77 36 36 protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) { 37 37 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); 40 40 41 41 if (vector1.Data.Length != vector2.Data.Length) throw new InvalidOperationException("Cannot apply crossover to bit vectors of different length."); 42 42 43 43 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))); 45 45 } 46 46 -
trunk/sources/HeuristicLab.BitVector/RandomBitVectorGenerator.cs
r2 r77 56 56 57 57 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))); 59 59 60 60 return null;
Note: See TracChangeset
for help on using the changeset viewer.