public EvenParityProblem() : base() { Parameters.Add(new FixedValueParameter<IntValue>(NumberOfBitsParameterName, "The number of bits for the input parameter for the even parity function", new IntValue(4))); var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17); UpdateGrammar(); RegisterEventHandlers(); }
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); }
private SimpleSymbolicExpressionGrammar(SimpleSymbolicExpressionGrammar original, Cloner cloner) : base(original, cloner) { }
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); }
private void UpdateGrammar() { var g = new SimpleSymbolicExpressionGrammar(); g.AddSymbols(new[] { "AND", "OR" }, 2, 2); // See Koza 1992, page 171, section 7.4.1 11-multiplexer g.AddSymbols(new[] { "NOT" }, 1, 1); g.AddSymbols(new[] { "IF" }, 3, 3); // find the number of address lines and input lines // e.g. 11-MUX: 3 addrBits + 8 input bits var addrBits = (int)Math.Log(NumberOfBits, 2); // largest power of two that fits into the number of bits var inputBits = NumberOfBits - addrBits; for (int i = 0; i < addrBits; i++) g.AddTerminalSymbol(string.Format("a{0}", i)); for (int i = 0; i < inputBits; i++) g.AddTerminalSymbol(string.Format("d{0}", i)); Encoding.Grammar = g; BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits) }
public MultiplexerProblem() : base() { Parameters.Add(new FixedValueParameter<IntValue>(NumberOfBitsParameterName, "The number of bits for the input parameter for the multiplexer function. This is the sum of the number of address bits and the number of input lines. E.g. the 11-MUX has 3 address bits and 8 input lines", new IntValue(11))); var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17); UpdateGrammar(); RegisterEventHandlers(); }
private void UpdateGrammar() { var g = new SimpleSymbolicExpressionGrammar(); g.AddSymbols(new[] { "AND", "OR", "NAND", "NOR" }, 2, 2); // see Koza, 1992, page 529 section 20.2 Symbolic Regression of Even-Parity Functions // add one terminal symbol for each bit for (int i = 0; i < NumberOfBits; i++) g.AddTerminalSymbol(string.Format("{0}", i)); Encoding.Grammar = g; BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits) }