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

Method choice

examples/knights.cpp:104–118  ·  view source on GitHub ↗

Return choice

Source from the content-addressed store, hash-verified

102 }
103 /// Return choice
104 virtual Gecode::Choice* choice(Space&) {
105 Int::ViewValues<Int::IntView> iv(x[start]);
106 int n = iv.val();
107 unsigned int min = x[n].size();
108 ++iv;
109 // Choose the value with the fewest neighbors
110 while (iv()) {
111 if (x[iv.val()].size() < min) {
112 n = iv.val();
113 min = x[n].size();
114 }
115 ++iv;
116 }
117 return new Choice(*this, start, n);
118 }
119 /// Return choice
120 virtual Choice* choice(const Space&, Archive& e) {
121 int pos, val;

Callers

nothing calls this directly

Calls 3

ivFunction · 0.85
valMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected