main page
modules
namespaces
classes
files
Gecode home
Generated on Fri Jan 10 2020 11:38:25 for Gecode by
doxygen
1.8.16
gecode
float
view
minus.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
* Vincent Barichard <Vincent.Barichard@univ-angers.fr>
6
*
7
* Copyright:
8
* Christian Schulte, 2003
9
* Vincent Barichard, 2012
10
*
11
* This file is part of Gecode, the generic constraint
12
* development environment:
13
* http://www.gecode.org
14
*
15
* Permission is hereby granted, free of charge, to any person obtaining
16
* a copy of this software and associated documentation files (the
17
* "Software"), to deal in the Software without restriction, including
18
* without limitation the rights to use, copy, modify, merge, publish,
19
* distribute, sublicense, and/or sell copies of the Software, and to
20
* permit persons to whom the Software is furnished to do so, subject to
21
* the following conditions:
22
*
23
* The above copyright notice and this permission notice shall be
24
* included in all copies or substantial portions of the Software.
25
*
26
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
*
34
*/
35
36
namespace
Gecode
{
namespace
Float {
37
38
/*
39
* Constructors and initialization
40
*
41
*/
42
forceinline
43
MinusView::MinusView
(
void
) {}
44
forceinline
45
MinusView::MinusView
(
const
FloatView
&
y
)
46
:
DerivedView
<
FloatView
>(
y
) {}
47
48
/*
49
* Value access
50
*
51
*/
52
forceinline
FloatVal
53
MinusView::domain
(
void
)
const
{
54
return
-
x
.domain();
55
}
56
forceinline
FloatNum
57
MinusView::min
(
void
)
const
{
58
return
-
x
.max();
59
}
60
forceinline
FloatNum
61
MinusView::max
(
void
)
const
{
62
return
-
x
.min();
63
}
64
forceinline
FloatNum
65
MinusView::med
(
void
)
const
{
66
return
-
x
.med();
67
}
68
forceinline
FloatVal
69
MinusView::val
(
void
)
const
{
70
return
-
x
.val();
71
}
72
73
forceinline
FloatNum
74
MinusView::size
(
void
)
const
{
75
return
x
.size();
76
}
77
78
79
/*
80
* Domain tests
81
*
82
*/
83
forceinline
bool
84
MinusView::zero_in
(
void
)
const
{
85
return
x
.zero_in();
86
}
87
forceinline
bool
88
MinusView::in
(
FloatNum
n
)
const
{
89
return
x
.in(-
n
);
90
}
91
forceinline
bool
92
MinusView::in
(
const
FloatVal
&
n
)
const
{
93
return
x
.in(-
n
);
94
}
95
96
97
/*
98
* Domain update by value
99
*
100
*/
101
forceinline
ModEvent
102
MinusView::lq
(
Space
& home,
int
n
) {
103
return
x
.gq(home,-
n
);
104
}
105
forceinline
ModEvent
106
MinusView::lq
(
Space
& home,
FloatNum
n
) {
107
return
x
.gq(home,-
n
);
108
}
109
forceinline
ModEvent
110
MinusView::lq
(
Space
& home,
FloatVal
n
) {
111
return
x
.gq(home,-
n
);
112
}
113
114
forceinline
ModEvent
115
MinusView::gq
(
Space
& home,
int
n
) {
116
return
x
.lq(home,-
n
);
117
}
118
forceinline
ModEvent
119
MinusView::gq
(
Space
& home,
FloatNum
n
) {
120
return
x
.lq(home,-
n
);
121
}
122
forceinline
ModEvent
123
MinusView::gq
(
Space
& home,
FloatVal
n
) {
124
return
x
.lq(home,-
n
);
125
}
126
127
forceinline
ModEvent
128
MinusView::eq
(
Space
& home,
int
n
) {
129
return
x
.eq(home,-
n
);
130
}
131
forceinline
ModEvent
132
MinusView::eq
(
Space
& home,
FloatNum
n
) {
133
return
x
.eq(home,-
n
);
134
}
135
forceinline
ModEvent
136
MinusView::eq
(
Space
& home,
const
FloatVal
&
n
) {
137
return
x
.eq(home,-
n
);
138
}
139
140
141
/*
142
* Delta information for advisors
143
*
144
*/
145
forceinline
FloatNum
146
MinusView::min
(
const
Delta
&
d
)
const
{
147
return
-
x
.max(
d
);
148
}
149
forceinline
FloatNum
150
MinusView::max
(
const
Delta
&
d
)
const
{
151
return
-
x
.min(
d
);
152
}
153
154
155
forceinline
ModEventDelta
156
MinusView::med
(
ModEvent
me) {
157
return
VarImpView<FloatVar>::med
(
me
);
158
}
159
160
/*
161
* View comparison
162
*
163
*/
164
forceinline
bool
165
operator ==
(
const
MinusView
&
x
,
const
MinusView
&
y
) {
166
return
x
.base() ==
y
.base();
167
}
168
forceinline
bool
169
operator !=
(
const
MinusView
&
x
,
const
MinusView
&
y
) {
170
return
!(
x
==
y
);
171
}
172
173
}}
174
175
// STATISTICS: float-var
176
Gecode::x
Post propagator for SetVar x
Definition:
set.hh:767
Gecode::y
Post propagator for SetVar SetOpType SetVar y
Definition:
set.hh:767
Gecode::Float::MinusView::max
FloatNum max(void) const
Return maximum of domain.
Definition:
minus.hpp:61
Gecode::Float::MinusView::min
FloatNum min(void) const
Return minimum of domain.
Definition:
minus.hpp:57
Gecode::Float::MinusView::zero_in
bool zero_in(void) const
Test whether 0 is contained in domain.
Definition:
minus.hpp:84
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode::Float::MinusView::gq
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition:
minus.hpp:115
Gecode::DerivedView
Base-class for derived views.
Definition:
view.hpp:230
Gecode
Gecode toplevel namespace
Gecode::Float::operator!=
bool operator!=(const MinusView &x, const MinusView &y)
Definition:
minus.hpp:169
Gecode::Float::FloatView
Float view for float variables.
Definition:
view.hpp:52
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition:
core.hpp:204
Gecode::Float::MinusView::size
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition:
minus.hpp:74
Gecode::Float::MinusView::eq
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition:
minus.hpp:128
Gecode::Float::MinusView::in
bool in(FloatNum n) const
Test whether n is contained in domain.
Definition:
minus.hpp:88
Gecode::FloatNum
double FloatNum
Floating point number base type.
Definition:
float.hh:106
Gecode::Float::operator==
bool operator==(const MinusView &x, const MinusView &y)
Definition:
minus.hpp:165
Gecode::Float::MinusView::domain
FloatVal domain(void) const
Return domain.
Definition:
minus.hpp:53
Gecode::Float::MinusView
Minus float view.
Definition:
view.hpp:154
Gecode::Float::MinusView::MinusView
MinusView(void)
Default constructor.
Definition:
minus.hpp:43
Gecode::Float::MinusView::val
FloatVal val(void) const
Return assigned value.
Definition:
minus.hpp:69
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition:
core.hpp:62
Gecode::DerivedView< FloatView >::me
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Definition:
view.hpp:639
Gecode::DerivedView< FloatView >::x
FloatView x
View from which this view is derived.
Definition:
view.hpp:238
Gecode::FloatVal
Float value type.
Definition:
float.hh:334
Gecode::Float::MinusView::lq
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition:
minus.hpp:102
Test::Int::Distinct::d
Gecode::IntSet d(v, 7)
Gecode::Float::MinusView::med
FloatNum med(void) const
Return median of domain (closest representation)
Definition:
minus.hpp:65
forceinline
#define forceinline
Definition:
config.hpp:185
Gecode::VarImpView::med
static ModEventDelta med(ModEvent me)
Translate modification event me to modification event delta for view.
Definition:
view.hpp:557
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:234
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition:
core.hpp:89