Generated on Sat Feb 7 2015 02:01:26 for Gecode by doxygen 1.8.9.1
neg-bool.hpp
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, 2008
8  *
9  * Last modified:
10  * $Date: 2010-06-29 10:39:13 +0200 (Tue, 29 Jun 2010) $ by $Author: schulte $
11  * $Revision: 11118 $
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 namespace Gecode { namespace Int {
39 
40  /*
41  * Negated Boolean views
42  *
43  */
44 
45  /*
46  * Constructors and initialization
47  *
48  */
53  : DerivedView<BoolView>(y) {}
54 
55 
56  /*
57  * Boolean domain tests
58  *
59  */
61  NegBoolView::status(void) const {
62  return x.status();
63  }
64  forceinline bool
65  NegBoolView::zero(void) const {
66  return x.one();
67  }
68  forceinline bool
69  NegBoolView::one(void) const {
70  return x.zero();
71  }
72  forceinline bool
73  NegBoolView::none(void) const {
74  return x.none();
75  }
76 
77 
78  /*
79  * Boolean assignment operations
80  *
81  */
84  return x.one_none(home);
85  }
88  return x.zero_none(home);
89  }
90 
93  return x.one(home);
94  }
97  return x.zero(home);
98  }
99 
100 
101  /*
102  * Value access
103  *
104  */
105  forceinline int
106  NegBoolView::min(void) const {
107  return x.max();
108  }
109  forceinline int
110  NegBoolView::max(void) const {
111  return x.min();
112  }
113  forceinline int
114  NegBoolView::val(void) const {
115  return 1-x.val();
116  }
117 
118 
119  /*
120  * Delta information for advisors
121  *
122  */
123  forceinline int
124  NegBoolView::min(const Delta& d) const {
125  return x.max(d);
126  }
127  forceinline int
128  NegBoolView::max(const Delta& d) const {
129  return x.min(d);
130  }
131  forceinline bool
132  NegBoolView::any(const Delta& d) const {
133  return x.any(d);
134  }
135  forceinline bool
137  return BoolView::one(d);
138  }
139  forceinline bool
141  return BoolView::zero(d);
142  }
143 
144 
149  template<>
151  public:
153 
154  ViewRanges(void);
157  ViewRanges(const NegBoolView& x);
159  void init(const NegBoolView& x);
161  };
162 
165 
168  : Iter::Ranges::Singleton(x.min(),x.max()) {}
169 
170  forceinline void
173  }
174 
175 }}
176 
177 // STATISTICS: int-var
int val(void) const
Return assigned value (only if assigned)
Definition: neg-bool.hpp:114
bool none(void) const
Test whether view is not yet assigned.
Definition: bool.hpp:222
int max(void) const
Return maximum of domain.
Definition: bool.hpp:66
Range iterator for singleton range.
BoolStatus status(void) const
Return current domain status.
Definition: neg-bool.hpp:61
Negated Boolean view.
Definition: view.hpp:1503
int min(void) const
Return minimum of domain.
Definition: bool.hpp:62
unsigned int BoolStatus
Type for status of a Boolean variable.
Definition: var-imp.hpp:479
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:57
ViewRanges(void)
Default constructor.
int ModEvent
Type for modification events.
Definition: core.hpp:146
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: neg-bool.hpp:132
Computation spaces.
Definition: core.hpp:1362
void init(const View &x)
Initialize with ranges for view x.
Base-class for derived views.
Definition: view.hpp:208
Range iterator for integer views.
Definition: view.hpp:54
Gecode::IntSet d(v, 7)
int min(void) const
Return minimum of domain.
Definition: neg-bool.hpp:106
bool one(void) const
Test whether view is assigned to be one.
Definition: neg-bool.hpp:69
ModEvent zero_none(Space &home)
Assign not yet assigned view to zero.
Definition: bool.hpp:232
void init(int min, int max)
Initialize with range min to max.
BoolStatus status(void) const
Return current domain status.
Definition: bool.hpp:58
int max(void) const
Return maximum of domain.
Definition: neg-bool.hpp:110
bool none(void) const
Test whether view is not yet assigned.
Definition: neg-bool.hpp:73
NegBoolView(void)
Default constructor.
Definition: neg-bool.hpp:50
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:75
bool one(void) const
Test whether view is assigned to be one.
Definition: bool.hpp:218
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Generic domain change information to be supplied to advisors.
Definition: core.hpp:275
#define forceinline
Definition: config.hpp:132
int val(void) const
Return assigned value (only if assigned)
Definition: bool.hpp:74
BoolView x
View from which this view is derived.
Definition: view.hpp:216
Gecode toplevel namespace
bool zero(void) const
Test whether view is assigned to be zero.
Definition: neg-bool.hpp:65
ModEvent zero_none(Space &home)
Assign not yet assigned view to zero.
Definition: neg-bool.hpp:83
ModEvent one_none(Space &home)
Assign not yet assigned view to one.
Definition: bool.hpp:236
bool zero(void) const
Test whether view is assigned to be zero.
Definition: bool.hpp:214
ModEvent one_none(Space &home)
Assign not yet assigned view to one.
Definition: neg-bool.hpp:87
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition: bool.hpp:263
Boolean view for Boolean variables.
Definition: view.hpp:1315