main page
modules
namespaces
classes
files
Gecode home
Generated on Sat Nov 9 2013 19:18:27 for Gecode by
doxygen
1.8.4
gecode
set
channel.hh
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* Denys Duchier <denys.duchier@univ-orleans.fr>
5
* Guido Tack <tack@gecode.org>
6
* Christian Schulte <schulte@gecode.org>
7
*
8
* Copyright:
9
* Denys Duchier, 2011
10
* Guido Tack, 2011
11
* Christian Schulte, 2004
12
*
13
* Last modified:
14
* $Date: 2011-11-03 11:52:07 +0100 (Thu, 03 Nov 2011) $ by $Author: tack $
15
* $Revision: 12452 $
16
*
17
* This file is part of Gecode, the generic constraint
18
* development environment:
19
* http://www.gecode.org
20
*
21
* Permission is hereby granted, free of charge, to any person obtaining
22
* a copy of this software and associated documentation files (the
23
* "Software"), to deal in the Software without restriction, including
24
* without limitation the rights to use, copy, modify, merge, publish,
25
* distribute, sublicense, and/or sell copies of the Software, and to
26
* permit persons to whom the Software is furnished to do so, subject to
27
* the following conditions:
28
*
29
* The above copyright notice and this permission notice shall be
30
* included in all copies or substantial portions of the Software.
31
*
32
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
*
40
*/
41
42
#ifndef __GECODE_SET_CHANNEL_HH__
43
#define __GECODE_SET_CHANNEL_HH__
44
45
#include <
gecode/set.hh
>
46
47
namespace
Gecode {
namespace
Set {
namespace
Channel {
48
63
template
<
class
View>
64
class
ChannelSorted
:
public
Propagator
{
65
protected
:
67
View
x0
;
69
ViewArray<Gecode::Int::IntView>
xs
;
70
72
ChannelSorted
(
Space
& home,
bool
share,
ChannelSorted
&
p
);
74
ChannelSorted
(
Home
home, View,
ViewArray<Gecode::Int::IntView>
&);
75
public
:
77
virtual
Actor
*
copy
(
Space
& home,
bool
);
79
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
81
virtual
size_t
dispose
(
Space
& home);
83
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
85
static
ExecStatus
post
(
Home
home, View s,
86
ViewArray<Gecode::Int::IntView>
&
x
);
87
};
88
106
template
<
class
View>
107
class
ChannelInt
:
public
Propagator
{
108
protected
:
110
ViewArray<Gecode::Int::CachedView<Gecode::Int::IntView>
>
xs
;
112
ViewArray<CachedView<View>
>
ys
;
113
115
ChannelInt
(
Space
& home,
bool
share,
ChannelInt
&
p
);
117
ChannelInt
(
Home
home,
118
ViewArray
<
Gecode::Int::CachedView<Gecode::Int::IntView>
>&,
119
ViewArray
<
CachedView<View>
>&);
120
public
:
122
virtual
Actor
*
copy
(
Space
& home,
bool
);
124
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
126
virtual
size_t
dispose
(
Space
& home);
128
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
130
static
ExecStatus
post
(
Home
home,
131
ViewArray
<
Gecode::Int::CachedView
<
132
Gecode::Int::IntView
> >&
x
,
133
ViewArray
<
CachedView<View>
>& y);
134
};
135
147
template
<
class
View>
148
class
ChannelBool
149
:
public
MixNaryOnePropagator
<Gecode::Int::BoolView,
150
Gecode::Int::PC_BOOL_VAL,
151
View,PC_GEN_NONE> {
152
protected
:
153
typedef
MixNaryOnePropagator
<
Gecode::Int::BoolView
,
154
Gecode::Int::PC_BOOL_VAL
,
155
View,
PC_GEN_NONE
>
Super
;
156
using
Super::x
;
157
using
Super::y
;
158
160
ChannelBool
(
Space
& home,
bool
share,
ChannelBool
&
p
);
162
ChannelBool
(
Home
home,
ViewArray<Gecode::Int::BoolView>
&,
163
View);
164
166
class
IndexAdvisor
:
public
Advisor
{
167
protected
:
169
int
idx
;
170
public
:
172
template
<
class
A>
173
IndexAdvisor
(
Space
& home,
ChannelBool<View>
&
p
,
Council<A>
&
c
,
174
int
index
);
176
IndexAdvisor
(
Space
& home,
bool
share,
IndexAdvisor
&
a
);
178
int
index
(
void
)
const
;
180
template
<
class
A>
181
void
dispose
(
Space
& home,
Council<A>
&
c
);
182
};
183
185
Council<IndexAdvisor>
co
;
187
SetDelta
delta
;
189
GLBndSet
zeros
;
191
GLBndSet
ones
;
193
bool
running
;
194
public
:
196
virtual
Actor
*
copy
(
Space
& home,
bool
);
198
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
200
virtual
size_t
dispose
(
Space
& home);
202
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
204
virtual
ExecStatus
advise
(
Space
& home,
Advisor
&
a
,
const
Delta
&
d
);
206
static
ExecStatus
post
(
Home
home,
ViewArray<Gecode::Int::BoolView>
&
x
,
207
View
y
);
208
};
209
223
template
<
typename
View>
224
class
ChannelSet
:
public
Propagator
{
225
protected
:
227
ViewArray<CachedView<View>
>
xs
;
229
ViewArray<CachedView<View>
>
ys
;
230
232
ChannelSet
(
Space
& home,
bool
share,
ChannelSet
&
p
);
234
ChannelSet
(
Home
home,
235
ViewArray
<
CachedView<View>
>&,
236
ViewArray
<
CachedView<View>
>&);
237
public
:
239
virtual
Actor
*
copy
(
Space
& home,
bool
);
241
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
243
virtual
size_t
dispose
(
Space
& home);
245
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
247
static
ExecStatus
post
(
Home
home,
248
ViewArray
<
CachedView<View>
>&
x
,
249
ViewArray
<
CachedView<View>
>& y);
250
};
251
252
}}}
253
254
#include <
gecode/set/channel/sorted.hpp
>
255
#include <
gecode/set/channel/int.hpp
>
256
#include <
gecode/set/channel/bool.hpp
>
257
#include <
gecode/set/channel/set.hpp
>
258
259
#endif
260
261
// STATISTICS: set-prop