main page
modules
namespaces
classes
files
Gecode home
Generated on Fri Jan 10 2020 11:38:25 for Gecode by
doxygen
1.8.16
gecode
int
channel
base.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
*
6
* Copyright:
7
* Christian Schulte, 2006
8
*
9
* This file is part of Gecode, the generic constraint
10
* development environment:
11
* http://www.gecode.org
12
*
13
* Permission is hereby granted, free of charge, to any person obtaining
14
* a copy of this software and associated documentation files (the
15
* "Software"), to deal in the Software without restriction, including
16
* without limitation the rights to use, copy, modify, merge, publish,
17
* distribute, sublicense, and/or sell copies of the Software, and to
18
* permit persons to whom the Software is furnished to do so, subject to
19
* the following conditions:
20
*
21
* The above copyright notice and this permission notice shall be
22
* included in all copies or substantial portions of the Software.
23
*
24
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
*
32
*/
33
34
namespace
Gecode
{
namespace
Int {
namespace
Channel {
35
36
template
<
class
Info,
class
Offset, PropCond pc>
37
forceinline
38
Base<Info,Offset,pc>::Base
(
Home
home,
int
n0, Info* xy0,
39
Offset
& ox0,
Offset
& oy0)
40
:
Propagator
(home),
n
(n0), n_na(2*
n
), ox(ox0), oy(oy0), xy(xy0) {
41
for
(
int
i
=0;
i
<2*
n
;
i
++)
42
xy[
i
].view.subscribe(home,*
this
,pc);
43
}
44
45
template
<
class
Info,
class
Offset, PropCond pc>
46
forceinline
47
Base<Info,Offset,pc>::Base
(
Space
& home,
Base<Info,Offset,pc>
&
p
)
48
:
Propagator
(home,
p
),
n
(
p
.
n
), n_na(
p
.n_na),
49
xy(home.alloc<Info>(2*
n
)) {
50
ox.update(
p
.ox);
51
oy.update(
p
.oy);
52
for
(
int
i
=0;
i
<2*
n
;
i
++)
53
xy[
i
].
update
(home,
p
.xy[
i
]);
54
}
55
56
template
<
class
Info,
class
Offset, PropCond pc>
57
PropCost
58
Base<Info,Offset,pc>::cost
(
const
Space
&,
const
ModEventDelta
&)
const
{
59
return
PropCost::quadratic(PropCost::LO, 2*
n
);
60
}
61
62
template
<
class
Info,
class
Offset, PropCond pc>
63
void
64
Base<Info,Offset,pc>::reschedule
(
Space
& home) {
65
for
(
int
i
=0;
i
<2*
n
;
i
++)
66
xy[
i
].view.reschedule(home,*
this
,pc);
67
}
68
69
template
<
class
Info,
class
Offset, PropCond pc>
70
forceinline
size_t
71
Base<Info,Offset,pc>::dispose
(
Space
& home) {
72
for
(
int
i
=0;
i
<2*
n
;
i
++)
73
xy[
i
].view.cancel(home,*
this
,pc);
74
(void) Propagator::dispose(home);
75
return
sizeof
(*this);
76
}
77
78
}}}
79
80
// STATISTICS: int-prop
81
Gecode::Int::Offset
Converter with fixed offset.
Definition:
view.hpp:650
Gecode::Int::Channel::Base::Base
Base(Space &home, Base< Info, Offset, pc > &p)
Constructor for cloning p.
Definition:
base.hpp:47
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode::Int::Channel::Base
Base-class for channel propagators.
Definition:
channel.hh:55
Gecode
Gecode toplevel namespace
Gecode::Propagator
Base-class for propagators.
Definition:
core.hpp:1064
Gecode::Int::Count::update
void update(IntSet &y, Space &home, IntSet &py)
Definition:
rel.hpp:103
Gecode::Int::Count::reschedule
void reschedule(Space &home, Propagator &p, IntSet &y)
Definition:
rel.hpp:92
Gecode::Home
Home class for posting propagators
Definition:
core.hpp:856
Gecode::PropCost
Propagation cost.
Definition:
core.hpp:486
forceinline
#define forceinline
Definition:
config.hpp:185
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:234
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition:
core.hpp:89
Test::Int::Basic::i
Gecode::IntArgs i({1, 2, 3, 4})
p
int p
Number of positive literals for node type.
Definition:
bool-expr.cpp:232