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

Method Queens

test/nogoods.cpp:62–83  ·  view source on GitHub ↗

The actual problem

Source from the content-addressed store, hash-verified

60 IntVarArray q;
61 /// The actual problem
62 Queens(IntValBranch ivb, bool assign, bool null)
63 : q(*this,n,0,n-1) {
64 distinct(*this, IntArgs::create(n,0,1), q, IPL_VAL);
65 distinct(*this, IntArgs::create(n,0,-1), q, IPL_VAL);
66 distinct(*this, q, IPL_VAL);
67 if (assign) {
68 IntVar x(*this,0,1); Gecode::assign(*this, x, INT_ASSIGN_MIN());
69 }
70 {
71 IntVarArgs q1(n/2), q2(n/2);
72 for (int i=0; i<n/2; i++) {
73 q1[i] = q[i]; q2[i] = q[n/2 + i];
74 }
75 branch(*this, q1, INT_VAR_NONE(), ivb);
76 if (null)
77 branch(*this, &dummy);
78 branch(*this, q2, INT_VAR_NONE(), ivb);
79 }
80 if (assign) {
81 IntVar x(*this,0,1); Gecode::assign(*this, x, INT_ASSIGN_MIN());
82 }
83 }
84 /// Constructor for cloning \a s
85 Queens(Queens& s) : Space(s) {
86 q.update(*this, s.q);

Callers

nothing calls this directly

Calls 6

distinctFunction · 0.85
INT_ASSIGN_MINFunction · 0.85
INT_VAR_NONEFunction · 0.85
assignFunction · 0.50
branchFunction · 0.50
updateMethod · 0.45

Tested by

no test coverage detected