MCPcopy Create free account
hub / github.com/Gecode/gecode / post

Function post

gecode/minimodel/int-arith.cpp:78–270  ·  view source on GitHub ↗

Post expression

Source from the content-addressed store, hash-verified

76 }
77 /// Post expression
78 virtual IntVar post(Home home, IntVar* ret,
79 const IntPropLevels& ipls) const {
80 IntVar y;
81 switch (t) {
82 case ANLE_ABS:
83 {
84 IntVar x = a[0].post(home, ipls);
85 if (x.min() >= 0)
86 y = result(home,ret,x);
87 else {
88 y = result(home,ret);
89 abs(home, x, y, ipls.abs());
90 }
91 }
92 break;
93 case ANLE_MIN:
94 if (n==1) {
95 y = result(home,ret, a[0].post(home, ipls));
96 } else if (n==2) {
97 IntVar x0 = a[0].post(home, ipls);
98 IntVar x1 = a[1].post(home, ipls);
99 if (x0.max() <= x1.min())
100 y = result(home,ret,x0);
101 else if (x1.max() <= x0.min())
102 y = result(home,ret,x1);
103 else {
104 y = result(home,ret);
105 min(home, x0, x1, y, ipls.min2());
106 }
107 } else {
108 IntVarArgs x(n);
109 for (int i=n; i--;)
110 x[i] = a[i].post(home, ipls);
111 y = result(home,ret);
112 min(home, x, y, ipls.min());
113 }
114 break;
115 case ANLE_MAX:
116 if (n==1) {
117 y = result(home,ret,a[0].post(home, ipls));
118 } else if (n==2) {
119 IntVar x0 = a[0].post(home, ipls);
120 IntVar x1 = a[1].post(home, ipls);
121 if (x0.max() <= x1.min())
122 y = result(home,ret,x1);
123 else if (x1.max() <= x0.min())
124 y = result(home,ret,x0);
125 else {
126 y = result(home,ret);
127 max(home, x0, x1, y, ipls.max2());
128 }
129 } else {
130 IntVarArgs x(n);
131 for (int i=n; i--;)
132 x[i] = a[i].post(home, ipls);
133 y = result(home,ret);
134 max(home, x, y, ipls.max());
135 }

Callers

nothing calls this directly

Calls 15

modFunction · 0.85
min2Method · 0.80
max2Method · 0.80
multMethod · 0.80
divMethod · 0.80
modMethod · 0.80
sqrMethod · 0.80
sqrtMethod · 0.80
nrootMethod · 0.80
elementMethod · 0.80
exprMethod · 0.80
iteMethod · 0.80

Tested by

no test coverage detected