51 using namespace Gecode::Int;
52 using namespace Gecode::Int::Cumulative;
57 for (
int i=p.
size();
i--; ) {
68 int minU = INT_MAX;
int minU2 = INT_MAX;
int maxU = INT_MIN;
69 for (
int i=u.
size();
i--;) {
73 }
else if (u[
i] < minU2)
79 (minU > c.max()/2) || (minU2 > c.max()/2 && minU+minU2>c.max());
82 unary(home,t,s,p,icl);
90 for (
unsigned int i=u.
size();
i--;)
91 if (u[
i]>0) nonOptionals++;
97 tasks[cur++].init(s[
i],p[i],u[i]);
102 for (
int i=s.
size();
i--;)
104 tasks[cur++].init(t[
i],s[i],p[i],u[i]);
132 using namespace Gecode::Int;
133 using namespace Gecode::Int::Cumulative;
138 for (
int i=p.
size();
i--; ) {
147 if (home.
failed())
return;
149 bool allMandatory =
true;
150 for (
int i=m.
size();
i--;) {
152 allMandatory =
false;
160 for (
int i=t.
size();
i--;)
164 int nonOptionals = 0;
165 for (
unsigned int i=u.
size();
i--;)
166 if (u[
i]>0) nonOptionals++;
172 tasks[cur++].init(s[
i],p[i],u[i],m[i]);
177 for (
int i=s.
size();
i--;)
179 tasks[cur++].init(t[
i],s[i],p[i],u[i],m[i]);
206 using namespace Gecode::Int;
207 using namespace Gecode::Int::Cumulative;
211 for (
int i=p.
size();
i--; ) {
220 if (home.
failed())
return;
222 int minU = INT_MAX;
int minU2 = INT_MAX;
int maxU = INT_MIN;
223 for (
int i=u.
size();
i--;) {
227 }
else if (u[
i] < minU2)
233 (minU > c.max()/2) || (minU2 > c.max()/2 && minU+minU2>c.max());
238 int nonOptionals = 0;
239 for (
unsigned int i=u.
size();
i--;)
240 if (u[
i]>0) nonOptionals++;
245 t[cur++].init(s[
i],p[i],u[i]);
269 using namespace Gecode::Int;
270 using namespace Gecode::Int::Cumulative;
275 for (
int i=p.
size();
i--; ) {
284 if (home.
failed())
return;
286 bool allMandatory =
true;
287 for (
int i=m.
size();
i--;) {
289 allMandatory =
false;
296 int nonOptionals = 0;
297 for (
unsigned int i=u.
size();
i--;)
298 if (u[
i]>0) nonOptionals++;
303 t[cur++].init(s[
i],p[i],u[i],m[i]);
328 using namespace Gecode::Int;
329 using namespace Gecode::Int::Cumulative;
334 for (
int i=p.
size();
i--; ) {
337 for (
int i=p.
size();
i--; ) {
345 if (home.
failed())
return;
348 for (
int i=p.
size();
i--;) {
356 for (
int i=p.
size();
i--;)
360 int nonOptionals = 0;
361 for (
unsigned int i=u.
size();
i--;)
362 if (u[
i]>0) nonOptionals++;
367 t[cur++].init(s[
i],p[i],e[i],u[i]);
394 using namespace Gecode::Int;
395 using namespace Gecode::Int::Cumulative;
399 for (
int i=p.
size();
i--; ) {
403 for (
int i=p.
size();
i--; ) {
411 if (home.
failed())
return;
413 bool allMandatory =
true;
414 for (
int i=m.
size();
i--;) {
416 allMandatory =
false;
423 int nonOptionals = 0;
424 for (
unsigned int i=u.
size();
i--;)
425 if (u[
i]>0) nonOptionals++;
428 for (
int i=s.
size();
i--; )
430 t[cur++].init(s[
i],p[i],e[i],u[i],m[i]);