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.Evolutionary
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Evolutionary/CrossoverBase.cs

    r72 r77  
    4242      for (int i = 0; i < children; i++) {
    4343        IScope parent1 = scope.SubScopes[0];
     44        IScope parent2 = scope.SubScopes[1];
     45        IScope child = new Scope(i.ToString());
     46        scope.AddSubScope(child);
     47        Cross(scope, random, parent1, parent2, child);
    4448        scope.RemoveSubScope(parent1);
    45         IScope parent2 = scope.SubScopes[0];
    4649        scope.RemoveSubScope(parent2);
    47         IScope child = new Scope(i.ToString());
    48         Cross(scope, random, parent1, parent2, child);
    49         scope.AddSubScope(child);
    5050      }
    5151
  • trunk/sources/HeuristicLab.Evolutionary/SubScopesStorer.cs

    r40 r77  
    4949          AddVariable(new Variable(info.ActualName, subScopesStore));
    5050        else
    51           scope.AddVariable(new Variable(info.ActualName, subScopesStore));
     51          scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), subScopesStore));
    5252      }
    5353
     
    6464            RemoveVariable(info.ActualName);
    6565          else
    66             scope.RemoveVariable(info.ActualName);
     66            scope.RemoveVariable(scope.TranslateName(info.FormalName));
    6767        }
    6868        return null;
  • trunk/sources/HeuristicLab.Evolutionary/SuccessRuleMutationStrengthAdjuster.cs

    r2 r77  
    4747      if (successProb == null) {
    4848        IVariableInfo successProbInfo = GetVariableInfo("SuccessProbability");
    49         Variable successProbVar = new Variable(successProbInfo.ActualName, new DoubleData(targetSuccessProb.Data));
    50         if (successProbInfo.Local)
     49        IVariable successProbVar;
     50        if (successProbInfo.Local) {
     51          successProbVar = new Variable(successProbInfo.ActualName, new DoubleData(targetSuccessProb.Data));
    5152          AddVariable(successProbVar);
    52         else
     53        } else {
     54          successProbVar = new Variable(scope.TranslateName(successProbInfo.FormalName), new DoubleData(targetSuccessProb.Data));
    5355          scope.AddVariable(successProbVar);
     56        }
    5457        successProb = (DoubleData)successProbVar.Value;
    5558      }
     
    5962      double success = 0.0;
    6063      for (int i = 0 ; i < scope.SubScopes.Count ; i++) {
    61         if (scope.SubScopes[i].GetVariableValue<BoolData>(GetVariableInfo("SuccessfulChild").ActualName, false).Data) {
     64        if (scope.SubScopes[i].GetVariableValue<BoolData>("SuccessfulChild", false).Data) {
    6265          success++;
    6366        }
    64         scope.SubScopes[i].RemoveVariable(GetVariableInfo("SuccessfulChild").ActualName);
     67        scope.SubScopes[i].RemoveVariable(scope.SubScopes[i].TranslateName("SuccessfulChild"));
    6568      }
    6669      if (scope.SubScopes.Count > 0) success /= scope.SubScopes.Count;
Note: See TracChangeset for help on using the changeset viewer.