Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlEditor.cs
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlEditor.cs	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlEditor.cs	(revision 9846)
@@ -24,5 +24,7 @@
 using System.Linq;
 using System.Text;
+using HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm;
 using HeuristicLab.MainForm.WindowsForms;
+using HeuristicLab.Optimization;
 using HeuristicLab.Problems.Instances;
 using HeuristicLab.Problems.Instances.Views;
@@ -46,5 +48,20 @@
         Parser parser = new Parser(scanner);
         parser.Parse();
-        MainForm.MainFormManager.MainForm.ShowContent(parser.problem);
+
+        // generate an OSGA to solve the problem
+        var osga = new OffspringSelectionGeneticAlgorithm();
+        osga.Problem = parser.problem;
+        osga.Engine = new SequentialEngine.SequentialEngine();
+        osga.PopulationSize.Value = 500;
+        osga.MutationProbability.Value = 0.15;
+        osga.ComparisonFactorUpperBound.Value = 1.0;
+        osga.ComparisonFactorLowerBound.Value = 1.0;
+        osga.MutatorParameter.Value =
+          osga.MutatorParameter.ValidValues.First(o => o.Name.Contains("MultiSymbolicExpressionTreeManipulator"));
+        osga.SelectorParameter.Value =
+          osga.SelectorParameter.ValidValues.First(o => o.Name.Contains("GenderSpecific"));
+        osga.MaximumSelectionPressure.Value = 500;
+        osga.MaximumGenerations.Value = 100;
+        MainForm.MainFormManager.MainForm.ShowContent(osga);
       }
 
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlExampleProvider.cs
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlExampleProvider.cs	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlExampleProvider.cs	(revision 9846)
@@ -31,4 +31,5 @@
         {
           new GpdlExampleDataDescriptor("Artificial Ant", "The artificial ant problem.", Resources.Artificial_Ant),
+          new GpdlExampleDataDescriptor("Lawn mower", "The lawn mower benchmark problem.", Resources.LawnMower), 
           new GpdlExampleDataDescriptor("Factorial", "Evolve a program to calculate the factorial function.", Resources.Factorial),
           new GpdlExampleDataDescriptor("Fibonacci", "Evolve a problem to calculate the fibonacci function.", Resources.Fib),
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/HeuristicLab.Problems.GPDL.Views-3.4.csproj
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/HeuristicLab.Problems.GPDL.Views-3.4.csproj	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/HeuristicLab.Problems.GPDL.Views-3.4.csproj	(revision 9846)
@@ -93,4 +93,12 @@
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -142,4 +150,8 @@
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.Views-3.3.dll</HintPath>
       <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.SequentialEngine-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.SequentialEngine-3.3.dll</HintPath>
     </Reference>
     <Reference Include="ICSharpCode.AvalonEdit, Version=4.3.1.9430, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
@@ -263,4 +275,5 @@
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
+    <None Include="Resources\LawnMower.txt" />
     <None Include="Resources\Multiplexer.txt" />
     <None Include="Resources\EvenParity.txt" />
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Properties/Resources.Designer.cs
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Properties/Resources.Designer.cs	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Properties/Resources.Designer.cs	(revision 9846)
@@ -197,4 +197,33 @@
         
         /// <summary>
+        ///   Looks up a localized string similar to PROBLEM LawnMower
+        ///
+        ///CODE &lt;&lt;
+        ///  public int Width { get { return 8; } }
+        ///  public int Height { get { return 8; } }
+        ///
+        ///  enum Direction {West, East, North, South};
+        ///
+        ///  class World {
+        ///    private bool[,] mowed = new bool[Width, Height];
+        ///    public World() {
+        ///      Reset();
+        ///    }
+        ///    public void Reset() {
+        ///      for(int col = 0; col &lt; Width; col++)
+        ///        for(int row = 0; row &lt; Height; row++) {
+        ///          mowed[col, row] = false;
+        ///        }
+        ///    }
+        ///    public void SetCellMowed(int col, int row) {
+        ///      m [rest of string was truncated]&quot;;.
+        /// </summary>
+        internal static string LawnMower {
+            get {
+                return ResourceManager.GetString("LawnMower", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to PROBLEM MultiOutputMultiplier
         ///
@@ -220,21 +249,21 @@
         ///
         ///NONTERMINALS
-        ///  Expr&lt;&lt;bool[] d, out bool p&gt;&gt;.
-        ///  AND&lt;&lt;bool[] d, out bool p&gt;&gt;.
-        ///  OR&lt;&lt;bool[] d, out bool p&gt;&gt;.
-        ///  NOT&lt;&lt;bool[] d, out bool p&gt;&gt;.
-        ///  IF&lt;&lt;bool[] d, out bool p&gt;&gt;.
+        ///  Expr&lt;&lt;bool[] d, out bool o&gt;&gt;.
+        ///  AND&lt;&lt;bool[] d, out bool o&gt;&gt;.
+        ///  OR&lt;&lt;bool[] d, out bool o&gt;&gt;.
+        ///  NOT&lt;&lt;bool[] d, out bool o&gt;&gt;.
+        ///  IF&lt;&lt;bool[] d, out bool o&gt;&gt;.
         ///
         ///TERMINALS
-        ///  A0. A1. A2. A2. D0. D1. D2. D3. D4. D5. D6. D7.
+        ///  A0. A1. A2. D0. D1. D2. D3. D4. D5. D6. D7.
         ///
         ///RULES
         ///  Expr&lt;&lt;bool[] d, out bool o&gt;&gt; =
-        ///    AND&lt;&lt;d, out p&gt;&gt;
-        ///    | OR&lt;&lt;d, out p&gt;&gt;
-        ///    | NOT&lt;&lt;d, out p&gt;&gt;
-        ///    | IF&lt;&lt;d, out p&gt;&gt;
-        ///    | A0                                                   SEM&lt;&lt; p = d[0]; &gt;&gt;
-        ///    | A1                                   [rest of string was truncated]&quot;;.
+        ///    AND&lt;&lt;d, out o&gt;&gt;
+        ///    | OR&lt;&lt;d, out o&gt;&gt;
+        ///    | NOT&lt;&lt;d, out o&gt;&gt;
+        ///    | IF&lt;&lt;d, out o&gt;&gt;
+        ///    | A0                                                   SEM&lt;&lt; o = d[0]; &gt;&gt;
+        ///    | A1                                       [rest of string was truncated]&quot;;.
         /// </summary>
         internal static string Multiplexer {
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Properties/Resources.resx
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Properties/Resources.resx	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Properties/Resources.resx	(revision 9846)
@@ -134,4 +134,7 @@
     <value>..\Resources\GPDL.xshd;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
   </data>
+  <data name="LawnMower" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\resources\lawnmower.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
+  </data>
   <data name="Multiplexer" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\resources\multiplexer.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/Artificial Ant.txt
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/Artificial Ant.txt	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/Artificial Ant.txt	(revision 9846)
@@ -188,7 +188,5 @@
 
 TERMINALS
-  Left<<>> CONSTRAINTS .
-  Right<<>> CONSTRAINTS .
-  Move<<>> CONSTRAINTS .
+  Left. Right. Move.
  
 RULES
@@ -197,7 +195,7 @@
     | Prog2<<world, state>>
     | Prog3<<world, state>>
-    | Left<<>>                                         SEM << state.TurnLeft(); >>
-    | Right<<>>                                        SEM << state.TurnRight(); >>
-    | Move<<>>                                         SEM << state.MoveForward(); >>
+    | Left                                             SEM << state.TurnLeft(); >>
+    | Right                                            SEM << state.TurnRight(); >>
+    | Move                                             SEM << state.MoveForward(); >>
     .
     
@@ -229,3 +227,3 @@
     return (double)state.FoodEaten;
   >>  
-END ArtitificialAnt.
+END ArtificialAnt.
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/LawnMower.txt
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/LawnMower.txt	(revision 9846)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/LawnMower.txt	(revision 9846)
@@ -0,0 +1,177 @@
+PROBLEM LawnMower
+/* the lawn mower problem with syntax to enforce that constants and sums are only used
+ * in sub-trees under the "frog" symbol. Interestingly, this increases success rates in 
+ * comparison with the original formulation where functions could be combined freely.
+ */ 
+CODE <<
+  public static int Width { get { return 16; } }
+  public static int Height { get { return 16; } }
+
+  enum Direction {West, East, North, South};
+
+  class Point { 
+    public int x; 
+    public int y; 
+    public Point(int x, int y) { 
+      this.x = x; this.y = y; 
+    } 
+  }
+
+  class World {
+    private bool[,] mowed = new bool[Width, Height];
+    public World() {
+      Reset();
+    }
+    public void Reset() {
+      for(int col = 0; col < Width; col++)
+        for(int row = 0; row < Height; row++) {
+          mowed[col, row] = false;
+        }
+    }
+    public void SetCellMowed(Point p) {
+      mowed[p.x, p.y] = true;
+    }
+    public bool IsCellMowed(Point p) {
+      return mowed[p.x, p.y];
+    }
+  }
+
+  class MowerState {
+    public Point Position { get; set;} 
+    public Direction Direction { get; set; }
+    public World World { get; set; }
+    public int Energy { get; set; }
+    public int MowedCells { get; set; }
+   
+    public MowerState() {
+      Energy = 0;
+      MowedCells = 0;
+    }
+ 
+    public void TurnLeft() {
+      if (Energy <= 0) return; // don't move when no energy left
+      Energy--;
+      switch(Direction) {
+        case Direction.West: Direction = Direction.South; break;
+        case Direction.South: Direction = Direction.East; break;
+        case Direction.East: Direction = Direction.North; break;
+        case Direction.North: Direction = Direction.West; break;
+      }
+    }
+  
+    public void Forward() { 
+      if(Energy <= 0) return; // don't move when no energy left
+      Position = NextPosition; 
+      Energy--; 
+      if(!World.IsCellMowed(Position)) {
+        World.SetCellMowed(Position);
+        MowedCells++;
+      }
+    }
+
+    public void Jump(int x, int y) {
+      if(Energy <= 0) return; // don't move when no energy left
+      while(x<0) x += Width; // make sure offset is positive for mod-operation
+      while(y<0) y += Height;
+      Position = new Point((Position.x + x) % Width, (Position.y + y) % Height);
+      Energy--; 
+      if(!World.IsCellMowed(Position)) {
+        World.SetCellMowed(Position);
+        MowedCells++;
+      }
+    }
+  
+    public Point NextPosition { 
+      get { 
+        int x, y;
+        switch(Direction) {
+          case Direction.West: 
+            x = (Position.x + Width - 1) % Width;
+            y = Position.y;
+            return new Point(x, y);
+          case Direction.South: 
+            x = Position.x;
+            y = (Position.y + Height + 1) % Height;
+            return new Point(x, y);
+          case Direction.East:
+            x = (Position.x + Width + 1) % Width;
+            y = Position.y;
+            return new Point(x, y);
+          case Direction.North:
+            x = Position.x;
+            y = (Position.y + Height - 1) % Height;
+            return new Point(x, y);
+        }
+        return new Point(-1,-1);
+      }
+    }
+  }
+
+World CreateWorld() {   
+  return new World();
+}
+
+World world;
+/* set of possible values for constants [-100, 100] */
+int[] ints = Enumerable.Range(-100, 201).ToArray();
+>>
+INIT <<
+  world = CreateWorld();
+>>
+
+NONTERMINALS
+  LawnMower<<MowerState state>>. 
+  Sum<<out int x, out int y>>.
+  Expr<<out int x, out int y>>. /* helper for expressions containing const and sum */
+  Frog<<MowerState state>>.
+  Prog2<<MowerState state>>.
+
+TERMINALS
+  Left.
+  Forward.
+  Const<<out int x, out int y>>
+    CONSTRAINTS
+      x IN SET <<ints; >> /* x \in [-100, 100] */
+      y IN SET <<ints; >> /* y \in [-100, 100] */
+  .
+
+RULES
+  LawnMower<<MowerState state>> = 
+    Prog2<<state>>
+    | Frog<<state>>
+    | Left                                             SEM << state.TurnLeft(); >>
+    | Forward                                          SEM << state.Forward(); >>
+  .
+    
+  Sum<<out int x, out int y>> =                        LOCAL << int x1, y1, x2, y2; >>
+    Expr<<out x1, out y1>>
+    Expr<<out x2, out y2>>                             SEM << x = x1 + x2; y = y1 + y2; >>
+  .
+
+  Expr<<out int x, out int y>> =
+    Const<<out x, out y>>
+    | Sum<<out x, out y>>
+  .
+
+  Prog2<<MowerState state>> = 
+    LawnMower<<state>> 
+    LawnMower<<state>>
+  .
+  
+  Frog<<MowerState state>> =                          LOCAL << int x; int y; >>
+     Expr<<out x, out y>>                             SEM << state.Jump(x, y); >>
+  .
+
+MAXIMIZE
+  <<    
+    world.Reset();
+    var state = new MowerState() {Position = new Point(0,0), 
+                                  Energy = 2 * Height * Width, 
+                                  Direction = Direction.South, 
+                                  World = world};
+    while(state.Energy > 0) {
+      LawnMower(state);
+    }
+    return (double)state.MowedCells;
+  >>  
+END LawnMower.
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/GPDef.atg
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/GPDef.atg	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/GPDef.atg	(revision 9846)
@@ -28,5 +28,5 @@
 
 COMPILER GPDef
-  public HeuristicLab.Optimization.IProblem problem;
+  public HeuristicLab.Optimization.ISingleObjectiveHeuristicOptimizationProblem problem;
   
 CHARACTERS
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Parser.cs
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Parser.cs	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Parser.cs	(revision 9846)
@@ -28,5 +28,5 @@
 	int errDist = minErrDist;
 
-public HeuristicLab.Optimization.IProblem problem;
+public HeuristicLab.Optimization.ISingleObjectiveHeuristicOptimizationProblem problem;
   
 
Index: /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/ProblemGenerator.cs
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/ProblemGenerator.cs	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/ProblemGenerator.cs	(revision 9846)
@@ -397,5 +397,5 @@
   }
 
-  public IProblem GenerateFromAst(GPDefNode definition) {
+  public ISingleObjectiveHeuristicOptimizationProblem GenerateFromAst(GPDefNode definition) {
     problemSourceCode.AppendLine(usings);
 
@@ -447,5 +447,5 @@
       AppDomain.CurrentDomain.Load(asm.GetName());
       var problem = Activator.CreateInstance(asm.FullName, definition.Name + "." + definition.Name + "Problem").Unwrap();
-      return (HeuristicLab.Optimization.IProblem)problem;
+      return (ISingleObjectiveHeuristicOptimizationProblem)problem;
     }
   }
Index: /branches/HeuristicLab.Problems.GPDL/Test/Test.csproj
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/Test/Test.csproj	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/Test/Test.csproj	(revision 9846)
@@ -57,4 +57,8 @@
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
       <Private>True</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
Index: /branches/HeuristicLab.Problems.GPDL/Test/TestGpdlExamples.cs
===================================================================
--- /branches/HeuristicLab.Problems.GPDL/Test/TestGpdlExamples.cs	(revision 9845)
+++ /branches/HeuristicLab.Problems.GPDL/Test/TestGpdlExamples.cs	(revision 9846)
@@ -24,6 +24,9 @@
 using System.Linq;
 using System.Text;
+using System.Threading;
+using HeuristicLab.Algorithms.GeneticAlgorithm;
 using HeuristicLab.Problems.GPDL;
 using HeuristicLab.Problems.GPDL.Views;
+using HeuristicLab.SequentialEngine;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
@@ -39,4 +42,22 @@
         parser.Parse();
         Assert.IsNotNull(parser.problem);
+
+        // test: run one generation
+        var ga = new GeneticAlgorithm();
+        ga.Engine = new SequentialEngine();
+        ga.PopulationSize.Value = 100;
+        ga.MaximumGenerations.Value = 1;
+        ga.Problem = parser.problem;
+
+        var wh = new AutoResetEvent(false);
+        Exception e = null;
+        ga.ExceptionOccurred += (sender, args) => {
+          e = args.Value;
+          wh.Set();
+        };
+        ga.Stopped += (sender, args) => { wh.Set(); };
+        ga.Start();
+        wh.WaitOne();
+        if (e != null) Assert.Fail(e.Message, e);
       }
     }
