Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GPDL/Examples/OnlyTerminals.txt @ 12123

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

#2026 added two more examples

File size: 765 bytes
Line 
1PROBLEM OnlyTerminals
2CODE <<
3  const int N = 5;
4>>
5
6NONTERMINALS
7  S<<out double v>>.
8
9TERMINALS
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
24RULES
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
31MINIMIZE
32  <<
33    double v;
34    S(out v);
35    return v;
36  >>
37END OnlyTerminals.
Note: See TracBrowser for help on using the repository browser.