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
rel
nq.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: 2016-04-19 17:19:45 +0200 (Tue, 19 Apr 2016) $ by $Author: schulte $
13
* $Revision: 14967 $
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
Rel {
41
42
/*
43
* Disequality
44
*
45
*/
46
template
<
class
View0,
class
View1>
47
forceinline
48
Nq<View0,View1>::Nq
(
Home
home, View0 x0, View1 x1)
49
:
MixBinaryPropagator
<View0,
PC_FLOAT_VAL
,View1,
PC_FLOAT_VAL
>(home,x0,x1) {}
50
51
template
<
class
View0,
class
View1>
52
ExecStatus
53
Nq<View0,View1>::post
(
Home
home, View0 x0, View1 x1){
54
if
(x0.assigned() && x1.assigned()) {
55
if
(
overlap
(x0.val(),x1.val()))
56
return
ES_FAILED
;
57
}
else
if
(
same
(x0,x1)) {
58
return
ES_FAILED
;
59
}
else
{
60
(void)
new
(home)
Nq<View0,View1>
(home,x0,x1);
61
}
62
return
ES_OK
;
63
}
64
65
template
<
class
View0,
class
View1>
66
forceinline
67
Nq<View0,View1>::Nq
(
Space
& home,
bool
share,
Nq<View0,View1>
&
p
)
68
:
MixBinaryPropagator
<View0,
PC_FLOAT_VAL
,View1,
PC_FLOAT_VAL
>(home,share,
p
) {}
69
70
template
<
class
View0,
class
View1>
71
Actor
*
72
Nq<View0,View1>::copy
(
Space
& home,
bool
share) {
73
return
new
(home)
Nq<View0,View1>
(home,share,*
this
);
74
}
75
76
template
<
class
View0,
class
View1>
77
ExecStatus
78
Nq<View0,View1>::propagate
(
Space
& home,
const
ModEventDelta
&) {
79
if
(x0.assigned() && x1.assigned()) {
80
return
overlap
(x0.val(),x1.val()) ?
ES_FAILED
: home.
ES_SUBSUMED
(*
this
);
81
}
82
return
ES_FIX
;
83
}
84
85
/*
86
* Disequality with float value
87
*
88
*/
89
template
<
class
View>
90
forceinline
91
NqFloat<View>::NqFloat
(
Home
home, View
x
,
FloatVal
_c
)
92
:
UnaryPropagator
<View,
PC_FLOAT_VAL
>(home,
x
),
c
(
_c
) {}
93
94
template
<
class
View>
95
ExecStatus
96
NqFloat<View>::post
(
Home
home, View
x
,
FloatVal
c
){
97
if
(
x
.
assigned
()) {
98
if
(
overlap
(
x
.val(),
c
))
99
return
ES_FAILED
;
100
}
else
{
101
(void)
new
(home)
NqFloat<View>
(home,
x
,
c
);
102
}
103
return
ES_OK
;
104
}
105
106
template
<
class
View>
107
forceinline
108
NqFloat<View>::NqFloat
(
Space
& home,
bool
share,
NqFloat<View>
&
p
)
109
:
UnaryPropagator
<View,
PC_FLOAT_VAL
>(home,share,
p
),
c
(
p
.
c
) {}
110
111
template
<
class
View>
112
Actor
*
113
NqFloat<View>::copy
(
Space
& home,
bool
share) {
114
return
new
(home)
NqFloat<View>
(home,share,*
this
);
115
}
116
117
template
<
class
View>
118
ExecStatus
119
NqFloat<View>::propagate
(
Space
& home,
const
ModEventDelta
&) {
120
if
(x0.assigned()) {
121
return
(
overlap
(x0.val(),
c
)) ?
ES_FAILED
: home.
ES_SUBSUMED
(*
this
);
122
}
123
return
ES_FIX
;
124
}
125
126
127
128
}}}
129
130
// STATISTICS: float-prop
Gecode::Float::PC_FLOAT_VAL
const Gecode::PropCond PC_FLOAT_VAL
Propagate when a view becomes assigned (single value)
Definition:
var-type.hpp:283
Gecode::Float::Rel::NqFloat
Binary bounds consistent disequality propagator with float value.
Definition:
rel.hh:211
Gecode::x
Post propagator for SetVar x
Definition:
set.hh:784
forceinline
#define forceinline
Definition:
config.hpp:173
Gecode::Float::Rel::NqFloat::NqFloat
NqFloat(Space &home, bool share, NqFloat< View > &p)
Constructor for cloning p.
Definition:
nq.hpp:108
Gecode::Space::ES_SUBSUMED
ExecStatus ES_SUBSUMED(Propagator &p)
Definition:
core.hpp:3614
Gecode::Int::BinPacking::same
bool same(const Item &i, const Item &j)
Whether two items are the same.
Definition:
propagate.hpp:76
Gecode::Float::Rel::Nq::post
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition:
nq.hpp:53
Gecode::Space
Computation spaces.
Definition:
core.hpp:1748
Gecode::Actor
Base-class for both propagators and branchers.
Definition:
core.hpp:696
Gecode::Float::Rel::Nq::Nq
Nq(Space &home, bool share, Nq< View0, View1 > &p)
Constructor for cloning p.
Definition:
nq.hpp:67
Gecode::VarImpVar::assigned
bool assigned(void) const
Test whether view is assigned.
Definition:
var.hpp:123
Gecode
Gecode toplevel namespace
Gecode::MixBinaryPropagator
Mixed binary propagator.
Definition:
propagator.hpp:213
Gecode::Float::Rel::Nq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition:
nq.hpp:78
Gecode::Home
Home class for posting propagators
Definition:
core.hpp:922
Gecode::Float::Rel::Nq
Binary bounds consistent disequality propagator.
Definition:
rel.hh:183
Gecode::Float::Rel::NqFloat::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition:
nq.hpp:119
Test::Int::Precede::_c
Multi _c(Gecode::IntArgs(3, 1, 2, 3))
Gecode::Float::Rel::NqFloat::copy
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition:
nq.hpp:113
Gecode::Float::Rel::Nq::copy
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition:
nq.hpp:72
Gecode::FloatVal
Float value type.
Definition:
float.hh:338
Gecode::Float::Rel::NqFloat::post
static ExecStatus post(Home home, View x0, FloatVal c)
Post bounds consistent propagator .
Definition:
nq.hpp:96
Gecode::Float::overlap
bool overlap(const FloatVal &x, const FloatVal &y)
Definition:
val.hpp:502
Gecode::ES_FIX
@ ES_FIX
Propagation has computed fixpoint.
Definition:
core.hpp:545
Gecode::UnaryPropagator
Unary propagator.
Definition:
propagator.hpp:59
Test::Float::Arithmetic::c
Gecode::FloatVal c(-8, 8)
Gecode::ES_FAILED
@ ES_FAILED
Execution has resulted in failure.
Definition:
core.hpp:542
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