PROBLEM Rastrigin /* Optimize the Rastrigin function. Solutions are full binary trees so the vector x can only have 2^n elements */ NONTERMINALS F< x>>. F1< x>>. F2< x>>. F3< x>>. F4< x>>. TERMINALS X<> CONSTRAINTS val IN RANGE <<-5.12>> .. <<5.12>> . RULES F< x>> = LOCAL<< IEnumerable x1, x2; >> F1<> F1<> SEM<< x = x1.Concat(x2); >> . F1< x>> = LOCAL<< IEnumerable x1, x2; >> F2<> F2<> SEM<< x = x1.Concat(x2); >> . F2< x>> = LOCAL<< IEnumerable x1, x2; >> F3<> F3<> SEM<< x = x1.Concat(x2); >> . F3< x>> = LOCAL<< IEnumerable x1, x2; >> F4<> F4<> SEM<< x = x1.Concat(x2); >> . F4< x>> = LOCAL<< double v; >> X<> SEM<< x = Enumerable.Repeat(v, 1); >> . MINIMIZE << IEnumerable x; F(out x); return 10.0 * x.Count() + x.Sum(xi=>xi*xi - 10 * Math.Cos(2*Math.PI*xi)); >> END Rastrigin.