Generated on Sat Feb 7 2015 02:01:24 for Gecode by doxygen 1.8.9.1
member.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, 2011
8  *
9  * Last modified:
10  * $Date: 2011-11-18 16:02:48 +0100 (Fri, 18 Nov 2011) $ by $Author: schulte $
11  * $Revision: 12472 $
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 <gecode/int/member.hh>
39 
40 namespace Gecode {
41 
42  void
43  member(Home home, const IntVarArgs& x, IntVar y,
44  IntConLevel) {
45  using namespace Int;
46  if (home.failed()) return;
47 
48  ViewArray<IntView> xv(home,x);
50  }
51 
52  void
53  member(Home home, const BoolVarArgs& x, BoolVar y,
54  IntConLevel) {
55  using namespace Int;
56  if (home.failed()) return;
57 
58  ViewArray<BoolView> xv(home,x);
60  }
61 
62  void
63  member(Home home, const IntVarArgs& x, IntVar y, Reify r,
64  IntConLevel) {
65  using namespace Int;
66  if (home.failed()) return;
67 
68  ViewArray<IntView> xv(home,x);
69 
70  switch (r.mode()) {
71  case RM_EQV:
73  ::post(home,xv,y,r.var())));
74  break;
75  case RM_IMP:
77  ::post(home,xv,y,r.var())));
78  break;
79  case RM_PMI:
81  ::post(home,xv,y,r.var())));
82  break;
83  default: throw UnknownReifyMode("Int::member");
84  }
85  }
86 
87  void
88  member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
89  IntConLevel) {
90  using namespace Int;
91  if (home.failed()) return;
92 
93  ViewArray<BoolView> xv(home,x);
94 
95  switch (r.mode()) {
96  case RM_EQV:
98  ::post(home,xv,y,r.var())));
99  break;
100  case RM_IMP:
102  ::post(home,xv,y,r.var())));
103  break;
104  case RM_PMI:
106  ::post(home,xv,y,r.var())));
107  break;
108  default: throw UnknownReifyMode("Int::member");
109  }
110 
111  }
112 
113 }
114 
115 // STATISTICS: int-post
116 
bool failed(void) const
Check whether corresponding space is failed.
Definition: core.hpp:3446
Reified membership propagator.
Definition: member.hh:94
IntConLevel
Consistency levels for integer propagators.
Definition: int.hh:937
Inverse implication for reification.
Definition: int.hh:847
ReifyMode mode(void) const
Return reification mode.
Definition: reify.hpp:60
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Definition: post.cpp:228
BoolVar var(void) const
Return Boolean control variable.
Definition: reify.hpp:52
Membership propagator.
Definition: member.hh:58
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
Reification specification.
Definition: int.hh:854
Passing integer variables.
Definition: int.hh:636
Passing Boolean variables.
Definition: int.hh:690
Boolean integer variables.
Definition: int.hh:491
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Integer variables.
Definition: int.hh:350
Exception: Unknown reification mode passed as argument
Definition: exception.hpp:119
Gecode toplevel namespace
Implication for reification.
Definition: int.hh:840
Home class for posting propagators
Definition: core.hpp:717
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
Definition: macros.hpp:96
void member(Home home, const IntVarArgs &x, IntVar y, IntConLevel)
Post domain consistent propagator for .
Definition: member.cpp:43
Equivalence for reification (default)
Definition: int.hh:833