main page
modules
namespaces
classes
files
Gecode home
Generated on Wed Jan 1 2020 10:37:59 for Gecode by
doxygen
1.8.16
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
* 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_SEQUENCE_HH__
35
#define __GECODE_INT_SEQUENCE_HH__
36
37
#include <
gecode/int.hh
>
38
#include <
gecode/int/rel.hh
>
39
40
namespace
Gecode
{
namespace
Int {
namespace
Sequence {
41
54
template
<
class
View>
55
class
SupportAdvisor;
56
57
template
<
class
View,
class
Val,
bool
iss>
58
class
ViewValSupport;
59
64
template
<
class
View,
class
Val,
bool
iss>
65
class
ViewValSupportArray
{
66
private
:
68
ViewValSupport<View,Val,iss>
* xs;
70
int
n;
71
public
:
73
ViewValSupportArray
(
void
);
75
ViewValSupportArray
(
const
ViewValSupportArray<View,Val,iss>
&);
77
ViewValSupportArray
(
Space
& home,
ViewArray<View>
&, Val s,
int
q);
79
ViewValSupportArray
(
Space
& home,
int
n
);
81
int
size
(
void
)
const
;
83
ViewValSupport<View,Val,iss>
&
operator []
(
int
n
);
85
const
ViewValSupport<View,Val,iss>
&
operator []
(
int
)
const
;
87
void
update
(
Space
& home,
ViewValSupportArray<View,Val,iss>
&
x
);
89
ExecStatus
propagate
(
Space
& home,
ViewArray<View>
&
a
,Val s,
int
q,
int
l
,
int
u
);
91
ExecStatus
advise
(
Space
& home,
ViewArray<View>
&
a
,Val s,
int
q,
int
j,
const
Delta
&
d
);
92
};
93
100
template
<
class
View,
class
Val>
101
class
Sequence
:
public
Propagator
{
102
protected
:
104
Sequence
(
Space
& home,
Sequence
&
p
);
106
Sequence
(
Home
home,
ViewArray<View>
& x, Val s,
int
q,
int
l,
int
u);
107
public
:
109
virtual
Actor
*
copy
(
Space
& home);
111
ExecStatus
advise
(
Space
& home,
Advisor
&
_a
,
const
Delta
&
d
);
113
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
115
virtual
void
reschedule
(
Space
& home);
117
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
119
static
ExecStatus
post
(
Home
home,
ViewArray<View>
&
x
, Val s,
int
q,
int
l
,
int
u
);
121
static
ExecStatus
check
(
ViewArray<View>
&
x
, Val s,
int
q,
int
l
,
int
u
);
123
virtual
size_t
dispose
(
Space
& home);
124
private
:
126
ViewArray<View>
x
;
128
Val s;
130
int
q;
132
int
l
;
134
int
u
;
136
ViewValSupportArray<View,Val,true>
vvsamax;
138
ViewValSupportArray<View,Val,false>
vvsamin;
140
Council<SupportAdvisor<View>
> ac;
142
bool
tofail;
143
};
144
145
}}}
146
147
#include <
gecode/int/sequence/set-op.hpp
>
148
#include <
gecode/int/sequence/violations.hpp
>
149
#include <
gecode/int/sequence/int.hpp
>
150
#include <
gecode/int/sequence/view.hpp
>
151
152
#endif
153
154
// STATISTICS: int-prop
Gecode::Int::Sequence::ViewValSupportArray::update
void update(Space &home, ViewValSupportArray< View, Val, iss > &x)
Cloning.
Definition:
view.hpp:461
Gecode::x
Post propagator for SetVar x
Definition:
set.hh:767
Gecode::Int::Sequence::Sequence::check
static ExecStatus check(ViewArray< View > &x, Val s, int q, int l, int u)
Check for consistency.
Definition:
int.hpp:109
Gecode::Int::Sequence::Sequence::advise
ExecStatus advise(Space &home, Advisor &_a, const Delta &d)
Advise function.
Definition:
int.hpp:71
Test::Int::Precede::_a
Single _a(2, 3)
int.hh
Gecode::Int::Sequence::ViewValSupport
Class for view value support structure.
Definition:
view.hpp:80
violations.hpp
Gecode::Int::Sequence::Sequence::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition:
int.hpp:167
Gecode::Int::Sequence::Sequence::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition:
int.hpp:151
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:482
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode::Actor
Base-class for both propagators and branchers.
Definition:
core.hpp:628
set-op.hpp
Gecode::Int::Sequence::ViewValSupportArray::operator[]
ViewValSupport< View, Val, iss > & operator[](int n)
Access element n.
Definition:
view.hpp:447
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:133
view.hpp
Gecode::Int::Sequence::Sequence::copy
virtual Actor * copy(Space &home)
Perform copying during cloning.
Definition:
int.hpp:145
u
union Gecode::@602::NNF::@65 u
Union depending on nodetype t.
Gecode
Gecode toplevel namespace
Gecode::Propagator
Base-class for propagators.
Definition:
core.hpp:1064
a
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
x
Node * x
Pointer to corresponding Boolean expression node.
Definition:
bool-expr.cpp:249
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition:
core.hpp:204
Gecode::Int::Sequence::ViewValSupportArray::size
int size(void) const
Return the current size.
Definition:
view.hpp:441
Gecode::Home
Home class for posting propagators
Definition:
core.hpp:856
Gecode::Propagator::med
ModEventDelta med
A set of modification events (used during propagation)
Definition:
core.hpp:1075
int.hpp
rel.hh
Gecode::Int::Sequence::Sequence::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition:
int.hpp:99
Gecode::PropCost
Propagation cost.
Definition:
core.hpp:486
l
NNF * l
Left subtree.
Definition:
bool-expr.cpp:240
Gecode::Council
Council of advisors
Definition:
core.hpp:155
Gecode::Int::Sequence::Sequence
Sequence propagator for array of integers
Definition:
sequence.hh:101
Gecode::Int::Sequence::Sequence::Sequence
Sequence(Space &home, Sequence &p)
Constructor for cloning p.
Definition:
int.hpp:60
Test::Int::Distinct::d
Gecode::IntSet d(v, 7)
Gecode::Advisor
Base-class for advisors.
Definition:
core.hpp:1292
Gecode::Int::Sequence::Sequence::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition:
int.hpp:157
Gecode::Int::Sequence::ViewValSupportArray::ViewValSupportArray
ViewValSupportArray(void)
Default constructor.
Definition:
view.hpp:412
Gecode::ViewArray
View arrays.
Definition:
array.hpp:253
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
p
int p
Number of positive literals for node type.
Definition:
bool-expr.cpp:232
Gecode::Int::Sequence::ViewValSupportArray::propagate
ExecStatus propagate(Space &home, ViewArray< View > &a, Val s, int q, int l, int u)
Propagate.
Definition:
view.hpp:473
Gecode::Int::Sequence::ViewValSupportArray
An array of ViewValSupport data structures.
Definition:
sequence.hh:65
Gecode::ExecStatus
ExecStatus
Definition:
core.hpp:472