42 make_view_array(Space& home,
const IntVarArgs& in) {
43 return ViewArray<Int::IntView>(home, in);
46 ViewArray<ConstIntView>
47 make_view_array(Space& home,
const IntArgs& in) {
48 ViewArray<Int::ConstIntView> res(home, in.size());
49 for (
int i=0;
i<in.
size();
i++) {
51 res[
i] = Int::ConstIntView(in[
i]);
57 template<
class In>
class ViewType;
60 class ViewType<IntArgs> {
62 typedef Int::ConstIntView Result;
66 class ViewType<IntVarArgs> {
68 typedef Int::IntView Result;
71 template<
class Machine,
class Processing,
class Usage>
73 post_cumulatives(Home home,
const Machine& m,
74 const IntVarArgs& s,
const Processing&
p,
75 const IntVarArgs& e,
const Usage&
u,
76 const IntArgs&
c,
bool at_most,
78 if (m.size() != s.size() ||
79 s.size() != p.size() ||
80 p.size() != e.size() ||
82 throw Int::ArgumentSizeMismatch(
"Int::cumulatives");
85 ViewArray<typename ViewType<Machine>::Result>
86 vm = make_view_array(home, m);
87 ViewArray<typename ViewType<Processing>::Result>
88 vp = make_view_array(home, p);
89 ViewArray<typename ViewType<Usage>::Result>
90 vu = make_view_array(home, u);
92 vs = make_view_array(home, s),
93 ve = make_view_array(home, e);
95 SharedArray<int> c_s(c.size());
101 typename ViewType<Machine>::Result,
102 typename ViewType<Processing>::Result,
103 typename ViewType<Usage>::Result,
104 IntView>::
post(home, vm,vs,vp,ve,vu,c_s,at_most)));
113 const IntArgs& c,
bool at_most,
115 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
122 const IntArgs& c,
bool at_most,
124 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
131 const IntArgs& c,
bool at_most,
133 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
140 const IntArgs& c,
bool at_most,
142 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
149 const IntArgs& c,
bool at_most,
151 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
158 const IntArgs& c,
bool at_most,
160 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
167 const IntArgs& c,
bool at_most,
169 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
176 const IntArgs& c,
bool at_most,
178 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
int size(void) const
Return size of array (number of elements)
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Gecode::IntArgs i({1, 2, 3, 4})
Passing integer variables.
Passing integer arguments.
union Gecode::@593::NNF::@62 u
Union depending on nodetype t.
IntPropLevel
Propagation levels for integer propagators.
Gecode toplevel namespace
#define GECODE_POST
Check for failure in a constraint post function.
void check(int n, const char *l)
Check whether n is in range, otherwise throw out of limits with information l.
Home class for posting propagators
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
void cumulatives(Home home, const IntVarArgs &m, const IntVarArgs &s, const IntVarArgs &p, const IntVarArgs &e, const IntVarArgs &u, const IntArgs &c, bool at_most, IntPropLevel cl)
Post propagators for the cumulatives constraint.