main page
modules
namespaces
classes
files
Gecode home
Generated on Wed Jan 1 2020 10:37:59 for Gecode by
doxygen
1.8.16
gecode
float
branch
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
36
namespace
Gecode
{
37
38
forceinline
Archive&
39
operator <<
(
Archive
& e,
FloatNumBranch
nl) {
40
return
e << nl.
n
<< nl.
l
;
41
}
42
43
forceinline
Archive&
44
operator >>
(
Archive
& e,
FloatNumBranch
& nl) {
45
return
e >> nl.
n
>> nl.
l
;
46
}
47
48
}
49
50
namespace
Gecode
{
namespace
Float {
namespace
Branch {
51
52
forceinline
53
ValSelLq::ValSelLq
(
Space
& home,
const
ValBranch<Var>
& vb)
54
:
ValSel
<
FloatView
,
FloatNumBranch
>(home,vb) {}
55
forceinline
56
ValSelLq::ValSelLq
(
Space
& home,
ValSelLq
& vs)
57
:
ValSel
<
FloatView
,
FloatNumBranch
>(home,vs) {}
58
forceinline
FloatNumBranch
59
ValSelLq::val
(
const
Space
&,
FloatView
x
,
int
) {
60
FloatNumBranch
nl;
61
nl.
n
=
x
.med(); nl.
l
=
true
;
62
return
nl;
63
}
64
65
forceinline
66
ValSelGq::ValSelGq
(
Space
& home,
const
ValBranch<Var>
& vb)
67
:
ValSel
<
FloatView
,
FloatNumBranch
>(home,vb) {}
68
forceinline
69
ValSelGq::ValSelGq
(
Space
& home,
ValSelGq
& vs)
70
:
ValSel
<
FloatView
,
FloatNumBranch
>(home,vs) {}
71
forceinline
FloatNumBranch
72
ValSelGq::val
(
const
Space
&,
FloatView
x
,
int
) {
73
FloatNumBranch
nl;
74
nl.
n
=
x
.med(); nl.
l
=
false
;
75
return
nl;
76
}
77
78
forceinline
79
ValSelRnd::ValSelRnd
(
Space
& home,
const
ValBranch<Var>
& vb)
80
:
ValSel
<
FloatView
,
FloatNumBranch
>(home,vb),
r
(vb.rnd()) {}
81
forceinline
82
ValSelRnd::ValSelRnd
(
Space
& home,
ValSelRnd
& vs)
83
:
ValSel
<
FloatView
,
FloatNumBranch
>(home,vs),
r
(vs.
r
) {
84
}
85
forceinline
FloatNumBranch
86
ValSelRnd::val
(
const
Space
&,
FloatView
x
,
int
) {
87
FloatNumBranch
nl;
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
96
ValSelRnd::dispose
(
Space
&) {
97
r
.
~Rnd
();
98
}
99
100
}}}
101
102
// STATISTICS: float-branch
103
Gecode::FloatNumBranch::l
bool l
Whether to try the lower or upper half first.
Definition:
float.hh:1467
Gecode::x
Post propagator for SetVar x
Definition:
set.hh:767
Gecode::operator>>
Archive & operator>>(Archive &e, FloatNumBranch &nl)
Definition:
val-sel.hpp:44
Gecode::Float::Branch::ValSelRnd::ValSelRnd
ValSelRnd(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition:
val-sel.hpp:79
Gecode::Float::Branch::ValSelRnd::notice
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition:
val-sel.hpp:92
Gecode::ValSel
Base class for value selection.
Definition:
val-sel.hpp:44
Gecode::Rnd::~Rnd
~Rnd(void)
Destructor.
Definition:
rnd.cpp:68
Gecode::Float::Branch::ValSelRnd::r
Rnd r
The used random number generator.
Definition:
branch.hh:260
Gecode::Archive
Archive representation
Definition:
archive.hpp:42
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode::Float::Branch::ValSelLq::ValSelLq
ValSelLq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition:
val-sel.hpp:53
Gecode::Float::Branch::ValSelGq::val
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition:
val-sel.hpp:72
Gecode
Gecode toplevel namespace
Gecode::Float::FloatView
Float view for float variables.
Definition:
view.hpp:52
Gecode::Float::Branch::ValSelRnd::dispose
void dispose(Space &home)
Delete value selection.
Definition:
val-sel.hpp:96
Gecode::Float::Branch::ValSelRnd
Value selection class for random value of view.
Definition:
branch.hh:257
Gecode::r
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition:
set.hh:767
Gecode::FloatNumBranch
Value description class for branching.
Definition:
float.hh:1462
Gecode::ValBranch
Value branching information.
Definition:
val.hpp:41
Gecode::FloatNumBranch::n
FloatNum n
The middle value for branching.
Definition:
float.hh:1465
Gecode::Float::Branch::ValSelLq
Value selection class for values smaller than median of view.
Definition:
branch.hh:225
Gecode::Float::Branch::ValSelLq::val
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition:
val-sel.hpp:59
forceinline
#define forceinline
Definition:
config.hpp:185
Gecode::Float::Branch::ValSelRnd::val
FloatNumBranch val(const Space &home, FloatView x, int i)
Return value of view x at position i.
Definition:
val-sel.hpp:86
Gecode::Float::Branch::ValSelGq::ValSelGq
ValSelGq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition:
val-sel.hpp:66
Gecode::Float::Branch::ValSelGq
Value selection class for values smaller than median of view.
Definition:
branch.hh:241
Gecode::operator<<
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition:
val-sel.hpp:39