main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Jan 28 2020 00:00:00 for Gecode by
doxygen
1.8.17
gecode
int
view
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
*/
49
forceinline
50
NegBoolView::NegBoolView
(
void
) {}
51
forceinline
52
NegBoolView::NegBoolView
(
const
BoolView
&
y
)
53
:
DerivedView
<
BoolView
>(
y
) {}
54
55
56
/*
57
* Boolean domain tests
58
*
59
*/
60
forceinline
BoolStatus
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
*/
82
forceinline
ModEvent
83
NegBoolView::zero_none
(
Space
& home) {
84
return
x
.
one_none
(home);
85
}
86
forceinline
ModEvent
87
NegBoolView::one_none
(
Space
& home) {
88
return
x
.
zero_none
(home);
89
}
90
91
forceinline
ModEvent
92
NegBoolView::zero
(
Space
& home) {
93
return
x
.
one
(home);
94
}
95
forceinline
ModEvent
96
NegBoolView::one
(
Space
& home) {
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
136
NegBoolView::zero
(
const
Delta
&
d
) {
137
return
BoolView::one
(
d
);
138
}
139
forceinline
bool
140
NegBoolView::one
(
const
Delta
&
d
) {
141
return
BoolView::zero
(
d
);
142
}
143
144
149
template
<>
150
class
ViewRanges
<
NegBoolView
> :
public
Iter::Ranges::Singleton
{
151
public
:
153
154
ViewRanges
(
void
);
157
ViewRanges
(
const
NegBoolView
&
x
);
159
void
init
(
const
NegBoolView
&
x
);
161
};
162
163
forceinline
164
ViewRanges<NegBoolView>::ViewRanges
(
void
) {}
165
166
forceinline
167
ViewRanges<NegBoolView>::ViewRanges
(
const
NegBoolView
&
x
)
168
: Iter::Ranges::Singleton(
x
.
min
(),
x
.
max
()) {}
169
170
forceinline
void
171
ViewRanges<NegBoolView>::init
(
const
NegBoolView
&
x
) {
172
Iter::Ranges::Singleton::init
(
x
.min(),
x
.max());
173
}
174
175
}}
176
177
// STATISTICS: int-var
Gecode::Int::NegBoolView
Negated Boolean view.
Definition:
view.hpp:1503
Gecode::x
Post propagator for SetVar x
Definition:
set.hh:784
Gecode::Int::BoolView::zero
bool zero(void) const
Test whether view is assigned to be zero.
Definition:
bool.hpp:214
Gecode::y
Post propagator for SetVar SetOpType SetVar y
Definition:
set.hh:784
forceinline
#define forceinline
Definition:
config.hpp:173
Gecode::max
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition:
arithmetic.cpp:53
Gecode::Int::ViewRanges::init
void init(const View &x)
Initialize with ranges for view x.
Gecode::Int::NegBoolView::any
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition:
neg-bool.hpp:132
Gecode::Int::BoolView::one
bool one(void) const
Test whether view is assigned to be one.
Definition:
bool.hpp:218
Gecode::Space
Computation spaces.
Definition:
core.hpp:1748
Gecode::Int::BoolStatus
unsigned int BoolStatus
Type for status of a Boolean variable.
Definition:
var-imp.hpp:484
Gecode::Int::NegBoolView::min
int min(void) const
Return minimum of domain.
Definition:
neg-bool.hpp:106
Gecode::Int::BoolView
Boolean view for Boolean variables.
Definition:
view.hpp:1315
Gecode::DerivedView
Base-class for derived views.
Definition:
view.hpp:222
Gecode::Int::BoolView::one_none
ModEvent one_none(Space &home)
Assign not yet assigned view to one.
Definition:
bool.hpp:236
Gecode
Gecode toplevel namespace
Gecode::Int::ViewRanges
Range iterator for integer views.
Definition:
view.hpp:54
Gecode::Int::NegBoolView::zero
bool zero(void) const
Test whether view is assigned to be zero.
Definition:
neg-bool.hpp:65
Gecode::Int::BoolView::none
bool none(void) const
Test whether view is not yet assigned.
Definition:
bool.hpp:222
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition:
core.hpp:281
Gecode::Int::BoolView::zero_none
ModEvent zero_none(Space &home)
Assign not yet assigned view to zero.
Definition:
bool.hpp:232
Gecode::Int::NegBoolView::status
BoolStatus status(void) const
Return current domain status.
Definition:
neg-bool.hpp:61
Gecode::Int::BoolView::max
int max(void) const
Return maximum of domain.
Definition:
bool.hpp:66
Gecode::Int::NegBoolView::val
int val(void) const
Return assigned value (only if assigned)
Definition:
neg-bool.hpp:114
Gecode::Int::ViewRanges::ViewRanges
ViewRanges(void)
Default constructor.
Gecode::Int::BoolView::any
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition:
bool.hpp:263
Gecode::Iter::Ranges::Singleton::init
void init(int min, int max)
Initialize with range min to max.
Definition:
ranges-singleton.hpp:74
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition:
core.hpp:142
Gecode::DerivedView< BoolView >::x
BoolView x
View from which this view is derived.
Definition:
view.hpp:230
Test::Int::Distinct::d
Gecode::IntSet d(v, 7)
Gecode::Int::BoolView::status
BoolStatus status(void) const
Return current domain status.
Definition:
bool.hpp:58
Gecode::Int::NegBoolView::one
bool one(void) const
Test whether view is assigned to be one.
Definition:
neg-bool.hpp:69
Gecode::Int::BoolView::min
int min(void) const
Return minimum of domain.
Definition:
bool.hpp:62
Gecode::Int::BoolView::val
int val(void) const
Return assigned value (only if assigned)
Definition:
bool.hpp:74
Gecode::Int::NegBoolView::one_none
ModEvent one_none(Space &home)
Assign not yet assigned view to one.
Definition:
neg-bool.hpp:87
Gecode::Iter::Ranges::Singleton
Range iterator for singleton range.
Definition:
ranges-singleton.hpp:46
Gecode::Int::NegBoolView::none
bool none(void) const
Test whether view is not yet assigned.
Definition:
neg-bool.hpp:73
Gecode::Int::NegBoolView::zero_none
ModEvent zero_none(Space &home)
Assign not yet assigned view to zero.
Definition:
neg-bool.hpp:83
Gecode::min
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition:
arithmetic.cpp:71
Gecode::Int::NegBoolView::max
int max(void) const
Return maximum of domain.
Definition:
neg-bool.hpp:110
Gecode::Int::NegBoolView::NegBoolView
NegBoolView(void)
Default constructor.
Definition:
neg-bool.hpp:50