Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GPDL/Examples/OneMaxBinary.txt @ 10415

Last change on this file since 10415 was 10415, checked in by gkronber, 10 years ago

#2026 implemented prevention of resampling of known nodes.

File size: 1.7 KB
Line 
1// special adaptation of the one-max problem
2// must find maximal number of 1-terminals
3// optimal solution = 32, number of solutions 2^32
4PROBLEM OneMaxBinary
5
6NONTERMINALS
7  S<<out int n>>.
8  U<<out int n>>.
9  V<<out int n>>.
10  W<<out int n>>.
11  X<<out int n>>.
12  Y<<out int n>>.
13  T<<out int n>>.
14
15TERMINALS
16  A.
17  B.
18
19RULES
20  S<<out int n>> =                                LOCAL << int n1, n2; >>
21    U<<out n1>> U<<out n2>>                       SEM << n = n1 + n2; >>
22  .
23  U<<out int n>> =                                LOCAL << int n1, n2; >>
24    V<<out n1>> V<<out n2>>                       SEM << n = n1 + n2; >>
25  .
26  V<<out int n>> =                                LOCAL << int n1, n2; >>
27    W<<out n1>> W<<out n2>>                       SEM << n = n1 + n2; >>
28  .
29  W<<out int n>> =                                LOCAL << int n1, n2; >>
30    X<<out n1>> X<<out n2>>                       SEM << n = n1 + n2; >>
31  .
32  // 2^32 solutions
33  X<<out int n>> =                                LOCAL << int n1, n2; >>
34    T<<out n1>> T<<out n2>>                       SEM << n = n1 + n2; >>
35  .
36
37  // uncomment for 2^64 solutions
38  // X<<out int n>> =                                LOCAL << int n1, n2; >>
39  //   Y<<out n1>> Y<<out n2>>                       SEM << n = n1 + n2; >>
40  // .
41
42  Y<<out int n>> =                                LOCAL << int n1, n2; >>
43    T<<out n1>> T<<out n2>>                       SEM << n = n1 + n2; >>
44  .
45
46  T<<out int n>> =
47    A                                             SEM << n = 1; >>
48    | B                                           SEM << n = 0; >>
49  .
50
51MAXIMIZE
52  <<
53    int n;
54    S(out n);
55    return (double) n;
56  >>
57END OneMaxBinary.
Note: See TracBrowser for help on using the repository browser.