3
* Guido Tack <tack@gecode.org>
4
* Christian Schulte <schulte@gecode.org>
8
* Christian Schulte, 2004
11
* $Date: 2005-11-25 17:31:45 +0100 (Fri, 25 Nov 2005) $ by $Author: tack $
14
* This file is part of Gecode, the generic constraint
15
* development environment:
16
* http://www.gecode.org
18
* See the file "LICENSE" for information on usage and
19
* redistribution of this file, and for a
20
* DISCLAIMER OF ALL WARRANTIES.
29
using namespace Gecode::Int;
34
rel(Space* home, SetVar s, IntRelType r, IntVar x) {
35
if (home->failed()) return;
39
Gecode::Int::IntView xv(x);
40
Set::SingletonView xsingle(xv);
42
(Set::Rel::Eq<Set::SetView,Set::SingletonView>
43
::post(home,s,xsingle)));
49
Gecode::Int::IntView xv(x);
50
Set::SingletonView xsingle(xv);
52
(Set::Rel::Distinct<Set::SetView,Set::SingletonView>
53
::post(home,s,xsingle)));
59
IntVar tmp(home, Limits::Int::int_min, Limits::Int::int_max);
60
rel(home, tmp, IRT_LQ, x);
61
GECODE_ES_FAIL(home,Set::Int::MaxElement::post(home,s,tmp));
66
IntVar tmp(home, Limits::Int::int_min, Limits::Int::int_max);
67
rel(home, tmp, IRT_LE, x);
68
GECODE_ES_FAIL(home,Set::Int::MaxElement::post(home,s,tmp));
73
IntVar tmp(home, Limits::Int::int_min, Limits::Int::int_max);
74
rel(home, tmp, IRT_GQ, x);
75
GECODE_ES_FAIL(home,Set::Int::MinElement::post(home,s,tmp));
80
IntVar tmp(home, Limits::Int::int_min, Limits::Int::int_max);
81
rel(home, tmp, IRT_GR, x);
82
GECODE_ES_FAIL(home,Set::Int::MinElement::post(home,s,tmp));
90
rel(Space* home, IntVar x, IntRelType r, SetVar s) {
93
case IRT_LE: rr=IRT_GR; break;
94
case IRT_LQ: rr=IRT_GQ; break;
95
case IRT_GR: rr=IRT_LE; break;
96
case IRT_GQ: rr=IRT_LQ; break;
103
minElement(Space* home, SetVar s, IntVar x){
104
if (home->failed()) return;
105
GECODE_ES_FAIL(home,Set::Int::MinElement::post(home,s,x));
108
maxElement(Space* home, SetVar s, IntVar x){
109
if (home->failed()) return;
110
GECODE_ES_FAIL(home,Set::Int::MaxElement::post(home,s,x));
114
match(Space* home, SetVar s, const IntVarArgs& x) {
115
if (home->failed()) return;
116
ViewArray<IntView> xa(home,x);
117
GECODE_ES_FAIL(home,Set::Int::Match::post(home,s,xa));
121
channelVarVal(Space* home, const IntVarArgs& x, const SetVarArgs& y) {
122
if (home->failed()) return;
123
ViewArray<Int::IntView> xa(home,x);
124
ViewArray<Set::SetView> ya(home,y);
125
GECODE_ES_FAIL(home,Set::Int::ChannelVarVal::post(home,xa,ya));
128
void weights(Space* home, const IntArgs& elements, const IntArgs& weights,
129
SetVar x, IntVar y) {
130
if (home->failed()) return;
133
GECODE_ES_FAIL(home,Set::Int::Weights::post(home,elements,weights,x,y));
138
// STATISTICS: set-post