- Timestamp:
- 03/05/14 14:48:13 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing
- Property svn:mergeinfo changed
-
branches/DataPreprocessing/HeuristicLab.Problems.LawnMower/3.3/Evaluator.cs
r9456 r10538 32 32 [StorableClass] 33 33 [Item("Lawn Mower Evaluator", "Evaluator for the lawn mower demo GP problem.")] 34 public class Evaluator : SingleSuccessorOperator, ISingleObjectiveEvaluator {34 public class Evaluator : InstrumentedOperator, ISingleObjectiveEvaluator { 35 35 36 36 private const string QualityParameterName = "Quality"; … … 72 72 return new Evaluator(this, cloner); 73 73 } 74 public override IOperation Apply() {74 public override IOperation InstrumentedApply() { 75 75 int length = LawnLengthParameter.ActualValue.Value; 76 76 int width = LawnWidthParameter.ActualValue.Value; … … 88 88 89 89 QualityParameter.ActualValue = new DoubleValue(numberOfMowedCells); 90 return base. Apply();90 return base.InstrumentedApply(); 91 91 } 92 92 } -
branches/DataPreprocessing/HeuristicLab.Problems.LawnMower/3.3/Interpreter.cs
r9456 r10538 54 54 lawn[mowerState.Position.Item1, mowerState.Position.Item2] = true; 55 55 EvaluateLawnMowerProgram(tree.Root, mowerState, lawn, tree.Root.Subtrees.Skip(1).ToArray()); 56 57 56 return lawn; 58 57 } … … 115 114 } else if (node.Symbol is Frog) { 116 115 var p = EvaluateLawnMowerProgram(node.GetSubtree(0), mowerState, lawn, adfs); 117 118 uint newRow = (uint)((mowerState.Position.Item1 + lawn.GetLength(0) + p.Item1 % lawn.GetLength(0)) % lawn.GetLength(0)); 119 uint newCol = (uint)((mowerState.Position.Item2 + lawn.GetLength(1) + p.Item2 % lawn.GetLength(1)) % lawn.GetLength(1)); 116 int x = p.Item1; 117 int y = p.Item2; 118 while (x < 0) x += lawn.GetLength(0); 119 while (y < 0) y += lawn.GetLength(1); 120 var newRow = (uint)((mowerState.Position.Item1 + x) % lawn.GetLength(0)); 121 var newCol = (uint)((mowerState.Position.Item2 + y) % lawn.GetLength(1)); 120 122 mowerState.Position = new Tuple<uint, uint>(newRow, newCol); 121 123 mowerState.Energy = mowerState.Energy - 1; … … 130 132 select adf).Single(); 131 133 // clone the function definition because we are replacing the argument nodes 132 functionDefinition = (DefunTreeNode) 134 functionDefinition = (DefunTreeNode)functionDefinition.Clone(); 133 135 // find the argument tree nodes and their parents in the original function definition 134 136 // toList is necessary to prevent that newly inserted branches are iterated
Note: See TracChangeset
for help on using the changeset viewer.