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
rel-test.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: 2013-01-24 19:28:06 +0100 (Thu, 24 Jan 2013) $ by $Author: schulte $
13
* $Revision: 13235 $
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
template
<
class
View>
43
forceinline
RelTest
44
rtest_eq
(View
x
, View y) {
45
if
((x.min() > y.max()) || (x.max() < y.min()))
return
RT_FALSE
;
46
return
(x.assigned() && y.assigned()) ?
RT_TRUE
:
RT_MAYBE
;
47
}
48
49
template
<
class
View>
50
forceinline
RelTest
51
rtest_eq
(View
x
,
FloatVal
n
) {
52
if
((x.min() > n.
max
()) || (x.max() < n.
min
()))
return
RT_FALSE
;
53
return
x.assigned() ?
RT_TRUE
:
RT_MAYBE
;
54
}
55
56
template
<
class
View>
57
forceinline
RelTest
58
rtest_lq
(View
x
, View y) {
59
if
(x.max() <= y.min())
return
RT_TRUE
;
60
if
(x.min() > y.max())
return
RT_FALSE
;
61
return
RT_MAYBE
;
62
}
63
64
template
<
class
View>
65
forceinline
RelTest
66
rtest_lq
(View
x
,
FloatVal
n
) {
67
if
(x.max() <= n.
min
())
return
RT_TRUE
;
68
if
(x.min() > n.
max
())
return
RT_FALSE
;
69
return
RT_MAYBE
;
70
}
71
72
template
<
class
View>
73
forceinline
RelTest
74
rtest_le
(View
x
, View y) {
75
if
(x.max() < y.min())
return
RT_TRUE
;
76
if
(x.min() >= y.max())
return
RT_FALSE
;
77
return
RT_MAYBE
;
78
}
79
80
template
<
class
View>
81
forceinline
RelTest
82
rtest_le
(View
x
,
FloatVal
n
) {
83
if
(x.max() < n.
min
())
return
RT_TRUE
;
84
if
(x.min() >= n.
max
())
return
RT_FALSE
;
85
return
RT_MAYBE
;
86
}
87
88
}}
89
90
// STATISTICS: float-var
91