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

Function nvalues

gecode/int/nvalues.cpp:39–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37namespace Gecode {
38
39 void
40 nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
41 IntPropLevel) {
42 using namespace Int;
43 Limits::check(y,"Int::nvalues");
44 // Due to the quadratic Boolean matrix used in propagation
45 long long int n = x.size();
46 Limits::check(n*n,"Int::nvalues");
47
48 GECODE_POST;
49
50 ViewArray<IntView> xv(home,x);
51
52 switch (irt) {
53 case IRT_EQ:
54 {
55 ConstIntView yv(y);
56 GECODE_ES_FAIL(NValues::EqInt<ConstIntView>::post(home,xv,yv));
57 }
58 break;
59 case IRT_NQ:
60 {
61 IntVar z(home,0,x.size());
62 GECODE_ME_FAIL(IntView(z).nq(home,y));
63 GECODE_ES_FAIL(NValues::EqInt<IntView>::post(home,xv,z));
64 }
65 break;
66 case IRT_LE:
67 y--;
68 // Fall through
69 case IRT_LQ:
70 {
71 ConstIntView yv(y);
72 GECODE_ES_FAIL(NValues::LqInt<ConstIntView>::post(home,xv,yv));
73 }
74 break;
75 case IRT_GR:
76 y++;
77 // Fall through
78 case IRT_GQ:
79 {
80 ConstIntView yv(y);
81 GECODE_ES_FAIL(NValues::GqInt<ConstIntView>::post(home,xv,yv));
82 }
83 break;
84 default:
85 throw UnknownRelation("Int::nvalues");
86 }
87 }
88
89 void
90 nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,

Callers 10

postMethod · 0.85
postMethod · 0.85
postMethod · 0.85
postMethod · 0.85
DominatingQueensMethod · 0.85
not_all_equalMethod · 0.85
valuesFunction · 0.85
channelFunction · 0.85
channelFunction · 0.85
p_nvalueFunction · 0.85

Calls 7

IntViewClass · 0.70
checkFunction · 0.50
postFunction · 0.50
sizeMethod · 0.45
nqMethod · 0.45
assignedMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected