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());
100 for (
int i=c.
size();
i--;)
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)));
117 const IntArgs& c,
bool at_most,
119 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
126 const IntArgs& c,
bool at_most,
128 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
135 const IntArgs& c,
bool at_most,
137 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
144 const IntArgs& c,
bool at_most,
146 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
153 const IntArgs& c,
bool at_most,
155 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
162 const IntArgs& c,
bool at_most,
164 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
171 const IntArgs& c,
bool at_most,
173 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
180 const IntArgs& c,
bool at_most,
182 post_cumulatives(home, m, s, p, e, u, c, at_most, cl);
IntConLevel
Consistency levels for integer propagators.
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
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(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::@518::NNF::@57 u
Union depending on nodetype t.
Gecode toplevel namespace
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.