Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/18/08 16:00:00 (17 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.Permutation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Permutation/PermutationCrossoverBase.cs

    r2 r77  
    3434
    3535    protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) {
    36       IVariableInfo permutationInfo = GetVariableInfo("Permutation");
    37       Permutation perm1 = parent1.GetVariableValue<Permutation>(permutationInfo.ActualName, false);
    38       Permutation perm2 = parent2.GetVariableValue<Permutation>(permutationInfo.ActualName, false);
     36      Permutation perm1 = parent1.GetVariableValue<Permutation>("Permutation", false);
     37      Permutation perm2 = parent2.GetVariableValue<Permutation>("Permutation", false);
    3938
    4039      if (perm1.Data.Length != perm2.Data.Length) throw new InvalidOperationException("Cannot apply crossover to permutations of different length.");
    4140
    4241      int[] result = Cross(scope, random, perm1.Data, perm2.Data);
    43       child.AddVariable(new Variable(permutationInfo.ActualName, new Permutation(result)));
     42      child.AddVariable(new Variable(scope.TranslateName("Permutation"), new Permutation(result)));
    4443    }
    4544
  • trunk/sources/HeuristicLab.Permutation/RandomPermutationGenerator.cs

    r2 r77  
    6161
    6262      int[] perm = Apply(random, length.Data);
    63       scope.AddVariable(new Variable(GetVariableInfo("Permutation").ActualName, new Permutation(perm)));
     63      scope.AddVariable(new Variable(scope.TranslateName("Permutation"), new Permutation(perm)));
    6464
    6565      return null;
Note: See TracChangeset for help on using the changeset viewer.