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

Method post

test/int/mm-lin.cpp:200–231  ·  view source on GitHub ↗

Post constraint on \a x

Source from the content-addressed store, hash-verified

198 }
199 /// Post constraint on \a x
200 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
201 using namespace Gecode;
202 Gecode::LinIntExpr l_reg[3] = {x[0],x[1],x[2]};
203 Gecode::LinIntExpr r_reg[3] = {x[0],x[1],x[2]};
204 switch (irt) {
205 case IRT_EQ:
206 {
207 IntVar x = Gecode::expr(home,eval(l_lis,l_reg));
208 IntVar y = Gecode::expr(home,eval(r_lis,r_reg));
209 IntArgs a({1,-1});
210 IntVarArgs xy(2); xy[0]=x; xy[1]=y;
211 Gecode::rel(home, 0 == sum(a,xy));
212 }
213 break;
214 case IRT_NQ:
215 Gecode::rel(home, eval(l_lis,l_reg) - eval(r_lis,r_reg) != 0);
216 break;
217 case IRT_LQ:
218 Gecode::rel(home, !(eval(l_lis,l_reg) > eval(r_lis,r_reg)));
219 break;
220 case IRT_LE:
221 Gecode::rel(home, eval(l_lis,l_reg) < eval(r_lis,r_reg));
222 break;
223 case IRT_GQ:
224 Gecode::rel(home, eval(l_lis,l_reg) >= eval(r_lis,r_reg));
225 break;
226 case IRT_GR:
227 Gecode::rel(home, !(eval(l_lis,l_reg) <= eval(r_lis,r_reg)));
228 break;
229 default: GECODE_NEVER;
230 }
231 }
232 /// Post constraint on \a x for \a r
233 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
234 Gecode::Reify r) {

Callers

nothing calls this directly

Calls 6

evalFunction · 0.70
exprFunction · 0.50
relFunction · 0.50
sumFunction · 0.50
modeMethod · 0.45
varMethod · 0.45

Tested by

no test coverage detected