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
member.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
*
6
* Copyright:
7
* Christian Schulte, 2011
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
#ifndef __GECODE_INT_MEMBER_HH__
35
#define __GECODE_INT_MEMBER_HH__
36
37
#include <
gecode/int.hh
>
38
#include <
gecode/int/val-set.hh
>
39
45
namespace
Gecode
{
namespace
Int {
namespace
Member {
46
53
template
<
class
View>
54
class
Prop
:
public
NaryOnePropagator
<View,PC_INT_DOM> {
55
protected
:
56
using
NaryOnePropagator<View,PC_INT_DOM>::x
;
57
using
NaryOnePropagator<View,PC_INT_DOM>::y
;
59
ValSet
vs
;
61
static
void
add
(
Space
& home,
ValSet
&
vs
,
ViewArray<View>
&
x
);
63
void
eliminate
(
Space
& home);
65
Prop
(
Home
home,
ValSet
&
vs
,
ViewArray<View>
&
x
, View
y
);
67
Prop
(
Space
& home,
Prop<View>
&
p
);
68
public
:
70
virtual
PropCost
cost
(
const
Space
&,
const
ModEventDelta
&
med
)
const
;
72
virtual
Propagator
*
copy
(
Space
& home);
74
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
76
static
ExecStatus
post
(
Home
home,
ViewArray<View>
&
x
, View
y
);
78
static
ExecStatus
post
(
Home
home,
ValSet
&
vs
,
ViewArray<View>
&
x
, View
y
);
80
virtual
size_t
dispose
(
Space
& home);
81
};
82
89
template
<
class
View, ReifyMode rm>
90
class
ReProp
:
public
Prop
<View> {
91
protected
:
92
using
Prop<View>::x
;
93
using
Prop<View>::y
;
94
using
Prop<View>::vs
;
95
using
Prop<View>::add
;
96
using
Prop<View>::eliminate
;
98
BoolView
b
;
100
ReProp
(
Home
home,
ValSet
&
vs
,
ViewArray<View>
&
x
, View
y
,
BoolView
b
);
102
ReProp
(
Space
& home,
ReProp<View,rm>
&
p
);
103
public
:
105
virtual
Propagator
*
copy
(
Space
& home);
107
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
109
static
ExecStatus
post
(
Home
home,
ViewArray<View>
&
x
, View
y
,
BoolView
b
);
111
virtual
size_t
dispose
(
Space
& home);
112
};
113
114
}}}
115
116
#include <
gecode/int/member/prop.hpp
>
117
#include <
gecode/int/member/re-prop.hpp
>
118
119
#endif
120
121
// STATISTICS: int-prop
Gecode::Int::Member::Prop::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition:
prop.hpp:133
Gecode::Int::Member::Prop::post
static ExecStatus post(Home home, ViewArray< View > &x, View y)
Post propagator for .
Definition:
prop.hpp:71
Gecode::Int::ValSet
Class for storing values of already assigned views.
Definition:
val-set.hh:44
Gecode::Int::Member::ReProp::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition:
re-prop.hpp:115
Gecode::NaryOnePropagator< View, PC_INT_DOM >::y
View y
Single view.
Definition:
pattern.hpp:177
int.hh
Gecode::Int::Member::Prop::vs
ValSet vs
Value set storing the values of already assigned views.
Definition:
member.hh:59
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode::Int::Member::Prop::eliminate
void eliminate(Space &home)
Eliminate views from x that are not equal to y or ar subsumed by vs.
Definition:
prop.hpp:58
Gecode::NaryOnePropagator< View, PC_INT_DOM >::x
ViewArray< View > x
Array of views.
Definition:
pattern.hpp:175
Gecode::Int::BoolView
Boolean view for Boolean variables.
Definition:
view.hpp:1380
Gecode
Gecode toplevel namespace
Gecode::Propagator
Base-class for propagators.
Definition:
core.hpp:1064
Gecode::Int::Member::ReProp::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition:
re-prop.hpp:107
Gecode::Int::Member::Prop::cost
virtual PropCost cost(const Space &, const ModEventDelta &med) const
Cost function.
Definition:
prop.hpp:127
Gecode::Home
Home class for posting propagators
Definition:
core.hpp:856
Gecode::NaryOnePropagator
(n+1)-ary propagator
Definition:
pattern.hpp:172
val-set.hh
Gecode::Propagator::med
ModEventDelta med
A set of modification events (used during propagation)
Definition:
core.hpp:1075
Gecode::Int::Member::ReProp::ReProp
ReProp(Home home, ValSet &vs, ViewArray< View > &x, View y, BoolView b)
Constructor for posting.
Definition:
re-prop.hpp:40
Gecode::PropCost
Propagation cost.
Definition:
core.hpp:486
Gecode::Int::Member::ReProp::b
BoolView b
Boolean control variable.
Definition:
member.hh:98
Gecode::Int::Member::ReProp::copy
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
Definition:
re-prop.hpp:101
Gecode::Int::Member::Prop::add
static void add(Space &home, ValSet &vs, ViewArray< View > &x)
Add values of assigned views in x to value set va.
Definition:
prop.hpp:46
Gecode::Int::Member::Prop::Prop
Prop(Home home, ValSet &vs, ViewArray< View > &x, View y)
Constructor for posting.
Definition:
prop.hpp:40
Gecode::Int::Member::Prop::copy
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
Definition:
prop.hpp:113
Gecode::ViewArray
View arrays.
Definition:
array.hpp:253
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition:
core.hpp:89
Gecode::Int::Member::ReProp::post
static ExecStatus post(Home home, ViewArray< View > &x, View y, BoolView b)
Post propagator for .
Definition:
re-prop.hpp:48
re-prop.hpp
p
int p
Number of positive literals for node type.
Definition:
bool-expr.cpp:232
Gecode::Int::Member::Prop::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition:
prop.hpp:119
prop.hpp
Gecode::Int::Member::Prop
Membership propagator.
Definition:
member.hh:54
Gecode::ExecStatus
ExecStatus
Definition:
core.hpp:472
Gecode::Int::Member::ReProp
Reified membership propagator.
Definition:
member.hh:90