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)));
115 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
124 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
133 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
142 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
151 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
160 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
169 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
178 post_cumulatives(home, m, s,
p, e,
u,
c, at_most, cl);
union Gecode::@603::NNF::@65 u
Union depending on nodetype t.
int p
Number of positive literals for node type.
int size(void) const
Return size of array (number of elements)
FloatNum size(void) const
Return size of float value (distance between maximum and minimum)
Home class for posting propagators
Passing integer arguments.
Passing integer variables.
#define GECODE_POST
Check for failure in a constraint post function.
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
IntPropLevel
Propagation levels for integer propagators.
void check(int n, const char *l)
Check whether n is in range, otherwise throw out of limits with information l.
Gecode toplevel namespace
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 ipl=IPL_DEF)
Post propagators for the cumulatives constraint.
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i({1, 2, 3, 4})