main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Mar 5 2013 22:37:19 for Gecode by
doxygen
1.8.3.1
gecode
int
distinct.hh
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
* Guido Tack <tack@gecode.org>
6
*
7
* Contributing authors:
8
* Gabor Szokoli <szokoli@gecode.org>
9
*
10
* Copyright:
11
* Christian Schulte, 2002
12
* Guido Tack, 2004
13
* Gabor Szokoli, 2003
14
*
15
* Last modified:
16
* $Date: 2011-10-07 02:27:42 +1100 (Fri, 07 Oct 2011) $ by $Author: schulte $
17
* $Revision: 12423 $
18
*
19
* This file is part of Gecode, the generic constraint
20
* development environment:
21
* http://www.gecode.org
22
*
23
* Permission is hereby granted, free of charge, to any person obtaining
24
* a copy of this software and associated documentation files (the
25
* "Software"), to deal in the Software without restriction, including
26
* without limitation the rights to use, copy, modify, merge, publish,
27
* distribute, sublicense, and/or sell copies of the Software, and to
28
* permit persons to whom the Software is furnished to do so, subject to
29
* the following conditions:
30
*
31
* The above copyright notice and this permission notice shall be
32
* included in all copies or substantial portions of the Software.
33
*
34
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41
*
42
*/
43
44
#ifndef __GECODE_INT_DISTINCT_HH__
45
#define __GECODE_INT_DISTINCT_HH__
46
47
#include <
gecode/int.hh
>
48
49
#include <
gecode/int/view-val-graph.hh
>
50
#include <
gecode/int/rel.hh
>
51
57
namespace
Gecode {
namespace
Int {
namespace
Distinct {
58
67
template
<
class
View>
68
class
Val
:
public
NaryPropagator
<View,PC_INT_VAL> {
69
protected
:
70
using
NaryPropagator<View,PC_INT_VAL>::x
;
71
73
Val
(
Home
home,
ViewArray<View>
&
x
);
75
Val
(
Space
& home,
bool
share,
Val<View>
& p);
76
public
:
78
virtual
Actor
*
copy
(
Space
& home,
bool
share);
80
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
82
static
ExecStatus
post
(
Home
home,
ViewArray<View>
& x);
83
};
84
98
template
<
class
View,
bool
complete>
99
ExecStatus
prop_val
(
Space
& home,
ViewArray<View>
&);
100
101
102
128
template
<
class
View>
129
class
Bnd
:
public
Propagator
{
130
protected
:
132
ViewArray<View>
x
;
134
ViewArray<View>
y
;
136
int
min_x
;
138
int
max_x
;
140
Bnd
(
Home
home,
ViewArray<View>
&
x
);
142
Bnd
(
Space
& home,
bool
share,
Bnd<View>
& p);
143
public
:
145
static
ExecStatus
post
(
Home
home,
ViewArray<View>
&
x
);
147
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
154
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
156
virtual
Actor
*
copy
(
Space
& home,
bool
share);
158
virtual
size_t
dispose
(
Space
& home);
159
};
160
169
template
<
class
View>
170
ExecStatus
prop_bnd
(
Space
& home,
ViewArray<View>
& x,
int
& min_x,
int
& max_x);
171
180
template
<
class
View>
181
ExecStatus
prop_bnd
(
Space
& home,
ViewArray<View>
& x);
182
183
185
template
<
class
View>
186
class
Graph
:
public
ViewValGraph::Graph
<View> {
187
public
:
188
using
ViewValGraph::Graph<View>::view
;
189
using
ViewValGraph::Graph<View>::n_view
;
190
using
ViewValGraph::Graph<View>::val
;
191
using
ViewValGraph::Graph<View>::n_val
;
192
using
ViewValGraph::Graph<View>::count
;
193
using
ViewValGraph::Graph<View>::scc
;
194
using
ViewValGraph::Graph<View>::match
;
196
Graph
(
void
);
198
ExecStatus
init
(
Space
& home,
ViewArray<View>
& x);
200
bool
mark
(
Space
& home);
202
ExecStatus
prune
(
Space
& home,
bool
&
assigned
);
204
bool
sync
(
Space
& home);
205
};
206
217
template
<
class
View>
218
class
DomCtrl
{
219
protected
:
221
Graph<View>
g
;
222
public
:
224
DomCtrl
(
void
);
226
bool
available
(
void
);
228
ExecStatus
init
(
Space
& home,
ViewArray<View>
& x);
230
ExecStatus
sync
(
Space
& home);
232
ExecStatus
propagate
(
Space
& home,
bool
&
assigned
);
233
};
234
250
template
<
class
View>
251
class
Dom
:
public
NaryPropagator
<View,PC_INT_DOM> {
252
protected
:
253
using
NaryPropagator<View,PC_INT_DOM>::x
;
255
DomCtrl<View>
dc
;
257
Dom
(
Space
& home,
bool
share,
Dom<View>
& p);
259
Dom
(
Home
home,
ViewArray<View>
&
x
);
260
public
:
262
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
269
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
271
virtual
Actor
*
copy
(
Space
& home,
bool
share);
273
static
ExecStatus
post
(
Home
home,
ViewArray<View>
&
x
);
274
};
275
282
template
<
class
View>
283
class
TerDom
:
public
TernaryPropagator
<View,PC_INT_DOM> {
284
protected
:
285
using
TernaryPropagator<View,PC_INT_DOM>::x0
;
286
using
TernaryPropagator<View,PC_INT_DOM>::x1
;
287
using
TernaryPropagator<View,PC_INT_DOM>::x2
;
288
290
TerDom
(
Space
& home,
bool
share,
TerDom<View>
& p);
292
TerDom
(
Home
home, View
x0
, View
x1
, View
x2
);
293
public
:
295
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
297
virtual
Actor
*
copy
(
Space
& home,
bool
share);
299
static
ExecStatus
post
(
Home
home, View x0, View x1, View x2);
300
};
301
302
}}}
303
304
#include <
gecode/int/distinct/val.hpp
>
305
#include <
gecode/int/distinct/bnd.hpp
>
306
#include <
gecode/int/distinct/ter-dom.hpp
>
307
#include <
gecode/int/distinct/graph.hpp
>
308
#include <
gecode/int/distinct/dom-ctrl.hpp
>
309
#include <
gecode/int/distinct/dom.hpp
>
310
311
#endif
312
313
// STATISTICS: int-prop
314