46 make_view_array(Space& home,
const IntVarArgs& in) {
47 return ViewArray<Int::IntView>(home, in);
50 ViewArray<ConstIntView>
51 make_view_array(Space& home,
const IntArgs& in) {
52 ViewArray<Int::ConstIntView> res(home, in.size());
53 for (
int i = in.
size();
i--; ) {
55 res[
i] = Int::ConstIntView(in[
i]);
61 template<
class In>
class ViewType;
64 class ViewType<IntArgs> {
66 typedef Int::ConstIntView Result;
70 class ViewType<IntVarArgs> {
72 typedef Int::IntView Result;
75 template<
class Machine,
class Processing,
class Usage>
77 post_cumulatives(Home home,
const Machine& m,
78 const IntVarArgs& s,
const Processing&
p,
79 const IntVarArgs& e,
const Usage&
u,
80 const IntArgs&
c,
bool at_most,
82 if (m.size() != s.size() ||
83 s.size() !=
p.size() ||
84 p.size() != e.size() ||
86 throw Int::ArgumentSizeMismatch(
"Int::cumulatives");
87 if (home.failed())
return;
89 ViewArray<typename ViewType<Machine>::Result>
90 vm = make_view_array(home, m);
91 ViewArray<typename ViewType<Processing>::Result>
92 vp = make_view_array(home,
p);
93 ViewArray<typename ViewType<Usage>::Result>
94 vu = make_view_array(home,
u);
96 vs = make_view_array(home, s),
97 ve = make_view_array(home, e);
99 SharedArray<int> c_s(
c.
size());
105 typename ViewType<Machine>::Result,
106 typename ViewType<Processing>::Result,
107 typename ViewType<Usage>::Result,
108 IntView>::
post(home, vm,vs,vp,ve,vu,c_s,at_most)));
119 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
128 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
137 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
146 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
155 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
164 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
173 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
182 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
IntConLevel
Consistency levels for integer propagators.
int size(void) const
Return size of array (number of elements)
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
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, IntConLevel cl)
Post propagators for the cumulatives constraint.
Passing integer variables.
Passing integer arguments.
union Gecode::@511::NNF::@54 u
Union depending on nodetype t.
Gecode toplevel namespace
FloatNum size(void) const
Return size of float value (distance between maximum and minimum)
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.