File: cumulative.cpp

package info (click to toggle)
gecode-snapshot 6.2.0%2Bgit20240207-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 35,308 kB
  • sloc: cpp: 475,516; perl: 2,077; makefile: 1,816; sh: 198
file content (585 lines) | stat: -rwxr-xr-x 21,120 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
 *  Main authors:
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Copyright:
 *     Christian Schulte, 2009
 *
 *  This file is part of Gecode, the generic constraint
 *  development environment:
 *     http://www.gecode.org
 *
 *  Permission is hereby granted, free of charge, to any person obtaining
 *  a copy of this software and associated documentation files (the
 *  "Software"), to deal in the Software without restriction, including
 *  without limitation the rights to use, copy, modify, merge, publish,
 *  distribute, sublicense, and/or sell copies of the Software, and to
 *  permit persons to whom the Software is furnished to do so, subject to
 *  the following conditions:
 *
 *  The above copyright notice and this permission notice shall be
 *  included in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */

#include "test/int.hh"

#include <gecode/minimodel.hh>

namespace Test { namespace Int {

  /// Tests for cumulative scheduling constraints
  namespace Cumulative {

    /**
     * \defgroup TaskTestIntCumulative Cumulative scheduling constraints
     * \ingroup TaskTestInt
     */
    //@{
    /// Test for cumulative constraint with mandatory tasks
    class ManFixPCumulative : public Test {
    protected:
      /// Capacity of resource
      int c;
      /// The processing times
      Gecode::IntArgs p;
      /// The resource usage
      Gecode::IntArgs u;
      /// Get a reasonable maximal start time
      static int st(int c,
                    const Gecode::IntArgs& p, const Gecode::IntArgs& u) {
        double e = 0;
        for (int i=p.size(); i--; )
          e += static_cast<double>(p[i])*u[i];
        return e / std::max(1,std::abs(c));
      }
      /// Offset
      int o;
    public:
      /// Create and register test
      ManFixPCumulative(int c0,
                        const Gecode::IntArgs& p0,
                        const Gecode::IntArgs& u0,
                        int o0,
                        Gecode::IntPropLevel ipl0)
        : Test("Cumulative::Man::Fix::"+str(o0)+"::"+
               str(c0)+"::"+str(p0)+"::"+str(u0)+"::"+str(ipl0),
               (c0 >= 0) ? p0.size():p0.size()+1,0,st(c0,p0,u0),false,ipl0),
          c(c0), p(p0), u(u0), o(o0) {
        testsearch = false;
        testfix = false;
        contest = CTL_NONE;
      }
      /// Create and register initial assignment
      virtual Assignment* assignment(void) const {
        return new RandomAssignment(arity, dom, 500, _rand);
      }
      /// Test whether \a x is solution
      virtual bool solution(const Assignment& x) const {
        int cmax = (c >= 0) ? c : x[x.size()-1];
        int n = (c >= 0) ? x.size() : x.size()-1;

        if (c < 0 && x[n] > -c)
          return false;

        // Compute maximal time
        int t = 0;
        for (int i=0; i<n; i++)
          t = std::max(t,x[i]+std::max(1,p[i]));
        // Compute resource usage (including at start times)
        int* used = new int[t];
        for (int i=0; i<t; i++)
          used[i] = 0;
        for (int i=0; i<n; i++)
          for (int t=0; t<p[i]; t++)
            used[x[i]+t] += u[i];
        // Check resource usage
        for (int i=0; i<t; i++)
          if (used[i] > cmax) {
            delete [] used;
            return false;
          }
        // Compute resource usage (only internal)
        for (int i=0; i<t; i++)
          used[i] = 0;
        for (int i=0; i<n; i++) {
          for (int t=1; t<p[i]; t++) {
            used[x[i]+t] += u[i];
          }
        }
        // Check resource usage at start times
        for (int i=0; i<n; i++)
          if (used[x[i]]+u[i] > cmax) {
            delete [] used;
            return false;
          }
        delete [] used;
        return true;
      }
      /// Post constraint on \a x
      virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
        int n = (c >= 0) ? x.size() : x.size()-1;
        Gecode::IntVarArgs xx;
        if (o==0) {
          xx=x.slice(0,1,n);
        } else {
          xx=Gecode::IntVarArgs(n);
          for (int i=n; i--;)
            xx[i]=Gecode::expr(home,x[i]+o,Gecode::IPL_DOM);
        }
        if (c >= 0) {
          Gecode::cumulative(home, c, xx, p, u, ipl);
        } else {
          Gecode::rel(home, x[n] <= -c);
          Gecode::cumulative(home, x[n], xx, p, u, ipl);
        }
      }
    };


