main page
modules
namespaces
classes
files
Gecode home
Generated on Sat May 25 2013 18:00:35 for Gecode by
doxygen
1.8.3.1
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
* Last modified:
12
* $Date: 2012-04-06 13:04:47 +0200 (Fri, 06 Apr 2012) $ by $Author: schulte $
13
* $Revision: 12711 $
14
*
15
* This file is part of Gecode, the generic constraint
16
* development environment:
17
* http://www.gecode.org
18
*
19
* Permission is hereby granted, free of charge, to any person obtaining
20
* a copy of this software and associated documentation files (the
21
* "Software"), to deal in the Software without restriction, including
22
* without limitation the rights to use, copy, modify, merge, publish,
23
* distribute, sublicense, and/or sell copies of the Software, and to
24
* permit persons to whom the Software is furnished to do so, subject to
25
* the following conditions:
26
*
27
* The above copyright notice and this permission notice shall be
28
* included in all copies or substantial portions of the Software.
29
*
30
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37
*
38
*/
39
40
namespace
Gecode {
namespace
Float {
41
42
/*
43
* Constructors and initialization
44
*
45
*/
46
forceinline
47
MinusView::MinusView
(
void
) {}
48
forceinline
49
MinusView::MinusView
(
const
FloatView
& y)
50
:
DerivedView
<
FloatView
>(y) {}
51
52
/*
53
* Value access
54
*
55
*/
56
forceinline
FloatVal
57
MinusView::domain
(
void
)
const
{
58
return
-
x
.domain();
59
}
60
forceinline
FloatNum
61
MinusView::min
(
void
)
const
{
62
return
-
x
.max();
63
}
64
forceinline
FloatNum
65
MinusView::max
(
void
)
const
{
66
return
-
x
.min();
67
}
68
forceinline
FloatNum
69
MinusView::med
(
void
)
const
{
70
return
-
x
.med();
71
}
72
forceinline
FloatVal
73
MinusView::val
(
void
)
const
{
74
return
-
x
.val();
75
}
76
77
forceinline
FloatNum
78
MinusView::size
(
void
)
const
{
79
return
x
.size();
80
}
81
82
83
/*
84
* Domain tests
85
*
86
*/
87
forceinline
bool
88
MinusView::zero_in
(
void
)
const
{
89
return
x
.zero_in();
90
}
91
forceinline
bool
92
MinusView::in
(
FloatNum
n
)
const
{
93
return
x
.in(-n);
94
}
95
forceinline
bool
96
MinusView::in
(
const
FloatVal
&
n
)
const
{
97
return
x
.in(-n);
98
}
99
100
101
/*
102
* Domain update by value
103
*
104
*/
105
forceinline
ModEvent
106
MinusView::lq
(
Space
& home,
int
n
) {
107
return
x
.gq(home,-n);
108
}
109
forceinline
ModEvent
110
MinusView::lq
(
Space
& home,
FloatNum
n
) {
111
return
x
.gq(home,-n);
112
}
113
forceinline
ModEvent
114
MinusView::lq
(
Space
& home,
FloatVal
n
) {
115
return
x
.gq(home,-n);
116
}
117
118
forceinline
ModEvent
119
MinusView::gq
(
Space
& home,
int
n
) {
120
return
x
.lq(home,-n);
121
}
122
forceinline
ModEvent
123
MinusView::gq
(
Space
& home,
FloatNum
n
) {
124
return
x
.lq(home,-n);
125
}
126
forceinline
ModEvent
127
MinusView::gq
(
Space
& home,
FloatVal
n
) {
128
return
x
.lq(home,-n);
129
}
130
131
forceinline
ModEvent
132
MinusView::eq
(
Space
& home,
int
n
) {
133
return
x
.eq(home,-n);
134
}
135
forceinline
ModEvent
136
MinusView::eq
(
Space
& home,
FloatNum
n
) {
137
return
x
.eq(home,-n);
138
}
139
forceinline
ModEvent
140
MinusView::eq
(
Space
& home,
const
FloatVal
&
n
) {
141
return
x
.eq(home,-n);
142
}
143
144
145
/*
146
* Delta information for advisors
147
*
148
*/
149
forceinline
FloatNum
150
MinusView::min
(
const
Delta
&
d
)
const
{
151
return
-
x
.max(d);
152
}
153
forceinline
FloatNum
154
MinusView::max
(
const
Delta
&
d
)
const
{
155
return
-
x
.min(d);
156
}
157
158
159
forceinline
ModEventDelta
160
MinusView::med
(
ModEvent
me) {
161
return
VarImpView<FloatVar>::med
(me);
162
}
163
164
}}
165
166
// STATISTICS: float-var
167