Beispiel #1
0
    public Problem()
      : base() {
      Parameters.Add(new FixedValueParameter<IntValue>(LawnWidthParameterName, "Width of the lawn.", new IntValue(8)));
      Parameters.Add(new FixedValueParameter<IntValue>(LawnLengthParameterName, "Length of the lawn.", new IntValue(8)));

      var g = new SimpleSymbolicExpressionGrammar();
      g.AddSymbols(new string[] { "Sum", "Prog" }, 2, 2);
      g.AddSymbols(new string[] { "Frog" }, 1, 1);
      g.AddTerminalSymbols(new string[] { "Left", "Forward" });
      // initialize 20 ephemeral random constants in [0..32[
      var fastRand = new FastRandom(314159);
      for (int i = 0; i < 20; i++) {
        g.AddTerminalSymbol(string.Format("{0},{1}", fastRand.Next(0, 32), fastRand.Next(0, 32)));
      }

      Encoding = new SymbolicExpressionTreeEncoding(g, 1000, 17);
    }
Beispiel #2
0
    public Problem()
      : base() {
      BoolMatrix world = new BoolMatrix(ToBoolMatrix(santaFeAntTrail));
      Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world));
      Parameters.Add(new ValueParameter<IntValue>("MaximumTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600)));

      base.BestKnownQuality = 89;
      var g = new SimpleSymbolicExpressionGrammar();
      g.AddSymbols(new string[] { "IfFoodAhead", "Prog2" }, 2, 2);
      g.AddSymbols(new string[] { "Prog3" }, 3, 3);
      g.AddTerminalSymbols(new string[] { "Move", "Left", "Right" });
      base.Encoding = new SymbolicExpressionTreeEncoding(g, 20, 10);
    }