    /// Test for cumulative constraint with optional tasks
    class OptFixPCumulative : public Test {
    protected:
      /// Capacity of resource
      int c;
      /// The processing times
      Gecode::IntArgs p;
      /// The resource usage
      Gecode::IntArgs u;
      /// Limit for optional tasks
      int l;
      /// Offset
      int o;
      /// Get a reasonable maximal start time
      static int st(int c,
                    const Gecode::IntArgs& p, const Gecode::IntArgs& u) {
        double e = 0;
        for (int i=p.size(); i--; )
          e += static_cast<double>(p[i])*u[i];
        return e / std::max(1,std::abs(c));
      }
    public:
      /// Create and register test
      OptFixPCumulative(int c0,
                        const Gecode::IntArgs& p0,
                        const Gecode::IntArgs& u0,
                        int o0,
                        Gecode::IntPropLevel ipl0)
        : Test("Cumulative::Opt::Fix::"+str(o0)+"::"+
               str(c0)+"::"+str(p0)+"::"+str(u0)+"::"+str(ipl0),
               (c0 >= 0) ? 2*p0.size() : 2*p0.size()+1,0,st(c0,p0,u0),
               false,ipl0),
          c(c0), p(p0), u(u0), l(st(c,p,u)/2), o(o0) {
        testsearch = false;
        testfix = false;
        contest = CTL_NONE;
      }
      /// Create and register initial assignment
      virtual Assignment* assignment(void) const {
        return new RandomAssignment(arity, dom, 500, _rand);
      }
      /// Test whether \a x is solution
      virtual bool solution(const Assignment& x) const {
        int nn = (c >= 0) ? x.size() : x.size()-1;
        int cmax = (c >= 0) ? c : x[nn];

        if (c < 0 && x[nn] > -c)
          return false;

        int n = nn / 2;
        // Compute maximal time
        int t = 0;
        for (int i=0; i<n; i++)
          t = std::max(t,x[i]+std::max(1,p[i]));
        // Compute resource usage (including at start times)
        int* used = new int[t];
        for (int i=0; i<t; i++)
          used[i] = 0;
        for (int i=0; i<n; i++)
          if (x[n+i] > l)
            for (int t=0; t<p[i]; t++)
              used[x[i]+t] += u[i];
        // Check resource usage
        for (int i=0; i<t; i++) {
          if (used[i] > cmax) {
            delete [] used;
            return false;
          }
        }
        // Compute resource usage (only internal)
        for (int i=0; i<t; i++)
          used[i] = 0;
        for (int i=0; i<n; i++)
          if (x[n+i] > l) {
            for (int t=1; t<p[i]; t++)
              used[x[i]+t] += u[i];
          }
        // Check resource usage at start times
        for (int i=0; i<n; i++)
          if (x[n+i] > l)
            if (used[x[i]]+u[i] > cmax) {
              delete [] used;
              return false;
            }
        delete [] used;
        return true;
      }
      /// Post constraint on \a x
      virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
        int nn=(c >= 0) ? x.size() : x.size()-1;
        int n=nn / 2;
        Gecode::IntVarArgs s(n);
        Gecode::BoolVarArgs m(n);

        for (int i=0; i<n; i++) {
          s[i]=(c >= 0) ? x[i] : Gecode::expr(home,x[i]+o,Gecode::IPL_DOM);
          m[i]=Gecode::expr(home, x[n+i] > l);
        }

        if (c >= 0) {
          Gecode::cumulative(home, c, s, p, u, m, ipl);
        } else {
          Gecode::rel(home, x[nn] <= -c);
          Gecode::cumulative(home, x[nn], s, p, u, m, ipl);
        }
      }
    };

    /// Test for cumulative constraint with flexible mandatory tasks
    class ManFlexCumulative : public Test {
    protected:
      /// Capacity of resource
      int c;
      /// Minimum processing time
      int _minP;
      /// Maximum processing time
      int _maxP;
      /// The resource usage
      Gecode::IntArgs u;
      /// Get a reasonable maximal start time
      static int st(int c, int maxP, const Gecode::IntArgs& u) {
        double e = 0;
        for (int i=u.size(); i--; )
          e += static_cast<double>(maxP)*u[i];
        return e / std::max(1,std::abs(c));
      }
      /// Offset
      int o;
    public:
      /// Create and register test
      ManFlexCumulative(int c0, int minP, int maxP,
                        const Gecode::IntArgs& u0,
                        int o0,
                        Gecode::IntPropLevel ipl0)
        : Test("Cumulative::Man::Flex::"+str(o0)+"::"+
               str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0)+
               "::"+str(ipl0),
               (c0 >= 0) ? 2*u0.size() : 2*u0.size()+1,
               0,std::max(maxP,st(c0,maxP,u0)),false,ipl0),
          c(c0), _minP(minP), _maxP(maxP), u(u0), o(o0) {
        testsearch = false;
        testfix = false;
        contest = CTL_NONE;
      }
      /// Create and register initial assignment
      virtual Assignment* assignment(void) const {
        return new RandomMixAssignment((c >= 0) ? arity / 2 : arity / 2 + 1,
                                       dom, arity / 2,
                                       Gecode::IntSet(_minP, _maxP), 500, _rand);
      }
      /// Test whether \a x is solution
      virtual bool solution(const Assignment& x) const {
        int nn = (c >= 0) ? x.size() : x.size()-1;
        int n = nn/2;
        int cmax = (c >= 0) ? c : x[n];
        int pstart = (c >= 0) ? n : n+1;

        if (c < 0 && cmax > -c)
          return false;

        // Compute maximal time
        int t = 0;
        for (int i=0; i<n; i++) {
          t = std::max(t,x[i]+std::max(1,x[pstart+i]));
        }
        // Compute resource usage (including at start times)
        int* used = new int[t];
        for (int i=0; i<t; i++)
          used[i] = 0;
        for (int i=0; i<n; i++)
          for (int t=0; t<x[pstart+i]; t++)
            used[x[i]+t] += u[i];
        // Check resource usage
        for (int i=0; i<t; i++)
          if (used[i] > cmax) {
            delete [] used;
            return false;
          }
        // Compute resource usage (only internal)
        for (int i=0; i<t; i++)
          used[i] = 0;
        for (int i=0; i<n; i++) {
          for (int t=1; t<x[pstart+i]; t++)
            used[x[i]+t] += u[i];
        }
        // Check resource usage at start times
        for (int i=0; i<n; i++)
          if (used[x[i]]+u[i] > cmax) {
            delete [] used;
            return false;
          }
        delete [] used;
        return true;
      }
      /// Post constraint on \a x
      virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
        int nn = (c >= 0) ? x.size() : x.size()-1;
        int n = nn/2;
        int pstart = (c >= 0) ? n : n+1;
        Gecode::IntVarArgs s(n);
        Gecode::IntVarArgs px(x.slice(pstart,1,n));
        Gecode::IntVarArgs e(home,n,
                             Gecode::Int::Limits::min,
                             Gecode::Int::Limits::max);
        for (int i=s.size(); i--;) {
          s[i] = expr(home, o+x[i], Gecode::IPL_DOM);
          rel(home, s[i]+px[i] == e[i]);
          rel(home, _minP <= px[i]);
          rel(home, _maxP >= px[i]);
        }
        if (c >= 0) {
          Gecode::cumulative(home, c, s, px, e, u, ipl);
        } else {
          rel(home, x[n] <= -c);
          Gecode::cumulative(home, x[n], s, px, e, u, ipl);
        }
      }
    };

    /// Test for cumulative constraint with optional flexible tasks
    class OptFlexCumulative : public Test {
    protected:
      /// Capacity of resource
      int c;
      /// Minimum processing time
      int _minP;
      /// Maximum processing time
      int _maxP;
      /// The resource usage
      Gecode::IntArgs u;
      /// Limit for optional tasks
      int l;
      /// Offset
      int o;
      /// Get a reasonable maximal start time
      static int st(int c, int maxP, const Gecode::IntArgs& u) {
        double e = 0;
        for (int i=u.size(); i--; )
          e += static_cast<double>(maxP)*u[i];
        return e / std::max(1,std::abs(c));
      }
    public:
      /// Create and register test
      OptFlexCumulative(int c0, int minP, int maxP,
                        const Gecode::IntArgs& u0,
                        int o0,
                        Gecode::IntPropLevel ipl0)
        : Test("Cumulative::Opt::Flex::"+str(o0)+"::"+
               str(c0)+"::"+str(minP)+"::"+str(maxP)+"::"+str(u0)+
               "::"+str(ipl0),
               (c0 >= 0) ? 3*u0.size() : 3*u0.size()+1,
               0,std::max(maxP,st(c0,maxP,u0)), false,ipl0),
          c(c0), _minP(minP), _maxP(maxP), u(u0),
          l(std::max(maxP,st(c0,maxP,u0))/2), o(o0) {
        testsearch = false;
        testfix = false;
        contest = CTL_NONE;
      }
      /// Create and register initial assignment
      virtual Assignment* assignment(void) const {
        return new RandomMixAssignment((c >= 0) ? 2 * (arity / 3) : 2 * (arity / 3) + 1,
                                       dom, arity / 3,
                                       Gecode::IntSet(_minP, _maxP), 500, _rand);
      }
      /// Test whether \a x is solution
      virtual bool solution(const Assignment& x) const {
        int nn = (c >= 0) ? x.size() : x.size()-1;
        int n = nn / 3;
        int cmax = (c >= 0) ? c : x[2*n];
        int pstart = (c >= 0) ? 2*n : 2*n+1;

        if (c < 0 && cmax > -c)
          return false;

        // Compute maximal time
        int t = 0;
        for (int i=0; i<n; i++)
          t = std::max(t,x[i]+std::max(1,x[pstart+i]));
        // Compute resource usage (including at start times)
        int* used = new int[t];
        for (int i=0; i<t; i++)
          used[i] = 0;
        for (int i=0; i<n; i++)
          if (x[n+i] > l)
            for (int t=0; t<x[pstart+i]; t++)
              used[x[i]+t] += u[i];
        // Check resource usage
        for (int i=0; i<t; i++)
          if (used[i] > cmax) {
            delete [] used;
            return false;
          }
        // Compute resource usage (only internal)
        for (int i=0; i<t; i++)
          used[i] = 0;
        for (int i=0; i<n; i++)
          if (x[n+i] > l)
            for (int t=1; t<x[pstart+i]; t++)
              used[x[i]+t] += u[i];
        // Check resource usage at start times
        for (int i=0; i<n; i++)
          if (x[n+i] > l && used[x[i]]+u[i] > cmax) {
            delete [] used;
            return false;
          }
        delete [] used;
        return true;
      }
      /// Post constraint on \a x
      virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
        int nn = (c >= 0) ? x.size() : x.size()-1;
        int n=nn / 3;
        int pstart= (c >= 0) ? 2*n : 2*n+1;

        Gecode::IntVarArgs s(n);
        Gecode::IntVarArgs px(n);
        Gecode::IntVarArgs e(home,n,
                             Gecode::Int::Limits::min,
                             Gecode::Int::Limits::max);
        for (int i=n; i--;) {
          s[i] = expr(home, o+x[i]);
          px[i] = x[pstart+i];
          rel(home, s[i]+px[i] == e[i]);
          rel(home, _minP <= px[i]);
          rel(home, _maxP >= px[i]);
        }
        Gecode::BoolVarArgs m(n);
        for (int i=0; i<n; i++)
          m[i]=Gecode::expr(home, (x[n+i] > l));
        if (c >= 0) {
          Gecode::cumulative(home, c, s, px, e, u, m, ipl);
        } else {
          Gecode::rel(home, x[2*n] <= -c);
          Gecode::cumulative(home, x[2*n], s, px, e, u, m, ipl);
        }
      }
    };

    /// Help class to create and register tests
    class Create {
    public:
      /// Perform creation and registration
      Create(void) {
        using namespace Gecode;
        IntArgs p1({1,1,1,1});
        IntArgs p2({2,2,2,2});
        IntArgs p3({4,3,3,5});
        IntArgs p4({4,0,3,5});
        IntArgs p5({1,1,1});

        IntArgs u1({1,1,1,1});
        IntArgs u2({2,2,2,2});
        IntArgs u3({2,3,4,5});
        IntArgs u4({2,3,0,5});
        IntArgs u5({1,3,2});

        for (IntPropBasicAdvanced ipba; ipba(); ++ipba) {
          // Regression test: check correct detection of disjunctive case
          (void) new ManFixPCumulative(3,p5,u5,0,ipba.ipl());

          for (int c=-7; c<8; c++) {
            int off = 0;
            for (int coff=0; coff<2; coff++) {
              (void) new ManFixPCumulative(c,p1,u1,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p1,u2,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p1,u3,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p1,u4,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p2,u1,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p2,u2,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p2,u3,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p2,u4,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p3,u1,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p3,u2,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p3,u3,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p3,u4,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p4,u1,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p4,u2,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p4,u3,off,ipba.ipl());
              (void) new ManFixPCumulative(c,p4,u4,off,ipba.ipl());

              (void) new ManFlexCumulative(c,0,1,u1,off,ipba.ipl());
              (void) new ManFlexCumulative(c,0,1,u2,off,ipba.ipl());
              (void) new ManFlexCumulative(c,0,1,u3,off,ipba.ipl());
              (void) new ManFlexCumulative(c,0,1,u4,off,ipba.ipl());
              (void) new ManFlexCumulative(c,0,2,u1,off,ipba.ipl());
              (void) new ManFlexCumulative(c,0,2,u2,off,ipba.ipl());
              (void) new ManFlexCumulative(c,0,2,u3,off,ipba.ipl());
              (void) new ManFlexCumulative(c,0,2,u4,off,ipba.ipl());
              (void) new ManFlexCumulative(c,3,5,u1,off,ipba.ipl());
              (void) new ManFlexCumulative(c,3,5,u2,off,ipba.ipl());
              (void) new ManFlexCumulative(c,3,5,u3,off,ipba.ipl());
              (void) new ManFlexCumulative(c,3,5,u4,off,ipba.ipl());

              (void) new OptFixPCumulative(c,p1,u1,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p1,u2,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p1,u3,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p1,u4,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p2,u1,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p2,u2,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p2,u3,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p2,u4,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p3,u1,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p3,u2,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p3,u3,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p3,u4,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p4,u1,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p4,u2,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p4,u3,off,ipba.ipl());
              (void) new OptFixPCumulative(c,p4,u4,off,ipba.ipl());

              (void) new OptFlexCumulative(c,0,1,u1,off,ipba.ipl());
              (void) new OptFlexCumulative(c,0,1,u2,off,ipba.ipl());
              (void) new OptFlexCumulative(c,0,1,u3,off,ipba.ipl());
              (void) new OptFlexCumulative(c,0,1,u4,off,ipba.ipl());
              (void) new OptFlexCumulative(c,0,2,u1,off,ipba.ipl());
              (void) new OptFlexCumulative(c,0,2,u2,off,ipba.ipl());
              (void) new OptFlexCumulative(c,0,2,u3,off,ipba.ipl());
              (void) new OptFlexCumulative(c,0,2,u4,off,ipba.ipl());
              (void) new OptFlexCumulative(c,3,5,u1,off,ipba.ipl());
              (void) new OptFlexCumulative(c,3,5,u2,off,ipba.ipl());
              (void) new OptFlexCumulative(c,3,5,u3,off,ipba.ipl());
              (void) new OptFlexCumulative(c,3,5,u4,off,ipba.ipl());

              off = Gecode::Int::Limits::min;
            }
          }
        }
      }
    };

    Create c;
    //@}

  }
}}

// STATISTICS: test-int