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

Function circuit

gecode/int/circuit.cpp:40–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38namespace Gecode {
39
40 void
41 circuit(Home home, int offset, const IntVarArgs& x, IntPropLevel ipl) {
42 Int::Limits::nonnegative(offset,"Int::circuit");
43 if (x.size() == 0)
44 throw Int::TooFewArguments("Int::circuit");
45 if (same(x))
46 throw Int::ArgumentSame("Int::circuit");
47 GECODE_POST;
48 ViewArray<Int::IntView> xv(home,x);
49
50 if (offset == 0) {
51 typedef Int::NoOffset<Int::IntView> NOV;
52 NOV no;
53 if (vbd(ipl) == IPL_DOM) {
54 GECODE_ES_FAIL((Int::Circuit::Dom<Int::IntView,NOV>
55 ::post(home,xv,no)));
56 } else {
57 GECODE_ES_FAIL((Int::Circuit::Val<Int::IntView,NOV>
58 ::post(home,xv,no)));
59 }
60 } else {
61 typedef Int::Offset OV;
62 OV off(-offset);
63 if (vbd(ipl) == IPL_DOM) {
64 GECODE_ES_FAIL((Int::Circuit::Dom<Int::IntView,OV>
65 ::post(home,xv,off)));
66 } else {
67 GECODE_ES_FAIL((Int::Circuit::Val<Int::IntView,OV>
68 ::post(home,xv,off)));
69 }
70 }
71 }
72 void
73 circuit(Home home, const IntVarArgs& x, IntPropLevel ipl) {
74 circuit(home,0,x,ipl);

Callers 8

postMethod · 0.85
postMethod · 0.85
postMethod · 0.85
KnightsCircuitMethod · 0.85
TSPMethod · 0.85
p_circuitFunction · 0.85
p_circuit_cost_arrayFunction · 0.85
p_circuit_costFunction · 0.85

Calls 5

elementFunction · 0.70
linearFunction · 0.70
sameFunction · 0.50
postFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected