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

Method Grocery

examples/grocery.cpp:66–80  ·  view source on GitHub ↗

The actual model

Source from the content-addressed store, hash-verified

64public:
65 /// The actual model
66 Grocery(const Options& opt)
67 : Script(opt), abcd(*this,4,0,s) {
68 IntVar a(abcd[0]), b(abcd[1]), c(abcd[2]), d(abcd[3]);
69
70 // The sum of all variables is s
71 rel(*this, a+b+c+d == s, opt.ipl());
72
73 // The product of all variables is s (corrected by scale factor)
74 rel(*this, (a*b)*(c*d) == p, opt.ipl());
75
76 // Break symmetries: order the variables
77 rel(*this, abcd, IRT_LQ);
78
79 branch(*this, abcd, INT_VAR_NONE(), INT_VAL_SPLIT_MAX());
80 }
81
82 /// Constructor for cloning \a s
83 Grocery(Grocery& s) : Script(s) {

Callers

nothing calls this directly

Calls 6

INT_VAR_NONEFunction · 0.85
INT_VAL_SPLIT_MAXFunction · 0.85
relFunction · 0.50
branchFunction · 0.50
iplMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected