3
* Guido Tack <tack@gecode.org>
9
* $Date: 2005-11-01 16:01:21 +0100 (Tue, 01 Nov 2005) $ by $Author: zayenz $
12
* This file is part of Gecode, the generic constraint
13
* development environment:
14
* http://www.gecode.org
16
* See the file "LICENSE" for information on usage and
17
* redistribution of this file, and for a
18
* DISCLAIMER OF ALL WARRANTIES.
22
#include "test/set.hh"
24
static IntSet ds_33(-4,4);
26
class Convex : public SetTest {
29
: SetTest(t,1,ds_33,false) {}
30
virtual bool solution(const SetAssignment& x) const {
31
CountableSetRanges xr0(x.lub, x[0]);
39
virtual void post(Space* home, SetVarArray& x, IntVarArray&) {
40
Gecode::convex(home, x[0]);
43
Convex _convex("Convex::Convex");
45
class ConvexHull : public SetTest {
47
ConvexHull(const char* t)
48
: SetTest(t,2,ds_33,false) {}
49
virtual bool solution(const SetAssignment& x) const {
50
CountableSetRanges xr0(x.lub, x[0]);
51
CountableSetRanges xr1(x.lub, x[1]);
56
int x0min = xr0.min();
57
int x0max = xr0.max();
60
if (!xr1()) return false;
61
if (x0min != xr1.min()) return false;
62
int x1max = Limits::Set::int_min;
63
while (xr1()) { x1max = xr1.max(); ++xr1;}
64
if (x0max != x1max) return false;
69
virtual void post(Space* home, SetVarArray& x, IntVarArray&) {
70
Gecode::convexHull(home, x[1], x[0]);
73
ConvexHull _convexhull("Convex::ConvexHull");
75
class ConvexHullS : public SetTest {
77
ConvexHullS(const char* t)
78
: SetTest(t,1,ds_33,false) {}
79
virtual bool solution(const SetAssignment& x) const {
80
CountableSetRanges xr0(x.lub, x[0]);
88
virtual void post(Space* home, SetVarArray& x, IntVarArray&) {
89
Gecode::convexHull(home, x[0], x[0]);
92
ConvexHullS _convexhulls("Convex::Sharing::ConvexHullS");
94
// STATISTICS: test-set