Changeset 77
- Timestamp:
- 03/18/08 16:00:00 (17 years ago)
- Location:
- trunk/sources
- Files:
-
- 32 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; -
trunk/sources/HeuristicLab.Evolutionary/CrossoverBase.cs
r72 r77 42 42 for (int i = 0; i < children; i++) { 43 43 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); 44 48 scope.RemoveSubScope(parent1); 45 IScope parent2 = scope.SubScopes[0];46 49 scope.RemoveSubScope(parent2); 47 IScope child = new Scope(i.ToString());48 Cross(scope, random, parent1, parent2, child);49 scope.AddSubScope(child);50 50 } 51 51 -
trunk/sources/HeuristicLab.Evolutionary/SubScopesStorer.cs
r40 r77 49 49 AddVariable(new Variable(info.ActualName, subScopesStore)); 50 50 else 51 scope.AddVariable(new Variable( info.ActualName, subScopesStore));51 scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), subScopesStore)); 52 52 } 53 53 … … 64 64 RemoveVariable(info.ActualName); 65 65 else 66 scope.RemoveVariable( info.ActualName);66 scope.RemoveVariable(scope.TranslateName(info.FormalName)); 67 67 } 68 68 return null; -
trunk/sources/HeuristicLab.Evolutionary/SuccessRuleMutationStrengthAdjuster.cs
r2 r77 47 47 if (successProb == null) { 48 48 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)); 51 52 AddVariable(successProbVar); 52 else 53 } else { 54 successProbVar = new Variable(scope.TranslateName(successProbInfo.FormalName), new DoubleData(targetSuccessProb.Data)); 53 55 scope.AddVariable(successProbVar); 56 } 54 57 successProb = (DoubleData)successProbVar.Value; 55 58 } … … 59 62 double success = 0.0; 60 63 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) { 62 65 success++; 63 66 } 64 scope.SubScopes[i].RemoveVariable( GetVariableInfo("SuccessfulChild").ActualName);67 scope.SubScopes[i].RemoveVariable(scope.SubScopes[i].TranslateName("SuccessfulChild")); 65 68 } 66 69 if (scope.SubScopes.Count > 0) success /= scope.SubScopes.Count; -
trunk/sources/HeuristicLab.Logging/BestAverageWorstQualityCalculator.cs
r2 r77 46 46 47 47 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; 49 49 50 50 double worst = qualities[0]; … … 78 78 AddVariable(new Variable(info.ActualName, data)); 79 79 else 80 scope.AddVariable(new Variable( info.ActualName, data));80 scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), data)); 81 81 } 82 82 data.Data = value; -
trunk/sources/HeuristicLab.Logging/LinechartInjector.cs
r2 r77 52 52 AddVariable(new Variable(info.ActualName, linechart)); 53 53 else 54 scope.AddVariable(new Variable( info.ActualName, linechart));54 scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), linechart)); 55 55 } else 56 56 linechart.Values = values; -
trunk/sources/HeuristicLab.Logging/QualityLogger.cs
r2 r77 43 43 44 44 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; 46 46 47 47 double min = qualities[0]; … … 62 62 AddVariable(new Variable(info.ActualName, log)); 63 63 else 64 scope.AddVariable(new Variable( info.ActualName, log));64 scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), log)); 65 65 } 66 66 log.Items.Add(new DoubleArrayData(new double[] { min, average, max } )); -
trunk/sources/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs
r2 r77 163 163 AddVariable(new Variable(info.ActualName, value)); 164 164 } else { 165 scope.AddVariable(new Variable( info.ActualName, value));165 scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), value)); 166 166 } 167 167 parameters[i] = value; -
trunk/sources/HeuristicLab.Operators/ComparatorBase.cs
r2 r77 42 42 AddVariable(new Variable(info.ActualName, result)); 43 43 else 44 scope.AddVariable(new Variable( info.ActualName, result));44 scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), result)); 45 45 } 46 46 IItem leftSide = GetVariableValue<IItem>("LeftSide", scope, true); -
trunk/sources/HeuristicLab.Operators/DataCollector.cs
r40 r77 50 50 AddVariable(new Variable(info.ActualName, values)); 51 51 else 52 scope.AddVariable(new Variable( info.ActualName, values));52 scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), values)); 53 53 } 54 54 -
trunk/sources/HeuristicLab.Operators/SingleObjectiveEvaluatorBase.cs
r2 r77 42 42 AddVariable(new Variable(qualityInfo.ActualName, quality)); 43 43 else 44 scope.AddVariable(new Variable( qualityInfo.ActualName, quality));44 scope.AddVariable(new Variable(scope.TranslateName(qualityInfo.FormalName), quality)); 45 45 } else { 46 46 quality.Data = qualityValue; -
trunk/sources/HeuristicLab.Operators/Sorter.cs
r2 r77 44 44 45 45 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; 47 47 sequence[i] = i; 48 48 } -
trunk/sources/HeuristicLab.Permutation/PermutationCrossoverBase.cs
r2 r77 34 34 35 35 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); 39 38 40 39 if (perm1.Data.Length != perm2.Data.Length) throw new InvalidOperationException("Cannot apply crossover to permutations of different length."); 41 40 42 41 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))); 44 43 } 45 44 -
trunk/sources/HeuristicLab.Permutation/RandomPermutationGenerator.cs
r2 r77 61 61 62 62 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))); 64 64 65 65 return null; -
trunk/sources/HeuristicLab.Random/RandomInjector.cs
r2 r77 56 56 } 57 57 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)); 59 60 return null; 60 61 } -
trunk/sources/HeuristicLab.RealVector/HeuristicCrossover.cs
r73 r77 35 35 protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) { 36 36 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); 43 41 44 42 if (vector1.Data.Length != vector2.Data.Length) throw new InvalidOperationException("Cannot apply crossover to real vectors of different length."); 45 43 46 44 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))); 48 46 } 49 47 } -
trunk/sources/HeuristicLab.RealVector/RealVectorCrossoverBase.cs
r2 r77 35 35 36 36 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); 40 39 41 40 if (vector1.Data.Length != vector2.Data.Length) throw new InvalidOperationException("Cannot apply crossover to real vectors of different length."); 42 41 43 42 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))); 45 44 } 46 45 -
trunk/sources/HeuristicLab.RealVector/UniformRandomRealVectorGenerator.cs
r2 r77 54 54 55 55 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))); 57 57 58 58 return null; -
trunk/sources/HeuristicLab.Routing.TSP/TSPDistanceMatrixInjectorBase.cs
r2 r77 49 49 } 50 50 } 51 scope.AddVariable(new Variable( GetVariableInfo("DistanceMatrix").ActualName, new DoubleMatrixData(distanceMatrix)));51 scope.AddVariable(new Variable(scope.TranslateName("DistanceMatrix"), new DoubleMatrixData(distanceMatrix))); 52 52 53 53 return null; -
trunk/sources/HeuristicLab.Routing.TSP/TSPInjector.cs
r2 r77 51 51 52 52 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())); 56 56 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())); 58 58 return null; 59 59 } -
trunk/sources/HeuristicLab.Routing.TSP/TSPTourInjector.cs
r2 r77 50 50 AddVariable(new Variable(info.ActualName, tour)); 51 51 else 52 scope.AddVariable(new Variable( info.ActualName, tour));52 scope.AddVariable(new Variable(scope.TranslateName(info.FormalName), tour)); 53 53 } else { 54 54 tour.Coordinates = coordinates; -
trunk/sources/HeuristicLab.Scheduling.JSSP/CopyVariableFromSubScope.cs
r2 r77 46 46 IItem var = GetVariableValue<IItem>("Variable", s, false); 47 47 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")); 50 50 } 51 scope.AddVariable(new Variable( GetVariableInfo("Variable").ActualName, var));51 scope.AddVariable(new Variable(scope.TranslateName("Variable"), var)); 52 52 return null; 53 53 } -
trunk/sources/HeuristicLab.Scheduling.JSSP/IsSchedulable.cs
r2 r77 40 40 public override IOperation Apply(IScope scope) { 41 41 Operation op = GetVariableValue<Operation>("Operation", scope, true); 42 if(scope.GetVariable( GetVariableInfo("Schedulable").ActualName) != null) {42 if(scope.GetVariable(scope.TranslateName("Schedulable")) != null) { 43 43 BoolData isSchedulable = GetVariableValue<BoolData>("Schedulable", scope, false); 44 44 isSchedulable.Data = (op.Predecessors.Count == 0); 45 45 } 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)))); 47 47 } 48 48 return null; -
trunk/sources/HeuristicLab.Scheduling.JSSP/ItemListIndexer.cs
r2 r77 45 45 ItemList list = GetVariableValue<ItemList>("List", scope, true); 46 46 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")); 49 49 } 50 50 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())); 52 52 } 53 53 return null; -
trunk/sources/HeuristicLab.Scheduling.JSSP/JSSPInjector.cs
r2 r77 66 66 67 67 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())); 71 71 return base.Apply(scope); 72 72 } -
trunk/sources/HeuristicLab.Scheduling.JSSP/ScheduleInjector.cs
r2 r77 51 51 IntData timespan = GetVariableValue<IntData>("Timespan", scope, true); 52 52 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)); 54 54 return null; 55 55 } -
trunk/sources/HeuristicLab.Selection.OffspringSelection/OffspringAnalyzer.cs
r2 r77 60 60 double[] qualitiesArray = new double[scope.SubScopes.Count]; 61 61 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; 63 63 qualities = new DoubleArrayData(qualitiesArray); 64 64 IVariableInfo parentQualitiesInfo = GetVariableInfo("ParentQualities"); … … 66 66 AddVariable(new Variable(parentQualitiesInfo.ActualName, qualities)); 67 67 else 68 scope.AddVariable(new Variable( parentQualitiesInfo.ActualName, qualities));68 scope.AddVariable(new Variable(scope.TranslateName(parentQualitiesInfo.FormalName), qualities)); 69 69 70 70 CompositeOperation next = new CompositeOperation(); … … 82 82 } 83 83 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; 85 85 double threshold; 86 86 … … 97 97 else 98 98 successful = new BoolData(false); 99 scope.SubScopes[i].AddVariable(new Variable(s uccessfulInfo.ActualName, successful));99 scope.SubScopes[i].AddVariable(new Variable(scope.TranslateName(successfulInfo.FormalName), successful)); 100 100 } 101 101 … … 105 105 RemoveVariable(parentQualitiesInfo.ActualName); 106 106 else 107 scope.RemoveVariable( parentQualitiesInfo.ActualName);107 scope.RemoveVariable(scope.TranslateName(parentQualitiesInfo.FormalName)); 108 108 109 109 return null; -
trunk/sources/HeuristicLab.Selection.OffspringSelection/OffspringSelector.cs
r40 r77 57 57 AddVariable(new Variable(goodChildrenInfo.ActualName, goodChildren)); 58 58 else 59 scope.AddVariable(new Variable( goodChildrenInfo.ActualName, goodChildren));59 scope.AddVariable(new Variable(scope.TranslateName(goodChildrenInfo.FormalName), goodChildren)); 60 60 } 61 61 ItemList<IScope> badChildren = GetVariableValue<ItemList<IScope>>("BadChildren", scope, false, false); … … 66 66 AddVariable(new Variable(badChildrenInfo.ActualName, badChildren)); 67 67 else 68 scope.AddVariable(new Variable( badChildrenInfo.ActualName, badChildren));68 scope.AddVariable(new Variable(scope.TranslateName(badChildrenInfo.FormalName), badChildren)); 69 69 } 70 70 … … 73 73 while (children.SubScopes.Count > 0) { 74 74 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; 76 76 if (successful) goodChildren.Add(child); 77 77 else badChildren.Add(child); … … 87 87 AddVariable(new Variable(selectionPressureInfo.ActualName, selectionPressure)); 88 88 else 89 scope.AddVariable(new Variable(s electionPressureInfo.ActualName, selectionPressure));89 scope.AddVariable(new Variable(scope.TranslateName(selectionPressureInfo.FormalName), selectionPressure)); 90 90 } 91 91 DoubleData successRatio = GetVariableValue<DoubleData>("SuccessRatio", scope, false, false); … … 96 96 AddVariable(new Variable(successRatioInfo.ActualName, successRatio)); 97 97 else 98 scope.AddVariable(new Variable(s uccessRatioInfo.ActualName, successRatio));98 scope.AddVariable(new Variable(scope.TranslateName(successRatioInfo.FormalName), successRatio)); 99 99 } 100 100 int goodCount = goodChildren.Count; … … 130 130 RemoveVariable(goodChildrenInfo.ActualName); 131 131 else 132 scope.RemoveVariable( goodChildrenInfo.ActualName);132 scope.RemoveVariable(scope.TranslateName(goodChildrenInfo.FormalName)); 133 133 IVariableInfo badChildrenInfo = GetVariableInfo("BadChildren"); 134 134 if (badChildrenInfo.Local) 135 135 RemoveVariable(badChildrenInfo.ActualName); 136 136 else 137 scope.RemoveVariable( badChildrenInfo.ActualName);137 scope.RemoveVariable(scope.TranslateName(badChildrenInfo.FormalName)); 138 138 139 139 return null; -
trunk/sources/HeuristicLab.Selection/ProportionalSelector.cs
r2 r77 81 81 if (subScopes < 1) throw new InvalidOperationException("No source scopes to select available."); 82 82 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; 85 85 double limit = Math.Min(worst * 2, double.MaxValue); 86 86 double min = Math.Min(best, worst); … … 90 90 // preprocess fitness values, apply windowing if desired 91 91 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; 93 93 if (solutionQuality < min || solutionQuality > max) { 94 94 // something has obviously gone wrong here -
trunk/sources/HeuristicLab.Selection/TournamentSelector.cs
r2 r77 52 52 for (int j = 0; j < groupSize; j++) { 53 53 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; 55 55 if (((maximization) && (quality > best)) || 56 56 ((!maximization) && (quality < best))) { -
trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjector.cs
r2 r77 57 57 58 58 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())); 66 66 return null; 67 67 }
Note: See TracChangeset
for help on using the changeset viewer.