main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Oct 22 2013 00:49:02 for Gecode by
doxygen
1.8.4
gecode
float
view
offset.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, 2002
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
OffsetView::OffsetView
(
void
) {}
48
forceinline
49
OffsetView::OffsetView
(
const
FloatView
& y,
FloatNum
d
)
50
:
DerivedView
<
FloatView
>(y),
c
(d) {}
51
52
53
/*
54
* Value access
55
*
56
*/
57
forceinline
FloatNum
58
OffsetView::offset
(
void
)
const
{
59
return
c
;
60
}
61
forceinline
void
62
OffsetView::offset
(
FloatNum
n
) {
63
c
=
n
;
64
}
65
forceinline
FloatVal
66
OffsetView::domain
(
void
)
const
{
67
return
x
.domain()+
c
;
68
}
69
forceinline
FloatNum
70
OffsetView::min
(
void
)
const
{
71
return
x
.min()+
c
;
72
}
73
forceinline
FloatNum
74
OffsetView::max
(
void
)
const
{
75
return
x
.max()+
c
;
76
}
77
forceinline
FloatNum
78
OffsetView::med
(
void
)
const
{
79
return
x
.med()+
c
;
80
}
81
forceinline
FloatVal
82
OffsetView::val
(
void
)
const
{
83
return
x
.val()+
c
;
84
}
85
86
forceinline
FloatNum
87
OffsetView::size
(
void
)
const
{
88
return
x
.size();
89
}
90
91
92
/*
93
* Domain tests
94
*
95
*/
96
forceinline
bool
97
OffsetView::zero_in
(
void
)
const
{
98
return
x
.in(-
c
);
99
}
100
forceinline
bool
101
OffsetView::in
(
FloatNum
n
)
const
{
102
return
x
.in(n-
c
);
103
}
104
forceinline
bool
105
OffsetView::in
(
const
FloatVal
&
n
)
const
{
106
return
x
.in(n-
c
);
107
}
108
109
110
/*
111
* Domain update by value
112
*
113
*/
114
forceinline
ModEvent
115
OffsetView::lq
(
Space
& home,
int
n
) {
116
return
x
.lq(home,n-
c
);
117
}
118
forceinline
ModEvent
119
OffsetView::lq
(
Space
& home,
FloatNum
n
) {
120
return
x
.lq(home,n-
c
);
121
}
122
forceinline
ModEvent
123
OffsetView::lq
(
Space
& home,
FloatVal
n
) {
124
return
x
.lq(home,n-
c
);
125
}
126
127
forceinline
ModEvent
128
OffsetView::gq
(
Space
& home,
int
n
) {
129
return
x
.gq(home,n-
c
);
130
}
131
forceinline
ModEvent
132
OffsetView::gq
(
Space
& home,
FloatNum
n
) {
133
return
x
.gq(home,n-
c
);
134
}
135
forceinline
ModEvent
136
OffsetView::gq
(
Space
& home,
FloatVal
n
) {
137
return
x
.gq(home,n-
c
);
138
}
139
140
forceinline
ModEvent
141
OffsetView::eq
(
Space
& home,
int
n
) {
142
return
x
.eq(home,n-
c
);
143
}
144
forceinline
ModEvent
145
OffsetView::eq
(
Space
& home,
FloatNum
n
) {
146
return
x
.eq(home,n-
c
);
147
}
148
forceinline
ModEvent
149
OffsetView::eq
(
Space
& home,
const
FloatVal
&
n
) {
150
return
x
.eq(home,n-
c
);
151
}
152
153
154
/*
155
* Delta information for advisors
156
*
157
*/
158
forceinline
FloatNum
159
OffsetView::min
(
const
Delta
&
d
)
const
{
160
return
x
.min(d)+
c
;
161
}
162
forceinline
FloatNum
163
OffsetView::max
(
const
Delta
&
d
)
const
{
164
return
x
.max(d)+
c
;
165
}
166
167
forceinline
ModEventDelta
168
OffsetView::med
(
ModEvent
me) {
169
return
VarImpView<FloatVar>::med
(me);
170
}
171
172
173
/*
174
* Cloning
175
*
176
*/
177
forceinline
void
178
OffsetView::update
(
Space
& home,
bool
share,
OffsetView
& y) {
179
DerivedView<FloatView>::update
(home,share,y);
180
c
=y.
c
;
181
}
182
183
}}
184
185
// STATISTICS: float-var
186