Free cookie consent management tool by TermsFeed Policy Generator

Changeset 77


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
Files:
32 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;
  • 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;
  • trunk/sources/HeuristicLab.Logging/BestAverageWorstQualityCalculator.cs

    r2 r77  
    4646
    4747      for (int i = 0; i < scope.SubScopes.Count; i++)
    48         qualities[i] = scope.SubScopes[i].GetVariableValue<DoubleData>(GetVariableInfo("Quality").ActualName, false).Data;
     48        qualities[i] = scope.SubScopes[i].GetVariableValue<DoubleData>("Quality", false).Data;
    4949
    5050      double worst = qualities[0];
     
    7878          AddVariable(new Variable(info.ActualName, data));
    7979        else
    80           scope.AddVariable(new Variable(info.ActualName, data));
     80          scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), data));
    8181      }
    8282      data.Data = value;
  • trunk/sources/HeuristicLab.Logging/LinechartInjector.cs

    r2 r77  
    5252          AddVariable(new Variable(info.ActualName, linechart));
    5353        else
    54           scope.AddVariable(new Variable(info.ActualName, linechart));
     54          scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), linechart));
    5555      } else
    5656        linechart.Values = values;
  • trunk/sources/HeuristicLab.Logging/QualityLogger.cs

    r2 r77  
    4343
    4444      for (int i = 0; i < scope.SubScopes.Count; i++)
    45         qualities[i] = scope.SubScopes[i].GetVariableValue<DoubleData>(GetVariableInfo("Quality").ActualName, false).Data;
     45        qualities[i] = scope.SubScopes[i].GetVariableValue<DoubleData>("Quality", false).Data;
    4646
    4747      double min = qualities[0];
     
    6262          AddVariable(new Variable(info.ActualName, log));
    6363        else
    64           scope.AddVariable(new Variable(info.ActualName, log));
     64          scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), log));
    6565      }
    6666      log.Items.Add(new DoubleArrayData(new double[] { min, average, max } ));
  • trunk/sources/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs

    r2 r77  
    163163              AddVariable(new Variable(info.ActualName, value));
    164164            } else {
    165               scope.AddVariable(new Variable(info.ActualName, value));
     165              scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), value));
    166166            }
    167167            parameters[i] = value;
  • trunk/sources/HeuristicLab.Operators/ComparatorBase.cs

    r2 r77  
    4242          AddVariable(new Variable(info.ActualName, result));
    4343        else
    44           scope.AddVariable(new Variable(info.ActualName, result));
     44          scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), result));
    4545      }
    4646      IItem leftSide = GetVariableValue<IItem>("LeftSide", scope, true);
  • trunk/sources/HeuristicLab.Operators/DataCollector.cs

    r40 r77  
    5050          AddVariable(new Variable(info.ActualName, values));
    5151        else
    52           scope.AddVariable(new Variable(info.ActualName, values));
     52          scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), values));
    5353      }
    5454
  • trunk/sources/HeuristicLab.Operators/SingleObjectiveEvaluatorBase.cs

    r2 r77  
    4242          AddVariable(new Variable(qualityInfo.ActualName, quality));
    4343        else
    44           scope.AddVariable(new Variable(qualityInfo.ActualName, quality));
     44          scope.AddVariable(new Variable(scope.TranslateName(qualityInfo.FormalName), quality));
    4545      } else {
    4646        quality.Data = qualityValue;
  • trunk/sources/HeuristicLab.Operators/Sorter.cs

    r2 r77  
    4444
    4545      for (int i = 0; i < keys.Length; i++) {
    46         keys[i] = scope.SubScopes[i].GetVariableValue<DoubleData>(GetVariableInfo("Value").ActualName, false).Data;
     46        keys[i] = scope.SubScopes[i].GetVariableValue<DoubleData>("Value", false).Data;
    4747        sequence[i] = i;
    4848      }
  • 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;
  • trunk/sources/HeuristicLab.Random/RandomInjector.cs

    r2 r77  
    5656      }
    5757      MersenneTwister mersenneTwister = new MersenneTwister((uint)seed.Data);
    58       scope.AddVariable(new Variable(GetVariableInfo("Random").ActualName, mersenneTwister));
     58
     59      scope.AddVariable(new Variable(scope.TranslateName("Random"), mersenneTwister));
    5960      return null;
    6061    }
  • trunk/sources/HeuristicLab.RealVector/HeuristicCrossover.cs

    r73 r77  
    3535    protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) {
    3636      bool maximization = GetVariableValue<BoolData>("Maximization", scope, true).Data;
    37       IVariableInfo realVectorInfo = GetVariableInfo("RealVector");
    38       IVariableInfo qualityInfo = GetVariableInfo("Quality");
    39       DoubleArrayData vector1 = parent1.GetVariableValue<DoubleArrayData>(realVectorInfo.ActualName, false);
    40       DoubleData quality1 = parent1.GetVariableValue<DoubleData>(qualityInfo.ActualName, false);
    41       DoubleArrayData vector2 = parent2.GetVariableValue<DoubleArrayData>(realVectorInfo.ActualName, false);
    42       DoubleData quality2 = parent2.GetVariableValue<DoubleData>(qualityInfo.ActualName, false);
     37      DoubleArrayData vector1 = parent1.GetVariableValue<DoubleArrayData>("RealVector", false);
     38      DoubleData quality1 = parent1.GetVariableValue<DoubleData>("Quality", false);
     39      DoubleArrayData vector2 = parent2.GetVariableValue<DoubleArrayData>("RealVector", false);
     40      DoubleData quality2 = parent2.GetVariableValue<DoubleData>("Quality", false);
    4341
    4442      if (vector1.Data.Length != vector2.Data.Length) throw new InvalidOperationException("Cannot apply crossover to real vectors of different length.");
    4543
    4644      double[] result = Apply(random, maximization, vector1.Data, quality1.Data, vector2.Data, quality2.Data);
    47       child.AddVariable(new Variable(realVectorInfo.ActualName, new DoubleArrayData(result)));
     45      child.AddVariable(new Variable(child.TranslateName("RealVector"), new DoubleArrayData(result)));
    4846    }
    4947  }
  • trunk/sources/HeuristicLab.RealVector/RealVectorCrossoverBase.cs

    r2 r77  
    3535
    3636    protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) {
    37       IVariableInfo realVectorInfo = GetVariableInfo("RealVector");
    38       DoubleArrayData vector1 = parent1.GetVariableValue<DoubleArrayData>(realVectorInfo.ActualName, false);
    39       DoubleArrayData vector2 = parent2.GetVariableValue<DoubleArrayData>(realVectorInfo.ActualName, false);
     37      DoubleArrayData vector1 = parent1.GetVariableValue<DoubleArrayData>("RealVector", false);
     38      DoubleArrayData vector2 = parent2.GetVariableValue<DoubleArrayData>("RealVector", false);
    4039
    4140      if (vector1.Data.Length != vector2.Data.Length) throw new InvalidOperationException("Cannot apply crossover to real vectors of different length.");
    4241
    4342      double[] result = Cross(scope, random, vector1.Data, vector2.Data);
    44       child.AddVariable(new Variable(realVectorInfo.ActualName, new DoubleArrayData(result)));
     43      child.AddVariable(new Variable(child.TranslateName("RealVector"), new DoubleArrayData(result)));
    4544    }
    4645
  • trunk/sources/HeuristicLab.RealVector/UniformRandomRealVectorGenerator.cs

    r2 r77  
    5454
    5555      double[] vector = Apply(random, length, min, max);
    56       scope.AddVariable(new Variable(GetVariableInfo("RealVector").ActualName, new DoubleArrayData(vector)));
     56      scope.AddVariable(new Variable(scope.TranslateName("RealVector"), new DoubleArrayData(vector)));
    5757
    5858      return null;
  • trunk/sources/HeuristicLab.Routing.TSP/TSPDistanceMatrixInjectorBase.cs

    r2 r77  
    4949        }
    5050      }
    51       scope.AddVariable(new Variable(GetVariableInfo("DistanceMatrix").ActualName, new DoubleMatrixData(distanceMatrix)));
     51      scope.AddVariable(new Variable(scope.TranslateName("DistanceMatrix"), new DoubleMatrixData(distanceMatrix)));
    5252
    5353      return null;
  • trunk/sources/HeuristicLab.Routing.TSP/TSPInjector.cs

    r2 r77  
    5151
    5252    public override IOperation Apply(IScope scope) {
    53       scope.AddVariable(new Variable(GetVariableInfo("Maximization").ActualName, new BoolData(false)));
    54       scope.AddVariable(new Variable(GetVariableInfo("Cities").ActualName, (IItem)GetVariable("Cities").Value.Clone()));
    55       scope.AddVariable(new Variable(GetVariableInfo("Coordinates").ActualName, (IItem)GetVariable("Coordinates").Value.Clone()));
     53      scope.AddVariable(new Variable(scope.TranslateName("Maximization"), new BoolData(false)));
     54      scope.AddVariable(new Variable(scope.TranslateName("Cities"), (IItem)GetVariable("Cities").Value.Clone()));
     55      scope.AddVariable(new Variable(scope.TranslateName("Coordinates"), (IItem)GetVariable("Coordinates").Value.Clone()));
    5656      if (GetVariable("InjectBestKnownQuality").GetValue<BoolData>().Data)
    57         scope.AddVariable(new Variable(GetVariableInfo("BestKnownQuality").ActualName, (IItem)GetVariable("BestKnownQuality").Value.Clone()));
     57        scope.AddVariable(new Variable(scope.TranslateName("BestKnownQuality"), (IItem)GetVariable("BestKnownQuality").Value.Clone()));
    5858      return null;
    5959    }
  • trunk/sources/HeuristicLab.Routing.TSP/TSPTourInjector.cs

    r2 r77  
    5050          AddVariable(new Variable(info.ActualName, tour));
    5151        else
    52           scope.AddVariable(new Variable(info.ActualName, tour));
     52          scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), tour));
    5353      } else {
    5454        tour.Coordinates = coordinates;
  • trunk/sources/HeuristicLab.Scheduling.JSSP/CopyVariableFromSubScope.cs

    r2 r77  
    4646        IItem var = GetVariableValue<IItem>("Variable", s, false);
    4747        if(var != null) {
    48           if(scope.GetVariable(GetVariableInfo("Variable").ActualName) != null) {
    49             scope.RemoveVariable(GetVariableInfo("Variable").ActualName);
     48          if(scope.GetVariable(scope.TranslateName("Variable")) != null) {
     49            scope.RemoveVariable(scope.TranslateName("Variable"));
    5050          }
    51           scope.AddVariable(new Variable(GetVariableInfo("Variable").ActualName, var));
     51          scope.AddVariable(new Variable(scope.TranslateName("Variable"), var));
    5252          return null;
    5353        }
  • trunk/sources/HeuristicLab.Scheduling.JSSP/IsSchedulable.cs

    r2 r77  
    4040    public override IOperation Apply(IScope scope) {
    4141      Operation op = GetVariableValue<Operation>("Operation", scope, true);
    42       if(scope.GetVariable(GetVariableInfo("Schedulable").ActualName) != null) {
     42      if(scope.GetVariable(scope.TranslateName("Schedulable")) != null) {
    4343        BoolData isSchedulable = GetVariableValue<BoolData>("Schedulable", scope, false);
    4444        isSchedulable.Data = (op.Predecessors.Count == 0);
    4545      } else {
    46         scope.AddVariable(new Variable(GetVariableInfo("Schedulable").ActualName, new BoolData((op.Predecessors.Count == 0))));
     46        scope.AddVariable(new Variable(scope.TranslateName("Schedulable"), new BoolData((op.Predecessors.Count == 0))));
    4747      }
    4848      return null;
  • trunk/sources/HeuristicLab.Scheduling.JSSP/ItemListIndexer.cs

    r2 r77  
    4545      ItemList list = GetVariableValue<ItemList>("List", scope, true);
    4646      int index = GetVariableValue<IntData>("Index", scope, true).Data;
    47       if(scope.GetVariable(GetVariableInfo("Object").ActualName) != null) {
    48         scope.RemoveVariable(GetVariableInfo("Object").ActualName);
     47      if(scope.GetVariable(scope.TranslateName("Object")) != null) {
     48        scope.RemoveVariable(scope.TranslateName("Object"));
    4949      }
    5050      if((list != null) && (index < list.Count)) {
    51         scope.AddVariable(new Variable(GetVariableInfo("Object").ActualName, (IItem)list[index].Clone()));
     51        scope.AddVariable(new Variable(scope.TranslateName("Object"), (IItem)list[index].Clone()));
    5252      }
    5353      return null;
  • trunk/sources/HeuristicLab.Scheduling.JSSP/JSSPInjector.cs

    r2 r77  
    6666
    6767    public override IOperation Apply(IScope scope) {
    68       scope.AddVariable(new Variable(GetVariableInfo("Machines").ActualName, machines.Clone() as IntData));
    69       scope.AddVariable(new Variable(GetVariableInfo("Jobs").ActualName, jobs.Clone() as IntData));
    70       scope.AddVariable(new Variable(GetVariableInfo("Operations").ActualName, (ItemList)operations.Clone()));
     68      scope.AddVariable(new Variable(scope.TranslateName("Machines"), machines.Clone() as IntData));
     69      scope.AddVariable(new Variable(scope.TranslateName("Jobs"), jobs.Clone() as IntData));
     70      scope.AddVariable(new Variable(scope.TranslateName("Operations"), (ItemList)operations.Clone()));
    7171      return base.Apply(scope);
    7272    }
  • trunk/sources/HeuristicLab.Scheduling.JSSP/ScheduleInjector.cs

    r2 r77  
    5151      IntData timespan = GetVariableValue<IntData>("Timespan", scope, true);
    5252      schedule = new Schedule(machines.Data, timespan.Data);
    53       scope.AddVariable(new Variable(GetVariableInfo("Schedule").ActualName, schedule));
     53      scope.AddVariable(new Variable(scope.TranslateName("Schedule"), schedule));
    5454      return null;
    5555    }
  • trunk/sources/HeuristicLab.Selection.OffspringSelection/OffspringAnalyzer.cs

    r2 r77  
    6060        double[] qualitiesArray = new double[scope.SubScopes.Count];
    6161        for (int i = 0; i < qualitiesArray.Length; i++)
    62           qualitiesArray[i] = scope.SubScopes[i].GetVariableValue<DoubleData>(qualityInfo.ActualName, false).Data;
     62          qualitiesArray[i] = scope.SubScopes[i].GetVariableValue<DoubleData>(qualityInfo.FormalName, false).Data;
    6363        qualities = new DoubleArrayData(qualitiesArray);
    6464        IVariableInfo parentQualitiesInfo = GetVariableInfo("ParentQualities");
     
    6666          AddVariable(new Variable(parentQualitiesInfo.ActualName, qualities));
    6767        else
    68           scope.AddVariable(new Variable(parentQualitiesInfo.ActualName, qualities));
     68          scope.AddVariable(new Variable(scope.TranslateName(parentQualitiesInfo.FormalName), qualities));
    6969
    7070        CompositeOperation next = new CompositeOperation();
     
    8282          }
    8383          IVariableInfo qualityInfo = GetVariableInfo("Quality");
    84           double child = scope.SubScopes[i].GetVariableValue<DoubleData>(qualityInfo.ActualName, false).Data;
     84          double child = scope.SubScopes[i].GetVariableValue<DoubleData>(qualityInfo.FormalName, false).Data;
    8585          double threshold;
    8686
     
    9797          else
    9898            successful = new BoolData(false);
    99           scope.SubScopes[i].AddVariable(new Variable(successfulInfo.ActualName, successful));
     99          scope.SubScopes[i].AddVariable(new Variable(scope.TranslateName(successfulInfo.FormalName), successful));
    100100        }
    101101
     
    105105          RemoveVariable(parentQualitiesInfo.ActualName);
    106106        else
    107           scope.RemoveVariable(parentQualitiesInfo.ActualName);
     107          scope.RemoveVariable(scope.TranslateName(parentQualitiesInfo.FormalName));
    108108
    109109        return null;
  • trunk/sources/HeuristicLab.Selection.OffspringSelection/OffspringSelector.cs

    r40 r77  
    5757          AddVariable(new Variable(goodChildrenInfo.ActualName, goodChildren));
    5858        else
    59           scope.AddVariable(new Variable(goodChildrenInfo.ActualName, goodChildren));
     59          scope.AddVariable(new Variable(scope.TranslateName(goodChildrenInfo.FormalName), goodChildren));
    6060      }
    6161      ItemList<IScope> badChildren = GetVariableValue<ItemList<IScope>>("BadChildren", scope, false, false);
     
    6666          AddVariable(new Variable(badChildrenInfo.ActualName, badChildren));
    6767        else
    68           scope.AddVariable(new Variable(badChildrenInfo.ActualName, badChildren));
     68          scope.AddVariable(new Variable(scope.TranslateName(badChildrenInfo.FormalName), badChildren));
    6969      }
    7070
     
    7373      while (children.SubScopes.Count > 0) {
    7474        IScope child = children.SubScopes[0];
    75         bool successful = child.GetVariableValue<BoolData>(successfulInfo.ActualName, false).Data;
     75        bool successful = child.GetVariableValue<BoolData>(successfulInfo.FormalName, false).Data;
    7676        if (successful) goodChildren.Add(child);
    7777        else badChildren.Add(child);
     
    8787          AddVariable(new Variable(selectionPressureInfo.ActualName, selectionPressure));
    8888        else
    89           scope.AddVariable(new Variable(selectionPressureInfo.ActualName, selectionPressure));
     89          scope.AddVariable(new Variable(scope.TranslateName(selectionPressureInfo.FormalName), selectionPressure));
    9090      }
    9191      DoubleData successRatio = GetVariableValue<DoubleData>("SuccessRatio", scope, false, false);
     
    9696          AddVariable(new Variable(successRatioInfo.ActualName, successRatio));
    9797        else
    98           scope.AddVariable(new Variable(successRatioInfo.ActualName, successRatio));
     98          scope.AddVariable(new Variable(scope.TranslateName(successRatioInfo.FormalName), successRatio));
    9999      }
    100100      int goodCount = goodChildren.Count;
     
    130130          RemoveVariable(goodChildrenInfo.ActualName);
    131131        else
    132           scope.RemoveVariable(goodChildrenInfo.ActualName);
     132          scope.RemoveVariable(scope.TranslateName(goodChildrenInfo.FormalName));
    133133        IVariableInfo badChildrenInfo = GetVariableInfo("BadChildren");
    134134        if (badChildrenInfo.Local)
    135135          RemoveVariable(badChildrenInfo.ActualName);
    136136        else
    137           scope.RemoveVariable(badChildrenInfo.ActualName);
     137          scope.RemoveVariable(scope.TranslateName(badChildrenInfo.FormalName));
    138138
    139139        return null;
  • trunk/sources/HeuristicLab.Selection/ProportionalSelector.cs

    r2 r77  
    8181      if (subScopes < 1) throw new InvalidOperationException("No source scopes to select available.");
    8282
    83       double best = source.SubScopes[0].GetVariableValue<DoubleData>(qualityInfo.ActualName, false).Data;
    84       double worst = source.SubScopes[subScopes - 1].GetVariableValue<DoubleData>(qualityInfo.ActualName, false).Data;
     83      double best = source.SubScopes[0].GetVariableValue<DoubleData>(qualityInfo.FormalName, false).Data;
     84      double worst = source.SubScopes[subScopes - 1].GetVariableValue<DoubleData>(qualityInfo.FormalName, false).Data;
    8585      double limit = Math.Min(worst * 2, double.MaxValue);
    8686      double min = Math.Min(best, worst);
     
    9090      // preprocess fitness values, apply windowing if desired
    9191      for (int i = 0; i < qualities.Length; i++) {
    92         solutionQuality = source.SubScopes[i].GetVariableValue<DoubleData>(qualityInfo.ActualName, false).Data;
     92        solutionQuality = source.SubScopes[i].GetVariableValue<DoubleData>(qualityInfo.FormalName, false).Data;
    9393        if (solutionQuality < min || solutionQuality > max) {
    9494          // something has obviously gone wrong here
  • trunk/sources/HeuristicLab.Selection/TournamentSelector.cs

    r2 r77  
    5252        for (int j = 0; j < groupSize; j++) {
    5353          IScope scope = source.SubScopes[random.Next(source.SubScopes.Count)];
    54           double quality = scope.GetVariableValue<DoubleData>(qualityInfo.ActualName, false).Data;
     54          double quality = scope.GetVariableValue<DoubleData>(qualityInfo.FormalName, false).Data;
    5555          if (((maximization) && (quality > best)) ||
    5656              ((!maximization) && (quality < best))) {
  • trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjector.cs

    r2 r77  
    5757
    5858    public override IOperation Apply(IScope scope) {
    59       scope.AddVariable(new Variable(GetVariableInfo("Maximization").ActualName, new BoolData(false)));
    60       scope.AddVariable(new Variable(GetVariableInfo("Dataset").ActualName, (IItem)GetVariable("Dataset").Value.Clone()));
    61       scope.AddVariable(new Variable(GetVariableInfo("TargetVariable").ActualName, (IItem)GetVariable("TargetVariable").Value.Clone()));
    62       scope.AddVariable(new Variable(GetVariableInfo("MaxTreeHeight").ActualName, (IItem)GetVariable("MaxTreeHeight").Value.Clone()));
    63       scope.AddVariable(new Variable(GetVariableInfo("MaxTreeSize").ActualName, (IItem)GetVariable("MaxTreeSize").Value.Clone()));
    64       scope.AddVariable(new Variable(GetVariableInfo("TrainingSamplesStart").ActualName, (IItem)GetVariable("TrainingSamplesStart").Value.Clone()));
    65       scope.AddVariable(new Variable(GetVariableInfo("TrainingSamplesEnd").ActualName, (IItem)GetVariable("TrainingSamplesEnd").Value.Clone()));
     59      scope.AddVariable(new Variable(scope.TranslateName("Maximization"), new BoolData(false)));
     60      scope.AddVariable(new Variable(scope.TranslateName("Dataset"), (IItem)GetVariable("Dataset").Value.Clone()));
     61      scope.AddVariable(new Variable(scope.TranslateName("TargetVariable"), (IItem)GetVariable("TargetVariable").Value.Clone()));
     62      scope.AddVariable(new Variable(scope.TranslateName("MaxTreeHeight"), (IItem)GetVariable("MaxTreeHeight").Value.Clone()));
     63      scope.AddVariable(new Variable(scope.TranslateName("MaxTreeSize"), (IItem)GetVariable("MaxTreeSize").Value.Clone()));
     64      scope.AddVariable(new Variable(scope.TranslateName("TrainingSamplesStart"), (IItem)GetVariable("TrainingSamplesStart").Value.Clone()));
     65      scope.AddVariable(new Variable(scope.TranslateName("TrainingSamplesEnd"), (IItem)GetVariable("TrainingSamplesEnd").Value.Clone()));
    6666      return null;
    6767    }
Note: See TracChangeset for help on using the changeset viewer.