Generated on Sat Feb 7 2015 02:01:18 for Gecode by doxygen 1.8.9.1
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>
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>
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>
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>
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>
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>
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 
RelTest rtest_lq(View x, View y)
Test whether view x is less or equal than view y.
Definition: rel-test.hpp:58
RelTest
Result of testing relation.
Definition: view.hpp:495
Relation does hold.
Definition: view.hpp:498
Relation does not hold.
Definition: view.hpp:496
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
RelTest
Result of testing relation.
Definition: view.hpp:1614
Float value type.
Definition: float.hh:321
RelTest rtest_eq(View x, View y)
Test whether views x and y are equal.
Definition: rel-test.hpp:44
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
#define forceinline
Definition: config.hpp:132
RelTest rtest_le(View x, View y)
Test whether view x is less than view y.
Definition: rel-test.hpp:74
Gecode toplevel namespace
Relation may hold or not.
Definition: view.hpp:497
friend FloatVal max(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:390
friend FloatVal min(const FloatVal &x, const FloatVal &y)
Definition: val.hpp:402