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

Method MagicSequence

examples/magic-sequence.cpp:72–86  ·  view source on GitHub ↗

The actual model

Source from the content-addressed store, hash-verified

70 };
71 /// The actual model
72 MagicSequence(const SizeOptions& opt)
73 : Script(opt), n(opt.size()), s(*this,n,0,n-1) {
74 switch (opt.propagation()) {
75 case PROP_COUNT:
76 for (int i=n; i--; )
77 count(*this, s, i, IRT_EQ, s[i]);
78 linear(*this, s, IRT_EQ, n);
79 break;
80 case PROP_GCC:
81 count(*this, s, s, opt.ipl());
82 break;
83 }
84 linear(*this, IntArgs::create(n,-1,1), s, IRT_EQ, 0);
85 branch(*this, s, INT_VAR_NONE(), INT_VAL_MAX());
86 }
87
88 /// Constructor for cloning \a e
89 MagicSequence(MagicSequence& e) : Script(e), n(e.n) {

Callers

nothing calls this directly

Calls 9

INT_VAR_NONEFunction · 0.85
INT_VAL_MAXFunction · 0.85
propagationMethod · 0.80
countFunction · 0.50
linearFunction · 0.50
branchFunction · 0.50
sizeMethod · 0.45
iplMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected