Line | |
---|
1 | PROBLEM OnlyTerminals
|
---|
2 | CODE <<
|
---|
3 | const int N = 5;
|
---|
4 | >>
|
---|
5 |
|
---|
6 | NONTERMINALS
|
---|
7 | S<<out double v>>.
|
---|
8 |
|
---|
9 | TERMINALS
|
---|
10 | T1<<out int val>>
|
---|
11 | CONSTRAINTS
|
---|
12 | val IN SET <<Enumerable.Range(0, N);>>
|
---|
13 | .
|
---|
14 | T2<<out int v1, out int v2>>
|
---|
15 | CONSTRAINTS
|
---|
16 | v1 IN SET <<Enumerable.Range(0, N);>>
|
---|
17 | v2 IN SET <<Enumerable.Range(0, N);>>
|
---|
18 | .
|
---|
19 | T3<<out double x>>
|
---|
20 | CONSTRAINTS
|
---|
21 | x IN RANGE <<-N>> .. <<N>>
|
---|
22 | .
|
---|
23 |
|
---|
24 | RULES
|
---|
25 | S<<out double v>> = LOCAL << int i1, i2; >>
|
---|
26 | T1<<out i1>> SEM << v = i1; >>
|
---|
27 | | T2<<out i1, out i2>> SEM << v = i1; >>
|
---|
28 | | T3<<out v>>
|
---|
29 | .
|
---|
30 |
|
---|
31 | MINIMIZE
|
---|
32 | <<
|
---|
33 | double v;
|
---|
34 | S(out v);
|
---|
35 | return v;
|
---|
36 | >>
|
---|
37 | END OnlyTerminals.
|
---|
Note: See
TracBrowser
for help on using the repository browser.