Line | |
---|
1 | // special adaptation of the one-max problem
|
---|
2 | // must find maximal number of 1-terminals
|
---|
3 | // optimal solution = 243, number of solutions 3^243
|
---|
4 | PROBLEM OneMaxTernary
|
---|
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 | T<<out int n>>.
|
---|
13 |
|
---|
14 | TERMINALS
|
---|
15 | A. B. C.
|
---|
16 |
|
---|
17 | RULES
|
---|
18 | S<<out int n>> = LOCAL << int n1, n2, n3; >>
|
---|
19 | U<<out n1>> U<<out n2>> U<<out n3>> SEM << n = n1 + n2 + n3; >>
|
---|
20 | .
|
---|
21 | U<<out int n>> = LOCAL << int n1, n2, n3; >>
|
---|
22 | V<<out n1>> V<<out n2>> V<<out n3>> SEM << n = n1 + n2 + n3; >>
|
---|
23 | .
|
---|
24 | V<<out int n>> = LOCAL << int n1, n2, n3; >>
|
---|
25 | W<<out n1>> W<<out n2>> W<<out n3>> SEM << n = n1 + n2 + n3; >>
|
---|
26 | .
|
---|
27 | W<<out int n>> = LOCAL << int n1, n2, n3; >>
|
---|
28 | X<<out n1>> X<<out n2>> X<<out n3>> SEM << n = n1 + n2 + n3; >>
|
---|
29 | .
|
---|
30 |
|
---|
31 | X<<out int n>> = LOCAL << int n1, n2, n3; >>
|
---|
32 | T<<out n1>> T<<out n2>> T<<out n3>> SEM << n = n1 + n2 + n3; >>
|
---|
33 | .
|
---|
34 |
|
---|
35 | T<<out int n>> =
|
---|
36 | A SEM << n = 0; >>
|
---|
37 | | B SEM << n = 1; >>
|
---|
38 | | C SEM << n = 0; >>
|
---|
39 | .
|
---|
40 |
|
---|
41 | MAXIMIZE
|
---|
42 | <<
|
---|
43 | int n;
|
---|
44 | S(out n);
|
---|
45 | return (double) n;
|
---|
46 | >>
|
---|
47 | END OneMaxTernary.
|
---|
Note: See
TracBrowser
for help on using the repository browser.