Generated on Sat Nov 9 2013 19:18:25 for Gecode by doxygen 1.8.4
val-sel.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, 2012
9  * Vincent Barichard, 2012
10  *
11  * Last modified:
12  * $Date: 2013-05-29 13:53:43 +0200 (Wed, 29 May 2013) $ by $Author: schulte $
13  * $Revision: 13672 $
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 {
41 
42  forceinline Archive&
44  return e << nl.n << nl.l;
45  }
46 
47  forceinline Archive&
49  return e >> nl.n >> nl.l;
50  }
51 
52 }
53 
54 namespace Gecode { namespace Float { namespace Branch {
55 
57  ValSelLq::ValSelLq(Space& home, const ValBranch& vb)
58  : ValSel<FloatView,FloatNumBranch>(home,vb) {}
61  : ValSel<FloatView,FloatNumBranch>(home,shared,vs) {}
63  ValSelLq::val(const Space&, FloatView x, int) {
64  FloatNumBranch nl;
65  nl.n = x.med(); nl.l = true;
66  return nl;
67  }
68 
70  ValSelGq::ValSelGq(Space& home, const ValBranch& vb)
71  : ValSel<FloatView,FloatNumBranch>(home,vb) {}
74  : ValSel<FloatView,FloatNumBranch>(home,shared,vs) {}
76  ValSelGq::val(const Space&, FloatView x, int) {
77  FloatNumBranch nl;
78  nl.n = x.med(); nl.l = false;
79  return nl;
80  }
81 
84  : ValSel<FloatView,FloatNumBranch>(home,vb), r(vb.rnd()) {}
87  : ValSel<FloatView,FloatNumBranch>(home,shared,vs) {
88  r.update(home,shared,vs.r);
89  }
91  ValSelRnd::val(const Space&, FloatView x, int) {
92  FloatNumBranch nl;
93  nl.n = x.med(); nl.l = (r(2U) == 0U);
94  return nl;
95  }
96  forceinline bool
97  ValSelRnd::notice(void) const {
98  return true;
99  }
100  forceinline void
102  r.~Rnd();
103  }
104 
105 }}}
106 
107 // STATISTICS: float-branch
108