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
|
---|
4 | PROBLEM OneMaxBinary
|
---|
5 |
|
---|
6 | NONTERMINALS
|
---|
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 |
|
---|
15 | TERMINALS
|
---|
16 | A.
|
---|
17 | B.
|
---|
18 |
|
---|
19 | RULES
|
---|
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 |
|
---|
51 | MAXIMIZE
|
---|
52 | <<
|
---|
53 | int n;
|
---|
54 | S(out n);
|
---|
55 | return (double) n;
|
---|
56 | >>
|
---|
57 | END OneMaxBinary.
|
---|
Note: See
TracBrowser
for help on using the repository browser.