main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Jan 28 2020 00:00:00 for Gecode by
doxygen
1.8.17
gecode
float
channel
channel.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, 2004
9
* Vincent Barichard, 2012
10
*
11
* Last modified:
12
* $Date: 2017-04-10 13:21:37 +0200 (Mon, 10 Apr 2017) $ by $Author: schulte $
13
* $Revision: 15631 $
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 {
namespace
Channel
{
41
42
template
<
class
A,
class
B>
43
forceinline
44
Channel<A,B>::Channel
(
Home
home, A x0, B x1)
45
:
MixBinaryPropagator
<A,
PC_FLOAT_BND
,B,Int::
PC_INT_BND
>(home,x0,x1) {}
46
47
template
<
class
A,
class
B>
48
forceinline
49
Channel<A,B>::Channel
(
Space
& home,
bool
share,
Channel<A,B>
&
p
)
50
:
MixBinaryPropagator
<A,
PC_FLOAT_BND
,B,Int::
PC_INT_BND
>(home,share,
p
) {}
51
52
template
<
class
A,
class
B>
53
Actor
*
54
Channel<A,B>::copy
(
Space
& home,
bool
share) {
55
return
new
(home)
Channel<A,B>
(home,share,*
this
);
56
}
57
58
template
<
class
A,
class
B>
59
ExecStatus
60
Channel<A,B>::post
(
Home
home, A x0, B x1) {
61
GECODE_ME_CHECK
(x0.eq(home,
FloatVal
(
Int::Limits::min
,
62
Int::Limits::max
)));
63
(void)
new
(home)
Channel<A,B>
(home,x0,x1);
64
return
ES_OK
;
65
}
66
67
template
<
class
A,
class
B>
68
ExecStatus
69
Channel<A,B>::propagate
(
Space
& home,
const
ModEventDelta
&) {
70
GECODE_ME_CHECK
(x1.gq(home,
static_cast<
int
>
(std::ceil(x0.min()))));
71
GECODE_ME_CHECK
(x1.lq(home,
static_cast<
int
>
(std::floor(x0.max()))));
72
GECODE_ME_CHECK
(x0.eq(home,
FloatVal
(x1.min(),x1.max())));
73
return
x0.assigned() ? home.
ES_SUBSUMED
(*
this
) :
ES_FIX
;
74
}
75
76
}}}
77
78
// STATISTICS: float-prop
79
forceinline
#define forceinline
Definition:
config.hpp:173
Gecode::Space::ES_SUBSUMED
ExecStatus ES_SUBSUMED(Propagator &p)
Definition:
core.hpp:3614
Gecode::Float::Linear::post
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Definition:
post.cpp:228
Gecode::Float::PC_FLOAT_BND
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Definition:
var-type.hpp:292
Gecode::Space
Computation spaces.
Definition:
core.hpp:1748
Gecode::Actor
Base-class for both propagators and branchers.
Definition:
core.hpp:696
Gecode::Float::Channel::Channel
Propagator for bounds consistent integer part operator
Definition:
channel.hh:62
Gecode
Gecode toplevel namespace
Gecode::MixBinaryPropagator
Mixed binary propagator.
Definition:
propagator.hpp:213
Gecode::Home
Home class for posting propagators
Definition:
core.hpp:922
Gecode::Int::Limits::max
const int max
Largest allowed integer value.
Definition:
int.hh:116
Gecode::Int::PC_INT_BND
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition:
var-type.hpp:91
Gecode::FloatVal
Float value type.
Definition:
float.hh:338
Gecode::ES_FIX
@ ES_FIX
Propagation has computed fixpoint.
Definition:
core.hpp:545
Gecode::Int::Limits::min
const int min
Smallest allowed integer value.
Definition:
int.hh:118
GECODE_ME_CHECK
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition:
macros.hpp:56
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition:
core.hpp:169
Gecode::ES_OK
@ ES_OK
Execution is okay.
Definition:
core.hpp:544
p
int p
Number of positive literals for node type.
Definition:
bool-expr.cpp:236
Gecode::ExecStatus
ExecStatus
Definition:
core.hpp:540