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

Method Hamming

examples/hamming.cpp:92–111  ·  view source on GitHub ↗

Actual model

Source from the content-addressed store, hash-verified

90public:
91 /// Actual model
92 Hamming(const HammingOptions& opt) :
93 Script(opt),
94 x(*this,opt.size(),IntSet::empty,1,opt.bits()) {
95
96 if (opt.trace() != 0)
97 trace(*this, x, opt.trace());
98
99 SetVarArgs cx(x.size());
100
101 for (int i=x.size(); i--;)
102 cx[i] = expr(*this, -x[i]);
103
104 for (int i=0; i<x.size(); i++)
105 for (int j=i+1; j<x.size(); j++)
106 rel(*this,
107 cardinality(x[j] & cx[i]) +
108 cardinality(x[i] & cx[j]) >= opt.distance());
109
110 branch(*this, x, SET_VAR_NONE(), SET_VAL_MIN_INC());
111 }
112
113 /// Print solution
114 virtual void

Callers

nothing calls this directly

Calls 12

SET_VAR_NONEFunction · 0.85
SET_VAL_MIN_INCFunction · 0.85
traceMethod · 0.80
distanceMethod · 0.80
traceFunction · 0.50
exprFunction · 0.50
relFunction · 0.50
cardinalityFunction · 0.50
branchFunction · 0.50
sizeMethod · 0.45
bitsMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected