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
int
sequence.hh
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* David Rijsman <David.Rijsman@quintiq.com>
5
*
6
* Copyright:
7
* David Rijsman, 2009
8
*
9
* Last modified:
10
* $Date: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $
11
* $Revision: 15137 $
12
*
13
* This file is part of Gecode, the generic constraint
14
* development environment:
15
* http://www.gecode.org
16
*
17
* Permission is hereby granted, free of charge, to any person obtaining
18
* a copy of this software and associated documentation files (the
19
* "Software"), to deal in the Software without restriction, including
20
* without limitation the rights to use, copy, modify, merge, publish,
21
* distribute, sublicense, and/or sell copies of the Software, and to
22
* permit persons to whom the Software is furnished to do so, subject to
23
* the following conditions:
24
*
25
* The above copyright notice and this permission notice shall be
26
* included in all copies or substantial portions of the Software.
27
*
28
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
*
36
*/
37
38
#ifndef __GECODE_INT_SEQUENCE_HH__
39
#define __GECODE_INT_SEQUENCE_HH__
40
41
#include <
gecode/int.hh
>
42
#include <
gecode/int/rel.hh
>
43
44
namespace
Gecode
{
namespace
Int {
namespace
Sequence {
45
58
template
<
class
View>
59
class
SupportAdvisor;
60
61
template
<
class
View,
class
Val,
bool
iss>
62
class
ViewValSupport;
63
68
template
<
class
View,
class
Val,
bool
iss>
69
class
ViewValSupportArray
{
70
private
:
72
ViewValSupport<View,Val,iss>
* xs;
74
int
n;
75
public
:
77
ViewValSupportArray
(
void
);
79
ViewValSupportArray
(
const
ViewValSupportArray<View,Val,iss>
&);
81
ViewValSupportArray
(
Space
& home,
ViewArray<View>
&, Val s,
int
q);
83
ViewValSupportArray
(
Space
& home,
int
n
);
85
int
size
(
void
)
const
;
87
ViewValSupport<View,Val,iss>
&
operator []
(
int
n
);
89
const
ViewValSupport<View,Val,iss>
&
operator []
(
int
)
const
;
91
void
update
(
Space
& home,
bool
share,
ViewValSupportArray<View,Val,iss>
&
x
);
93
ExecStatus
propagate
(
Space
& home,
ViewArray<View>
&
a
,Val s,
int
q,
int
l
,
int
u
);
95
ExecStatus
advise
(
Space
& home,
ViewArray<View>
&
a
,Val s,
int
q,
int
j,
const
Delta
&
d
);
96
};
97
104
template
<
class
View,
class
Val>
105
class
Sequence
:
public
Propagator
{
106
protected
:
108
Sequence
(
Space
& home,
bool
shared
,
Sequence
&
p
);
110
Sequence
(
Home
home,
ViewArray<View>
& x, Val s,
int
q,
int
l,
int
u);
111
public
:
113
virtual
Actor
*
copy
(
Space
& home,
bool
share);
115
ExecStatus
advise
(
Space
& home,
Advisor
&
_a
,
const
Delta
&
d
);
117
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
119
virtual
void
reschedule
(
Space
& home);
121
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
123
static
ExecStatus
post
(
Home
home,
ViewArray<View>
&
x
, Val s,
int
q,
int
l
,
int
u
);
125
static
ExecStatus
check
(
Space
& home,
ViewArray<View>
&
x
, Val s,
int
q,
int
l
,
int
u
);
127
virtual
size_t
dispose
(
Space
& home);
128
private
:
130
ViewArray<View>
x
;
132
Val s;
134
int
q;
136
int
l
;
138
int
u
;
140
ViewValSupportArray<View,Val,true>
vvsamax;
142
ViewValSupportArray<View,Val,false>
vvsamin;
144
Council<SupportAdvisor<View>
> ac;
146
bool
tofail;
147
};
148
149
}}}
150
151
#include <
gecode/int/sequence/set-op.hpp
>
152
#include <
gecode/int/sequence/violations.hpp
>
153
#include <
gecode/int/sequence/int.hpp
>
154
#include <
gecode/int/sequence/view.hpp
>
155
156
#endif
157
158
// STATISTICS: int-prop
Gecode::x
Post propagator for SetVar x
Definition:
set.hh:784
Gecode::Int::Sequence::ViewValSupportArray::update
void update(Space &home, bool share, ViewValSupportArray< View, Val, iss > &x)
Cloning.
Definition:
view.hpp:466
Gecode::Int::Sequence::Sequence::advise
ExecStatus advise(Space &home, Advisor &_a, const Delta &d)
Advise function.
Definition:
int.hpp:101
Test::Int::Precede::_a
Single _a(2, 3)
int.hh
Gecode::Int::Sequence::ViewValSupport
Class for view value support structure.
Definition:
view.hpp:85
violations.hpp
Gecode::Int::Sequence::Sequence::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition:
int.hpp:197
Gecode::Int::Sequence::Sequence::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition:
int.hpp:181
Gecode::Int::Sequence::ViewValSupportArray::advise
ExecStatus advise(Space &home, ViewArray< View > &a, Val s, int q, int j, const Delta &d)
Advise.
Definition:
view.hpp:487
Gecode::Space
Computation spaces.
Definition:
core.hpp:1748
Gecode::Actor
Base-class for both propagators and branchers.
Definition:
core.hpp:696
set-op.hpp
Gecode::Int::Sequence::ViewValSupportArray::operator[]
ViewValSupport< View, Val, iss > & operator[](int n)
Access element n.
Definition:
view.hpp:452
Gecode::Int::Sequence::Sequence::post
static ExecStatus post(Home home, ViewArray< View > &x, Val s, int q, int l, int u)
Post propagator for.
Definition:
int.hpp:163
u
union Gecode::@579::NNF::@61 u
Union depending on nodetype t.
view.hpp
Gecode
Gecode toplevel namespace
Gecode::Propagator
Base-class for propagators.
Definition:
core.hpp:1092
x
Node * x
Pointer to corresponding Boolean expression node.
Definition:
bool-expr.cpp:253
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition:
core.hpp:281
Gecode::Int::Sequence::ViewValSupportArray::size
int size(void) const
Return the current size.
Definition:
view.hpp:446
Gecode::Home
Home class for posting propagators
Definition:
core.hpp:922
a
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::Propagator::med
ModEventDelta med
A set of modification events (used during propagation)
Definition:
core.hpp:1103
int.hpp
rel.hh
Gecode::Int::Sequence::Sequence::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition:
int.hpp:129
Gecode::PropCost
Propagation cost.
Definition:
core.hpp:554
Gecode::Int::Sequence::Sequence::Sequence
Sequence(Space &home, bool shared, Sequence &p)
Constructor for cloning p.
Definition:
int.hpp:89
l
NNF * l
Left subtree.
Definition:
bool-expr.cpp:244
Gecode::Council
Council of advisors
Definition:
core.hpp:232
Gecode::Int::Sequence::Sequence
Sequence propagator for array of integers
Definition:
sequence.hh:105
Test::Int::Distinct::d
Gecode::IntSet d(v, 7)
Gecode::Advisor
Base-class for advisors.
Definition:
core.hpp:1294
Gecode::Int::Count::shared
bool shared(const IntSet &, VX)
Definition:
view-base.hpp:122
Gecode::Int::Sequence::Sequence::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition:
int.hpp:187
Gecode::Int::Sequence::ViewValSupportArray::ViewValSupportArray
ViewValSupportArray(void)
Default constructor.
Definition:
view.hpp:417
Gecode::ViewArray
View arrays.
Definition:
array.hpp:234
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:238
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition:
core.hpp:169
p
int p
Number of positive literals for node type.
Definition:
bool-expr.cpp:236
Gecode::Int::Sequence::Sequence::check
static ExecStatus check(Space &home, ViewArray< View > &x, Val s, int q, int l, int u)
Check for consistency.
Definition:
int.hpp:139
Gecode::Int::Sequence::ViewValSupportArray::propagate
ExecStatus propagate(Space &home, ViewArray< View > &a, Val s, int q, int l, int u)
Propagate.
Definition:
view.hpp:478
Gecode::Int::Sequence::Sequence::copy
virtual Actor * copy(Space &home, bool share)
Perform copying during cloning.
Definition:
int.hpp:175
Gecode::Int::Sequence::ViewValSupportArray
An array of ViewValSupport data structures.
Definition:
sequence.hh:69
Gecode::ExecStatus
ExecStatus
Definition:
core.hpp:540