Generated on Sat Feb 7 2015 02:01:21 for Gecode by doxygen 1.8.9.1
cumulative.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2009
8  *
9  * Last modified:
10  * $Date: 2013-09-17 13:54:20 +0200 (Tue, 17 Sep 2013) $ by $Author: tack $
11  * $Revision: 14006 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #include "test/int.hh"
39 
40 #include <gecode/minimodel.hh>
41 
42 namespace Test { namespace Int {
43 
45  namespace Cumulative {
46 
52  class ManFixPCumulative : public Test {
54  protected:
56  int c;
62  static int st(int c,
63  const Gecode::IntArgs& p, const Gecode::IntArgs& u) {
64  double e = 0;
65  for (int i=p.size(); i--; )
66  e += static_cast<double>(p[i])*u[i];
67  return e / std::max(1,std::abs(c));
68  }
70  int o;
71  public:
74  const Gecode::IntArgs& p0,
75  const Gecode::IntArgs& u0,
76  int o0)
77  : Test("Cumulative::Man::Fix::"+str(o0)+"::"+
78  str(c0)+"::"+str(p0)+"::"+str(u0),
79  (c0 >= 0) ? p0.size():p0.size()+1,0,st(c0,p0,u0)),
80  c(c0), p(p0), u(u0), o(o0) {
81  testsearch = false;
82  testfix = false;
83  contest = CTL_NONE;
84  }
86  virtual Assignment* assignment(void) const {
87  return new RandomAssignment(arity,dom,500);
88  }
90  virtual bool solution(const Assignment& x) const {
91  int cmax = (c >= 0) ? c : x[x.size()-1];
92  int n = (c >= 0) ? x.size() : x.size()-1;
93 
94  if (c < 0 && x[n] > -c)
95  return false;
96 
97  // Compute maximal time
98  int t = 0;
99  for (int i=0; i<n; i++)
100  t = std::max(t,x[i]+std::max(1,p[i]));
101  // Compute resource usage (including at start times)
102  int* used = new int[t];
103  for (int i=0; i<t; i++)
104  used[i] = 0;
105  for (int i=0; i<n; i++)
106  for (int t=0; t<p[i]; t++)
107  used[x[i]+t] += u[i];
108  // Check resource usage
109  for (int i=0; i<t; i++)
110  if (used[i] > cmax) {
111  delete [] used;
112  return false;
113  }
114  // Compute resource usage (only internal)
115  for (int i=0; i<t; i++)
116  used[i] = 0;
117  for (int i=0; i<n; i++) {
118  for (int t=1; t<p[i]; t++) {
119  used[x[i]+t] += u[i];
120  }
121  }
122  // Check resource usage at start times
123  for (int i=0; i<n; i++)
124  if (used[x[i]]+u[i] > cmax) {
125  delete [] used;
126  return false;
127  }
128  delete [] used;
129  return true;
130  }
132  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
133  int n = (c >= 0) ? x.size() : x.size()-1;
135  if (o==0) {
136  xx=x.slice(0,1,n);
137  } else {
138  xx=Gecode::IntVarArgs(n);
139  for (int i=n; i--;)
140  xx[i]=Gecode::expr(home,x[i]+o,Gecode::ICL_DOM);
141  }
142  if (c >= 0) {
143  Gecode::cumulative(home, c, xx, p, u);
144  } else {
145  Gecode::rel(home, x[n] <= -c);
146  Gecode::cumulative(home, x[n], xx, p, u);
147  }
148  }
149  };
150 
151 
153  class OptFixPCumulative : public Test {
154  protected:
156  int c;
162  int l;
164  int o;
166  static int st(int c,
167  const Gecode::IntArgs& p, const Gecode::IntArgs& u) {
168  double e = 0;
169  for (int i=p.size(); i--; )
170  e += static_cast<double>(p[i])*u[i];
171  return e / std::max(1,std::abs(c));
172  }
173  public:
176  const Gecode::IntArgs& p0,
177  const Gecode::IntArgs& u0,
178  int o0)
179  : Test("Cumulative::Opt::Fix::"+str(o0)+"::"+
180  str(c0)+"::"+str(p0)+"::"+str(u0),
181  (c0 >= 0) ? 2*p0.size() : 2*p0.size()+1,0,st(c0,p0,u0)),
182  c(c0), p(p0), u(u0), l(st(c,p,u)/2), o(o0) {
183  testsearch = false;
184  testfix = false;
185  contest = CTL_NONE;
186  }
188  virtual Assignment* assignment(void) const {
189  return new RandomAssignment(arity,dom,500);
190  }
192  virtual bool solution(const Assignment& x) const {
193  int nn = (c >= 0) ? x.size() : x.size()-1;
194  int cmax = (c >= 0) ? c : x[nn];
195 
196  if (c < 0 && x[nn] > -c)
197  return false;
198 
199  int n = nn / 2;
200  // Compute maximal time
201  int t = 0;
202  for (int i=0; i<n; i++)
203  t = std::max(t,x[i]+std::max(1,p[i]));
204  // Compute resource usage (including at start times)
205  int* used = new int[t];
206  for (int i=0; i<t; i++)
207  used[i] = 0;
208  for (int i=0; i<n; i++)
209  if (x[n+i] > l)
210  for (int t=0; t<p[i]; t++)
211  used[x[i]+t] += u[i];
212  // Check resource usage
213  for (int i=0; i<t; i++) {
214  if (used[i] > cmax) {
215  delete [] used;
216  return false;
217  }
218  }
219  // Compute resource usage (only internal)
220  for (int i=0; i<t; i++)
221  used[i] = 0;
222  for (int i=0; i<n; i++)
223  if (x[n+i] > l) {
224  for (int t=1; t<p[i]; t++)
225  used[x[i]+t] += u[i];
226  }
227  // Check resource usage at start times
228  for (int i=0; i<n; i++)
229  if (x[n+i] > l)
230  if (used[x[i]]+u[i] > cmax) {
231  delete [] used;
232  return false;
233  }
234  delete [] used;
235  return true;
236  }
238  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
239  int nn=(c >= 0) ? x.size() : x.size()-1;
240  int n=nn / 2;
241  Gecode::IntVarArgs s(n);
242  Gecode::BoolVarArgs m(n);
243 
244  for (int i=0; i<n; i++) {
245  s[i]=(c >= 0) ? x[i] : Gecode::expr(home,x[i]+o,Gecode::ICL_DOM);
246  m[i]=Gecode::expr(home, x[n+i] > l);
247  }
248 
249  if (c >= 0) {
250  Gecode::cumulative(home, c, s, p, u, m);
251  } else {
252  Gecode::rel(home, x[nn] <= -c);
253  Gecode::cumulative(home, x[nn], s, p, u, m);
254  }
255  }
256  };
257 
259  class ManFlexCumulative : public Test {
260  protected:
262  int c;
264  int _minP;
266  int _maxP;
270  static int st(int c, int maxP, const Gecode::IntArgs& u) {
271  double e = 0;
272  for (int i=u.size(); i--; )
273  e += static_cast<double>(maxP)*u[i];
274  return e / std::max(1,std::abs(c));
275  }
277  int o;
278  public:
280  ManFlexCumulative(int c0, int minP, int maxP,
281  const Gecode::IntArgs& u0,
282  int o0)
283  : Test("Cumulative::Man::Flex::"+str(o0)+"::"+
284  str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0),
285  (c0 >= 0) ? 2*u0.size() : 2*u0.size()+1,
286  0,std::max(maxP,st(c0,maxP,u0))),
287  c(c0), _minP(minP), _maxP(maxP), u(u0), o(o0) {
288  testsearch = false;
289  testfix = false;
290  contest = CTL_NONE;
291  }
293  virtual Assignment* assignment(void) const {
294  return new RandomMixAssignment((c >= 0) ? arity/2 : arity/2+1,
295  dom,arity/2,
296  Gecode::IntSet(_minP,_maxP),500);
297  }
299  virtual bool solution(const Assignment& x) const {
300  int nn = (c >= 0) ? x.size() : x.size()-1;
301  int n = nn/2;
302  int cmax = (c >= 0) ? c : x[n];
303  int pstart = (c >= 0) ? n : n+1;
304 
305  if (c < 0 && cmax > -c)
306  return false;
307 
308  // Compute maximal time
309  int t = 0;
310  for (int i=0; i<n; i++) {
311  t = std::max(t,x[i]+std::max(1,x[pstart+i]));
312  }
313  // Compute resource usage (including at start times)
314  int* used = new int[t];
315  for (int i=0; i<t; i++)
316  used[i] = 0;
317  for (int i=0; i<n; i++)
318  for (int t=0; t<x[pstart+i]; t++)
319  used[x[i]+t] += u[i];
320  // Check resource usage
321  for (int i=0; i<t; i++)
322  if (used[i] > cmax) {
323  delete [] used;
324  return false;
325  }
326  // Compute resource usage (only internal)
327  for (int i=0; i<t; i++)
328  used[i] = 0;
329  for (int i=0; i<n; i++) {
330  for (int t=1; t<x[pstart+i]; t++)
331  used[x[i]+t] += u[i];
332  }
333  // Check resource usage at start times
334  for (int i=0; i<n; i++)
335  if (used[x[i]]+u[i] > cmax) {
336  delete [] used;
337  return false;
338  }
339  delete [] used;
340  return true;
341  }
343  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
344  int nn = (c >= 0) ? x.size() : x.size()-1;
345  int n = nn/2;
346  int pstart = (c >= 0) ? n : n+1;
347  Gecode::IntVarArgs s(n);
348  Gecode::IntVarArgs px(x.slice(pstart,1,n));
349  Gecode::IntVarArgs e(home,n,
352  for (int i=s.size(); i--;) {
353  s[i] = expr(home, o+x[i], Gecode::ICL_DOM);
354  rel(home, s[i]+px[i] == e[i]);
355  rel(home, _minP <= px[i]);
356  rel(home, _maxP >= px[i]);
357  }
358  if (c >= 0) {
359  Gecode::cumulative(home, c, s, px, e, u);
360  } else {
361  rel(home, x[n] <= -c);
362  Gecode::cumulative(home, x[n], s, px, e, u);
363  }
364  }
365  };
366 
368  class OptFlexCumulative : public Test {
369  protected:
371  int c;
373  int _minP;
375  int _maxP;
379  int l;
381  int o;
383  static int st(int c, int maxP, const Gecode::IntArgs& u) {
384  double e = 0;
385  for (int i=u.size(); i--; )
386  e += static_cast<double>(maxP)*u[i];
387  return e / std::max(1,std::abs(c));
388  }
389  public:
391  OptFlexCumulative(int c0, int minP, int maxP,
392  const Gecode::IntArgs& u0,
393  int o0)
394  : Test("Cumulative::Opt::Flex::"+str(o0)+"::"+
395  str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0),
396  (c0 >= 0) ? 3*u0.size() : 3*u0.size()+1,
397  0,std::max(maxP,st(c0,maxP,u0))),
398  c(c0), _minP(minP), _maxP(maxP), u(u0),
399  l(std::max(maxP,st(c0,maxP,u0))/2), o(o0) {
400  testsearch = false;
401  testfix = false;
402  contest = CTL_NONE;
403  }
405  virtual Assignment* assignment(void) const {
406  return new RandomMixAssignment((c >= 0) ? 2*(arity/3) : 2*(arity/3)+1,
407  dom,arity/3,
408  Gecode::IntSet(_minP,_maxP),500);
409  }
411  virtual bool solution(const Assignment& x) const {
412  int nn = (c >= 0) ? x.size() : x.size()-1;
413  int n = nn / 3;
414  int cmax = (c >= 0) ? c : x[2*n];
415  int pstart = (c >= 0) ? 2*n : 2*n+1;
416 
417  if (c < 0 && cmax > -c)
418  return false;
419 
420  // Compute maximal time
421  int t = 0;
422  for (int i=0; i<n; i++)
423  t = std::max(t,x[i]+std::max(1,x[pstart+i]));
424  // Compute resource usage (including at start times)
425  int* used = new int[t];
426  for (int i=0; i<t; i++)
427  used[i] = 0;
428  for (int i=0; i<n; i++)
429  if (x[n+i] > l)
430  for (int t=0; t<x[pstart+i]; t++)
431  used[x[i]+t] += u[i];
432  // Check resource usage
433  for (int i=0; i<t; i++)
434  if (used[i] > cmax) {
435  delete [] used;
436  return false;
437  }
438  // Compute resource usage (only internal)
439  for (int i=0; i<t; i++)
440  used[i] = 0;
441  for (int i=0; i<n; i++)
442  if (x[n+i] > l)
443  for (int t=1; t<x[pstart+i]; t++)
444  used[x[i]+t] += u[i];
445  // Check resource usage at start times
446  for (int i=0; i<n; i++)
447  if (x[n+i] > l && used[x[i]]+u[i] > cmax) {
448  delete [] used;
449  return false;
450  }
451  delete [] used;
452  return true;
453  }
455  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
456  int nn = (c >= 0) ? x.size() : x.size()-1;
457  int n=nn / 3;
458  int pstart= (c >= 0) ? 2*n : 2*n+1;
459 
460  Gecode::IntVarArgs s(n);
461  Gecode::IntVarArgs px(n);
462  Gecode::IntVarArgs e(home,n,
465  for (int i=n; i--;) {
466  s[i] = expr(home, o+x[i]);
467  px[i] = x[pstart+i];
468  rel(home, s[i]+px[i] == e[i]);
469  rel(home, _minP <= px[i]);
470  rel(home, _maxP >= px[i]);
471  }
472  Gecode::BoolVarArgs m(n);
473  for (int i=0; i<n; i++)
474  m[i]=Gecode::expr(home, (x[n+i] > l));
475  if (c >= 0) {
476  Gecode::cumulative(home, c, s, px, e, u, m);
477  } else {
478  Gecode::rel(home, x[2*n] <= -c);
479  Gecode::cumulative(home, x[2*n], s, px, e, u, m);
480  }
481  }
482  };
483 
485  class Create {
486  public:
488  Create(void) {
489  using namespace Gecode;
490  IntArgs p1(4, 1,1,1,1);
491  IntArgs p2(4, 2,2,2,2);
492  IntArgs p3(4, 4,3,3,5);
493  IntArgs p4(4, 4,0,3,5);
494 
495  IntArgs u1(4, 1,1,1,1);
496  IntArgs u2(4, 2,2,2,2);
497  IntArgs u3(4, 2,3,4,5);
498  IntArgs u4(4, 2,3,0,5);
499 
500  // Regression test: check correct detection of disjunctive case
501  IntArgs p5(3, 1,1,1);
502  IntArgs u5(3, 1,3,2);
503  (void) new ManFixPCumulative(3,p5,u5,0);
504 
505  for (int c=-7; c<8; c++) {
506  int off = 0;
507  for (int coff=0; coff<2; coff++) {
508  (void) new ManFixPCumulative(c,p1,u1,off);
509  (void) new ManFixPCumulative(c,p1,u2,off);
510  (void) new ManFixPCumulative(c,p1,u3,off);
511  (void) new ManFixPCumulative(c,p1,u4,off);
512  (void) new ManFixPCumulative(c,p2,u1,off);
513  (void) new ManFixPCumulative(c,p2,u2,off);
514  (void) new ManFixPCumulative(c,p2,u3,off);
515  (void) new ManFixPCumulative(c,p2,u4,off);
516  (void) new ManFixPCumulative(c,p3,u1,off);
517  (void) new ManFixPCumulative(c,p3,u2,off);
518  (void) new ManFixPCumulative(c,p3,u3,off);
519  (void) new ManFixPCumulative(c,p3,u4,off);
520  (void) new ManFixPCumulative(c,p4,u1,off);
521  (void) new ManFixPCumulative(c,p4,u2,off);
522  (void) new ManFixPCumulative(c,p4,u3,off);
523  (void) new ManFixPCumulative(c,p4,u4,off);
524 
525  (void) new ManFlexCumulative(c,0,1,u1,off);
526  (void) new ManFlexCumulative(c,0,1,u2,off);
527  (void) new ManFlexCumulative(c,0,1,u3,off);
528  (void) new ManFlexCumulative(c,0,1,u4,off);
529  (void) new ManFlexCumulative(c,0,2,u1,off);
530  (void) new ManFlexCumulative(c,0,2,u2,off);
531  (void) new ManFlexCumulative(c,0,2,u3,off);
532  (void) new ManFlexCumulative(c,0,2,u4,off);
533  (void) new ManFlexCumulative(c,3,5,u1,off);
534  (void) new ManFlexCumulative(c,3,5,u2,off);
535  (void) new ManFlexCumulative(c,3,5,u3,off);
536  (void) new ManFlexCumulative(c,3,5,u4,off);
537 
538  (void) new OptFixPCumulative(c,p1,u1,off);
539  (void) new OptFixPCumulative(c,p1,u2,off);
540  (void) new OptFixPCumulative(c,p1,u3,off);
541  (void) new OptFixPCumulative(c,p1,u4,off);
542  (void) new OptFixPCumulative(c,p2,u1,off);
543  (void) new OptFixPCumulative(c,p2,u2,off);
544  (void) new OptFixPCumulative(c,p2,u3,off);
545  (void) new OptFixPCumulative(c,p2,u4,off);
546  (void) new OptFixPCumulative(c,p3,u1,off);
547  (void) new OptFixPCumulative(c,p3,u2,off);
548  (void) new OptFixPCumulative(c,p3,u3,off);
549  (void) new OptFixPCumulative(c,p3,u4,off);
550  (void) new OptFixPCumulative(c,p4,u1,off);
551  (void) new OptFixPCumulative(c,p4,u2,off);
552  (void) new OptFixPCumulative(c,p4,u3,off);
553  (void) new OptFixPCumulative(c,p4,u4,off);
554 
555  (void) new OptFlexCumulative(c,0,1,u1,off);
556  (void) new OptFlexCumulative(c,0,1,u2,off);
557  (void) new OptFlexCumulative(c,0,1,u3,off);
558  (void) new OptFlexCumulative(c,0,1,u4,off);
559  (void) new OptFlexCumulative(c,0,2,u1,off);
560  (void) new OptFlexCumulative(c,0,2,u2,off);
561  (void) new OptFlexCumulative(c,0,2,u3,off);
562  (void) new OptFlexCumulative(c,0,2,u4,off);
563  (void) new OptFlexCumulative(c,3,5,u1,off);
564  (void) new OptFlexCumulative(c,3,5,u2,off);
565  (void) new OptFlexCumulative(c,3,5,u3,off);
566  (void) new OptFlexCumulative(c,3,5,u4,off);
567 
569  }
570  }
571  }
572  };
573 
576 
577  }
578 }}
579 
580 // STATISTICS: test-int
static int st(int c, const Gecode::IntArgs &p, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Definition: cumulative.cpp:166
virtual bool solution(const Assignment &x) const
Test whether x is solution.
Definition: cumulative.cpp:411
void cumulative(Home home, Cap c, const TaskTypeArgs &t, const IntVarArgs &s, const IntArgs &p, const IntArgs &u, IntConLevel icl)
Definition: cumulative.cpp:48
NodeType t
Type of node.
Definition: bool-expr.cpp:234
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: cumulative.cpp:343
virtual bool solution(const Assignment &x) const
Test whether x is solution.
Definition: cumulative.cpp:299
const FloatNum max
Largest allowed float value.
Definition: float.hh:831
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1662
virtual Assignment * assignment(void) const
Create and register initial assignment.
Definition: cumulative.cpp:188
static int st(int c, int maxP, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Definition: cumulative.cpp:383
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:49
Gecode::IntArgs u
The resource usage.
Definition: cumulative.cpp:268
Gecode::IntArgs u
The resource usage.
Definition: cumulative.cpp:160
int _minP
Minimum processing time.
Definition: cumulative.cpp:373
int _minP
Minimum processing time.
Definition: cumulative.cpp:264
Gecode::IntSet dom
Domain of variables.
Definition: int.hh:220
Integer variable array.
Definition: int.hh:741
ManFixPCumulative(int c0, const Gecode::IntArgs &p0, const Gecode::IntArgs &u0, int o0)
Create and register test.
Definition: cumulative.cpp:73
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: cumulative.cpp:455
ConTestLevel contest
Whether to test for certain consistency.
Definition: int.hh:228
const int max
Largest allowed integer value.
Definition: int.hh:113
Computation spaces.
Definition: core.hpp:1362
Generate random selection of assignments.
Definition: int.hh:100
const int min
Smallest allowed integer value.
Definition: int.hh:115
static int st(int c, const Gecode::IntArgs &p, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Definition: cumulative.cpp:62
int _maxP
Maximum processing time.
Definition: cumulative.cpp:266
int l
Limit for optional tasks.
Definition: cumulative.cpp:162
static std::string str(Gecode::ExtensionalPropKind epk)
Map extensional propagation kind to string.
Definition: int.hpp:212
Gecode::IntArgs p2(4, 4, 3, 3, 5)
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
No consistency-test.
Definition: int.hh:144
Generate random selection of assignments.
Definition: int.hh:120
virtual bool solution(const Assignment &x) const
Test whether x is solution.
Definition: cumulative.cpp:192
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: cumulative.cpp:238
unsigned int size(I &i)
Size of all ranges of range iterator i.
virtual Assignment * assignment(void) const
Create and register initial assignment.
Definition: cumulative.cpp:405
int _maxP
Maximum processing time.
Definition: cumulative.cpp:375
virtual Assignment * assignment(void) const
Create and register initial assignment.
Definition: cumulative.cpp:86
Integer sets.
Definition: int.hh:171
Help class to create and register tests.
Definition: cumulative.cpp:485
ArrayTraits< VarArgArray< Var > >::ArgsType slice(int start, int inc=1, int n=-1)
Definition: array.hpp:1005
Test for cumulative constraint with optional tasks.
Definition: cumulative.cpp:153
Passing integer variables.
Definition: int.hh:636
OptFlexCumulative(int c0, int minP, int maxP, const Gecode::IntArgs &u0, int o0)
Create and register test.
Definition: cumulative.cpp:391
Passing integer arguments.
Definition: int.hh:607
Passing Boolean variables.
Definition: int.hh:690
bool testfix
Whether to perform fixpoint test.
Definition: int.hh:232
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: cumulative.cpp:132
General test support.
Definition: afc.cpp:43
Gecode::IntArgs u
The resource usage.
Definition: cumulative.cpp:60
Test for cumulative constraint with mandatory tasks.
Definition: cumulative.cpp:53
BoolVar expr(Home home, const BoolExpr &e, IntConLevel icl)
Post Boolean expression and return its value.
Definition: bool-expr.cpp:632
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
bool testsearch
Whether to perform search test.
Definition: int.hh:230
virtual Assignment * assignment(void) const
Create and register initial assignment.
Definition: cumulative.cpp:293
Base class for assignments
Definition: int.hh:63
static int st(int c, int maxP, const Gecode::IntArgs &u)
Get a reasonable maximal start time.
Definition: cumulative.cpp:270
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:47
Gecode::IntArgs p
The processing times.
Definition: cumulative.cpp:58
OptFixPCumulative(int c0, const Gecode::IntArgs &p0, const Gecode::IntArgs &u0, int o0)
Create and register test.
Definition: cumulative.cpp:175
Test for cumulative constraint with optional flexible tasks.
Definition: cumulative.cpp:368
Gecode toplevel namespace
ManFlexCumulative(int c0, int minP, int maxP, const Gecode::IntArgs &u0, int o0)
Create and register test.
Definition: cumulative.cpp:280
Gecode::IntArgs u
The resource usage.
Definition: cumulative.cpp:377
Create(void)
Perform creation and registration.
Definition: cumulative.cpp:488
int arity
Number of variables.
Definition: int.hh:218
Gecode::IntArgs p3(6, 4, 2, 9, 3, 7, 5)
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:985
Test for cumulative constraint with flexible mandatory tasks.
Definition: cumulative.cpp:259
Gecode::IntArgs p1(4, 2, 2, 2, 2)
int size(void) const
Return number of variables.
Definition: int.hpp:50
Domain propagation or consistency.
Definition: int.hh:940
int l
Limit for optional tasks.
Definition: cumulative.cpp:379
virtual bool solution(const Assignment &x) const
Test whether x is solution.
Definition: cumulative.cpp:90
Gecode::IntArgs p
The processing times.
Definition: cumulative.cpp:158