Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GPDL/Examples/Rastrigin.txt @ 15899

Last change on this file since 15899 was 10333, checked in by gkronber, 11 years ago

#2026 added two more examples

File size: 1.3 KB
RevLine 
[10333]1PROBLEM Rastrigin
2
3/* Optimize the Rastrigin function. Solutions are full binary trees so the vector x can only have 2^n elements  */ 
4
5NONTERMINALS
6   F<<out IEnumerable<double> x>>.
7  F1<<out IEnumerable<double> x>>.
8  F2<<out IEnumerable<double> x>>.
9  F3<<out IEnumerable<double> x>>.
10  F4<<out IEnumerable<double> x>>.
11
12TERMINALS
13  X<<out double val>>
14    CONSTRAINTS
15      val IN RANGE <<-5.12>> .. <<5.12>>
16  .
17
18RULES
19  F<<out IEnumerable<double> x>> = LOCAL<< IEnumerable<double> x1, x2; >>
20    F1<<out x1>> F1<<out x2>>      SEM<< x = x1.Concat(x2); >>
21  .
22  F1<<out IEnumerable<double> x>> = LOCAL<< IEnumerable<double> x1, x2; >>
23    F2<<out x1>> F2<<out x2>>      SEM<< x = x1.Concat(x2); >>
24  .
25  F2<<out IEnumerable<double> x>> = LOCAL<< IEnumerable<double> x1, x2; >>
26    F3<<out x1>> F3<<out x2>>      SEM<< x = x1.Concat(x2); >>
27  .
28  F3<<out IEnumerable<double> x>> = LOCAL<< IEnumerable<double> x1, x2; >>
29    F4<<out x1>> F4<<out x2>>      SEM<< x = x1.Concat(x2); >>
30  .
31  F4<<out IEnumerable<double> x>> = LOCAL<< double v; >>
32    X<<out v>>                      SEM<< x = Enumerable.Repeat(v, 1); >>
33  .
34
35MINIMIZE
36  <<
37    IEnumerable<double> x;
38    F(out x);
39    return 10.0 * x.Count() + x.Sum(xi=>xi*xi - 10 * Math.Cos(2*Math.PI*xi));
40  >>
41END Rastrigin.
Note: See TracBrowser for help on using the repository browser.