Generated on Thu Jul 25 2019 00:00:00 for Gecode by doxygen 1.8.15
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: 2016-05-23 22:18:23 +0200 (Mon, 23 May 2016) $ by $Author: schulte $
11  * $Revision: 15073 $
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  IntPropLevel) {
45  using namespace Int;
47 
48  ViewArray<IntView> xv(home,x);
50  }
51 
52  void
53  member(Home home, const BoolVarArgs& x, BoolVar y,
54  IntPropLevel) {
55  using namespace Int;
57 
58  ViewArray<BoolView> xv(home,x);
60  }
61 
62  void
63  member(Home home, const IntVarArgs& x, IntVar y, Reify r,
64  IntPropLevel) {
65  using namespace Int;
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  IntPropLevel) {
90  using namespace Int;
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 
Reified membership propagator.
Definition: member.hh:94
Inverse implication for reification.
Definition: int.hh:850
void member(Home home, const IntVarArgs &x, IntVar y, IntPropLevel)
Post domain consistent propagator for .
Definition: member.cpp:43
Membership propagator.
Definition: member.hh:58
Reification specification.
Definition: int.hh:857
Passing integer variables.
Definition: int.hh:639
Passing Boolean variables.
Definition: int.hh:693
Boolean integer variables.
Definition: int.hh:494
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:784
IntPropLevel
Propagation levels for integer propagators.
Definition: int.hh:955
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:784
Integer variables.
Definition: int.hh:353
Post propagator for SetVar x
Definition: set.hh:784
Exception: Unknown reification mode passed as argument
Definition: exception.hpp:119
Gecode toplevel namespace
Implication for reification.
Definition: int.hh:843
#define GECODE_POST
Check for failure in a constraint post function.
Definition: macros.hpp:44
Home class for posting propagators
Definition: core.hpp:922
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
Definition: macros.hpp:107
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
Equivalence for reification (default)
Definition: int.hh:836