Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
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 * This file is part of Gecode, the generic constraint
12 * development environment:
13 * http://www.gecode.org
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining
16 * a copy of this software and associated documentation files (the
17 * "Software"), to deal in the Software without restriction, including
18 * without limitation the rights to use, copy, modify, merge, publish,
19 * distribute, sublicense, and/or sell copies of the Software, and to
20 * permit persons to whom the Software is furnished to do so, subject to
21 * the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be
24 * included in all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 *
34 */
35
36namespace Gecode {
37
40 return e << nl.n << nl.l;
41 }
42
43 forceinline Archive&
45 return e >> nl.n >> nl.l;
46 }
47
48}
49
50namespace Gecode { namespace Float { namespace Branch {
51
61 nl.n = x.med(); nl.l = true;
62 return nl;
63 }
64
74 nl.n = x.med(); nl.l = false;
75 return nl;
76 }
77
80 : ValSel<FloatView,FloatNumBranch>(home,vb), r(vb.rnd()) {}
83 : ValSel<FloatView,FloatNumBranch>(home,vs), r(vs.r) {
84 }
88 nl.n = x.med(); nl.l = (r(2U) == 0U);
89 return nl;
90 }
91 forceinline bool
92 ValSelRnd::notice(void) const {
93 return true;
94 }
95 forceinline void
99
100}}}
101
102// STATISTICS: float-branch
103
Archive representation
Definition archive.hpp:42
Value description class for branching.
Definition float.hh:1462
bool l
Whether to try the lower or upper half first.
Definition float.hh:1467
FloatNum n
The middle value for branching.
Definition float.hh:1465
Value selection class for values smaller than median of view.
Definition branch.hh:241
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:72
ValSelGq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:66
Value selection class for values smaller than median of view.
Definition branch.hh:225
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:59
ValSelLq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:53
Value selection class for random value of view.
Definition branch.hh:257
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition val-sel.hpp:86
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition val-sel.hpp:92
ValSelRnd(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition val-sel.hpp:79
void dispose(Space &home)
Delete value selection.
Definition val-sel.hpp:96
Rnd r
The used random number generator.
Definition branch.hh:260
Float view for float variables.
Definition view.hpp:52
~Rnd(void)
Destructor.
Definition rnd.cpp:68
Computation spaces.
Definition core.hpp:1742
Value branching information.
Definition val.hpp:41
Base class for value selection.
Definition val-sel.hpp:44
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition set.hh:767
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition val-sel.hpp:39
Archive & operator>>(Archive &e, FloatNumBranch &nl)
Definition val-sel.hpp:44
Post propagator for SetVar x
Definition set.hh:767
#define forceinline
Definition config.hpp:187