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

Method AllInterval

examples/all-interval.cpp:70–89  ·  view source on GitHub ↗

Actual model

Source from the content-addressed store, hash-verified

68public:
69 /// Actual model
70 AllInterval(const SizeOptions& opt) :
71 Script(opt),
72 x(*this, opt.size(), 0, opt.size()-1),
73 d(*this, opt.size()-1, 1, opt.size()-1) {
74 const int n = x.size();
75
76 // Set up variables for distance
77 for (int i=0; i<n-1; i++)
78 rel(*this, d[i] == abs(x[i+1]-x[i]), opt.ipl());
79
80 distinct(*this, x, opt.ipl());
81 distinct(*this, d, opt.ipl());
82
83 // Break mirror symmetry
84 rel(*this, x[0], IRT_LE, x[1]);
85 // Break symmetry of dual solution
86 rel(*this, d[0], IRT_GR, d[n-2]);
87
88 branch(*this, x, INT_VAR_SIZE_MIN(), INT_VAL_SPLIT_MIN());
89 }
90 /// Constructor for cloning \a e
91 AllInterval(AllInterval& s)
92 : Script(s) {

Callers

nothing calls this directly

Calls 9

distinctFunction · 0.85
INT_VAR_SIZE_MINFunction · 0.85
INT_VAL_SPLIT_MINFunction · 0.85
relFunction · 0.50
absFunction · 0.50
branchFunction · 0.50
sizeMethod · 0.45
iplMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected